diff --git a/Jakefile.js b/Jakefile.js index 372058271ca..257d4e6f3f5 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -147,7 +147,8 @@ var harnessSources = harnessCoreSources.concat([ "transpile.ts", "reuseProgramStructure.ts", "cachingInServerLSHost.ts", - "moduleResolution.ts" + "moduleResolution.ts", + "tsconfigParsing.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ @@ -227,7 +228,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) { file(outFile, prereqs, function() { var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; - var options = "--noImplicitAny --noEmitOnError"; + var options = "--noImplicitAny --noEmitOnError --pretty"; // Keep comments when specifically requested // or when in debug mode. diff --git a/lib/tsc.js b/lib/tsc.js index 511fc67c0aa..bbbcedf0f47 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -49,40 +49,49 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function createFileMap(getCanonicalFileName) { + function createFileMap(keyMapper) { var files = {}; return { get: get, set: set, contains: contains, remove: remove, - clear: clear, - forEachValue: forEachValueInMap + forEachValue: forEachValueInMap, + clear: clear }; - function set(fileName, value) { - files[normalizeKey(fileName)] = value; - } - function get(fileName) { - return files[normalizeKey(fileName)]; - } - function contains(fileName) { - return hasProperty(files, normalizeKey(fileName)); - } - function remove(fileName) { - var key = normalizeKey(fileName); - delete files[key]; - } function forEachValueInMap(f) { - forEachValue(files, f); + for (var key in files) { + f(key, files[key]); + } } - function normalizeKey(key) { - return getCanonicalFileName(normalizeSlashes(key)); + function get(path) { + return files[toKey(path)]; + } + function set(path, value) { + files[toKey(path)] = value; + } + function contains(path) { + return hasProperty(files, toKey(path)); + } + function remove(path) { + var key = toKey(path); + delete files[key]; } function clear() { files = {}; } + function toKey(path) { + return keyMapper ? keyMapper(path) : path; + } } ts.createFileMap = createFileMap; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) + ? normalizePath(fileName) + : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts.toPath = toPath; function forEach(array, callback) { if (array) { for (var i = 0, len = array.length; i < len; i++) { @@ -97,8 +106,8 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; if (v === value) { return true; } @@ -121,8 +130,8 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; if (predicate(v)) { count++; } @@ -135,8 +144,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; if (f(item)) { result.push(item); } @@ -149,8 +158,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; result.push(f(v)); } } @@ -169,8 +178,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; if (!contains(result, item)) { result.push(item); } @@ -181,8 +190,8 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; result += v[prop]; } return result; @@ -190,8 +199,8 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0; _i < from.length; _i++) { - var v = from[_i]; + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; to.push(v); } } @@ -512,8 +521,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { - var part = parts[_i]; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); @@ -661,8 +670,8 @@ var ts; if (!fileName) { return false; } - for (var _i = 0; _i < ts.supportedExtensions.length; _i++) { - var extension = ts.supportedExtensions[_i]; + for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -672,8 +681,8 @@ var ts; ts.isSupportedSourceFileName = isSupportedSourceFileName; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { - for (var _i = 0; _i < extensionsToRemove.length; _i++) { - var ext = extensionsToRemove[_i]; + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -747,8 +756,8 @@ var ts; })(Debug = ts.Debug || (ts.Debug = {})); function copyListRemovingItem(item, list) { var copiedList = []; - for (var _i = 0; _i < list.length; _i++) { - var e = list[_i]; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var e = list_1[_i]; if (e !== item) { copiedList.push(e); } @@ -834,16 +843,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; var name_1 = ts.combinePaths(path, current); if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) { result.push(name_1); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _a = 0, subfolders_1 = subfolders; _a < subfolders_1.length; _a++) { + var current = subfolders_1[_a]; var name_2 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_2))) { visitDirectory(name_2); @@ -894,6 +903,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _tty = require("tty"); function createWatchedFileSet(interval, chunkSize) { if (interval === void 0) { interval = 2500; } if (chunkSize === void 0) { chunkSize = 30; } @@ -1006,8 +1016,8 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1021,8 +1031,8 @@ var ts; } } } - for (var _a = 0; _a < directories.length; _a++) { - var current = directories[_a]; + for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { + var current = directories_1[_a]; visitDirectory(current); } } @@ -1032,14 +1042,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, "utf8"); - var offset = 0; - var toWrite = buffer.length; - var written = 0; - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } + process.stdout.write(s); }, readFile: readFile, writeFile: writeFile, @@ -1306,6 +1309,7 @@ var ts; await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, + The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -1358,7 +1362,7 @@ var ts; Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_th_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "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: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, @@ -1379,7 +1383,7 @@ var ts; Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement_2378", message: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, @@ -1669,8 +1673,6 @@ var ts; NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, @@ -1678,7 +1680,14 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Disallow_inconsistently_cased_references_to_the_same_file: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6073", message: "Disallow inconsistently-cased references to the same file." }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, + Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, + Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, + Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, + Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -1696,6 +1705,10 @@ var ts; 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: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "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." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, + Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, + Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, + Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -3082,6 +3095,13 @@ var ts; var ts; (function (ts) { ts.bindTime = 0; + function or(state1, state2) { + return (state1 | state2) & 2 + ? 2 + : (state1 & state2) & 8 + ? 8 + : 4; + } function getModuleInstanceState(node) { if (node.kind === 215 || node.kind === 216) { return 0; @@ -3089,7 +3109,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 1)) { + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { return 0; } else if (node.kind === 219) { @@ -3116,28 +3136,52 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function bindSourceFile(file) { + var binder = createBinder(); + function bindSourceFile(file, options) { var start = new Date().getTime(); - bindSourceFileWorker(file); + binder(file, options); ts.bindTime += new Date().getTime() - start; } ts.bindSourceFile = bindSourceFile; - function bindSourceFileWorker(file) { + function createBinder() { + var file; + var options; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; - var inStrictMode = !!file.externalModuleIndicator; + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; + var inStrictMode; var symbolCount = 0; - var Symbol = ts.objectAllocator.getSymbolConstructor(); - var classifiableNames = {}; - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } - return; + return bindSourceFile; function createSymbol(flags, name) { symbolCount++; return new Symbol(flags, name); @@ -3188,7 +3232,7 @@ var ts; return node.isExportEquals ? "export=" : "default"; case 213: case 214: - return node.flags & 1024 ? "default" : undefined; + return node.flags & 512 ? "default" : undefined; } } function getDisplayName(node) { @@ -3196,7 +3240,7 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 1024; + var isDefaultExport = node.flags & 512; var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { @@ -3214,7 +3258,7 @@ var ts; ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 1024) { + if (declaration.flags & 512) { message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); @@ -3233,7 +3277,7 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; if (symbolFlags & 8388608) { if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); @@ -3243,7 +3287,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 262144) { + if (hasExportModifier || container.flags & 131072) { var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | (symbolFlags & 793056 ? 2097152 : 0) | (symbolFlags & 1536 ? 4194304 : 0); @@ -3274,18 +3318,202 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - if (node.kind === 215) { + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + flags &= ~1572864; + if (kind === 215) { seenThisKeyword = false; - ts.forEachChild(node, bind); - node.flags = seenThisKeyword ? node.flags | 524288 : node.flags & ~524288; } - else { - ts.forEachChild(node, bind); + var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288; + if (hasExplicitReturn) { + flags |= 1048576; + } + } + if (kind === 215) { + flags = seenThisKeyword ? flags | 262144 : flags & ~262144; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198: + bindWhileStatement(node); + break; + case 197: + bindDoStatement(node); + break; + case 199: + bindForStatement(node); + break; + case 200: + case 201: + bindForInOrForOfStatement(node); + break; + case 196: + bindIfStatement(node); + break; + case 204: + case 208: + bindReturnOrThrow(node); + break; + case 203: + case 202: + bindBreakOrContinueStatement(node); + break; + case 209: + bindTryStatement(node); + break; + case 206: + bindSwitchStatement(node); + break; + case 220: + bindCaseBlock(node); + break; + case 207: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 ? 4 : preDoState; + popImplicitLabel(postDoLabel, postDoState); + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + var isInfiniteLoop = (!n.condition || n.condition.kind === 99); + var postForState = isInfiniteLoop ? 4 : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; + currentReachabilityState = ifTrueState; + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + bind(n.expression); + if (n.kind === 204) { + hasExplicitReturn = true; + } + currentReachabilityState = 4; + } + function bindBreakOrContinueStatement(n) { + bind(n.label); + var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); + if (isValidJump) { + currentReachabilityState = 4; + } + } + function bindTryStatement(n) { + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); + var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } function getContainerFlags(node) { switch (node.kind) { case 186: @@ -3365,7 +3593,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 128 + return node.flags & 64 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -3374,15 +3602,6 @@ var ts; ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } - function isAmbientContext(node) { - while (node) { - if (node.flags & 2) { - return true; - } - node = node.parent; - } - return false; - } function hasExportDeclarations(node) { var body = node.kind === 248 ? node : node.body; if (body.kind === 248 || body.kind === 219) { @@ -3396,11 +3615,11 @@ var ts; return false; } function setExportContextFlag(node) { - if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 262144; + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072; } else { - node.flags &= ~262144; + node.flags &= ~131072; } } function bindModuleDeclaration(node) { @@ -3551,7 +3770,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 65536) { + if (inStrictMode && node.flags & 32768) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -3569,10 +3788,10 @@ var ts; } function checkStrictModeWithStatement(node) { if (inStrictMode) { - grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } - function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + function errorOnFirstToken(node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } @@ -3580,6 +3799,9 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { + if (!node) { + return; + } node.parent = parent; var savedInStrictMode = inStrictMode; if (!savedInStrictMode) { @@ -3607,8 +3829,8 @@ var ts; } } function updateStrictModeStatementList(statements) { - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -3795,7 +4017,7 @@ var ts; else { declareSymbolAndAddToSymbolTable(node, 1, 107455); } - if (node.flags & 112 && + if (node.flags & 56 && node.parent.kind === 144 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; @@ -3807,6 +4029,95 @@ var ts; ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4: + var reportError = ts.isStatement(node) || + node.kind === 214 || + (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 || + ts.getCombinedNodeFlags(node.declarationList) & 24576 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } } })(ts || (ts = {})); var ts; @@ -3814,8 +4125,8 @@ var ts; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; if (declaration.kind === kind) { return declaration; } @@ -3985,7 +4296,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 49152) !== 0 || + return (getCombinedNodeFlags(declaration) & 24576) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; @@ -4086,7 +4397,7 @@ var ts; } ts.isExternalModule = isExternalModule; function isDeclarationFile(file) { - return (file.flags & 8192) !== 0; + return (file.flags & 4096) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { @@ -4116,11 +4427,11 @@ var ts; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 32768); + return !!(getCombinedNodeFlags(node) & 16384); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 16384); + return !!(getCombinedNodeFlags(node) & 8192); } ts.isLet = isLet; function isPrologueDirective(node) { @@ -4299,27 +4610,28 @@ var ts; } ts.isClassLike = isClassLike; function isFunctionLike(node) { - if (node) { - switch (node.kind) { - case 144: - case 173: - case 213: - case 174: - case 143: - case 142: - case 145: - case 146: - case 147: - case 148: - case 149: - case 152: - case 153: - return true; - } - } - return false; + return node && isFunctionLikeKind(node.kind); } ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 144: + case 173: + case 213: + case 174: + case 143: + case 142: + case 145: + case 146: + case 147: + case 148: + case 149: + case 152: + case 153: + return true; + } + } + ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { case 143: @@ -4783,9 +5095,18 @@ var ts; return !!node && (node.kind === 162 || node.kind === 161); } ts.isBindingPattern = isBindingPattern; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 | 8192)) { + if (node.flags & (4 | 4096)) { return true; } node = node.parent; @@ -4843,7 +5164,7 @@ var ts; case 207: case 204: case 206: - case 98: + case 208: case 209: case 193: case 198: @@ -4942,8 +5263,8 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { - var clause = clauses[_i]; + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; if (clause.token === kind) { return clause; } @@ -4955,7 +5276,6 @@ var ts; function tryResolveScriptReference(host, sourceFile, reference) { if (!host.getCompilerOptions().noResolve) { var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); - referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } } @@ -5013,7 +5333,7 @@ var ts; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { - return isFunctionLike(node) && (node.flags & 512) !== 0 && !isAccessor(node); + return isFunctionLike(node) && (node.flags & 256) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { @@ -5371,7 +5691,7 @@ var ts; else { ts.forEach(declarations, function (member) { if ((member.kind === 145 || member.kind === 146) - && (member.flags & 128) === (accessor.flags & 128)) { + && (member.flags & 64) === (accessor.flags & 64)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -5426,6 +5746,49 @@ var ts; }); } ts.emitComments = emitComments; + function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + } + ts.emitDetachedComments = emitDetachedComments; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); @@ -5490,16 +5853,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 113: return 128; - case 112: return 16; - case 111: return 64; - case 110: return 32; - case 115: return 256; - case 82: return 1; - case 122: return 2; - case 74: return 32768; - case 77: return 1024; - case 118: return 512; + case 113: return 64; + case 112: return 8; + case 111: return 32; + case 110: return 16; + case 115: return 128; + case 82: return 2; + case 122: return 4; + case 74: return 16384; + case 77: return 512; + case 118: return 256; } return 0; } @@ -5578,7 +5941,7 @@ var ts; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isJavaScript(fileName) { @@ -5642,6 +6005,12 @@ var ts; return result; } ts.convertToBase64 = convertToBase64; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !ts.isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false); + } + ts.convertToRelativePath = convertToRelativePath; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function getNewLineCharacter(options) { @@ -5814,8 +6183,8 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; var result = cbNode(node); if (result) { return result; @@ -6276,8 +6645,8 @@ var ts; function addJSDocComment(node) { var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); if (comments) { - for (var _i = 0; _i < comments.length; _i++) { - var comment = comments[_i]; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); if (jsDocComment) { node.jsDocComment = jsDocComment; @@ -6308,7 +6677,7 @@ var ts; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 8192 : 0; + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 : 0; return sourceFile; } @@ -7144,7 +7513,7 @@ var ts; if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 65536; + node.flags |= 32768; } return node; } @@ -7713,7 +8082,7 @@ var ts; if (!arrowFunction) { return undefined; } - var isAsync = !!(arrowFunction.flags & 512); + var isAsync = !!(arrowFunction.flags & 256); var lastToken = token; arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); arrowFunction.body = (lastToken === 34 || lastToken === 15) @@ -7805,7 +8174,7 @@ var ts; function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNode(174); setModifiers(node, parseModifiersForArrowFunction()); - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -8419,7 +8788,7 @@ var ts; var node = createNode(164); parseExpected(19); if (scanner.hasPrecedingLineBreak()) - node.flags |= 2048; + node.flags |= 1024; node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); parseExpected(20); return finishNode(node); @@ -8474,7 +8843,7 @@ var ts; var node = createNode(165); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 2048; + node.flags |= 1024; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); parseExpected(16); @@ -8490,7 +8859,7 @@ var ts; parseExpected(87); node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : @@ -9028,10 +9397,10 @@ var ts; case 102: break; case 108: - node.flags |= 16384; + node.flags |= 8192; break; case 74: - node.flags |= 32768; + node.flags |= 16384; break; default: ts.Debug.fail(); @@ -9065,9 +9434,9 @@ var ts; setModifiers(node, modifiers); parseExpected(87); node.asteriskToken = parseOptionalToken(37); - node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); + node.name = node.flags & 512 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); @@ -9089,7 +9458,7 @@ var ts; method.name = name; method.questionToken = questionToken; var isGenerator = !!asteriskToken; - var isAsync = !!(method.flags & 512); + var isAsync = !!(method.flags & 256); fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); @@ -9101,7 +9470,7 @@ var ts; property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); - property.initializer = modifiers && modifiers.flags & 128 + property.initializer = modifiers && modifiers.flags & 64 ? allowInAnd(parseNonParameterInitializer) : doOutsideOfContext(2 | 1, parseNonParameterInitializer); parseSemicolon(); @@ -9391,13 +9760,13 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(218, fullStart); - var namespaceFlag = flags & 131072; + var namespaceFlag = flags & 65536; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 2 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -9412,7 +9781,7 @@ var ts; function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; if (parseOptional(126)) { - flags |= 131072; + flags |= 65536; } else { parseExpected(125); @@ -9626,7 +9995,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 + return node.flags & 2 || node.kind === 221 && node.moduleReference.kind === 232 || node.kind === 222 || node.kind === 227 @@ -10200,8 +10569,8 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var node = array_7[_i]; visitNode(node); } } @@ -10273,8 +10642,8 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; visitNode(node); } return; @@ -10547,6 +10916,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var jsxElementClassType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -10795,7 +11165,7 @@ var ts; } var initializerOfNonStaticProperty = current.parent && current.parent.kind === 141 && - (current.parent.flags & 128) === 0 && + (current.parent.flags & 64) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -10854,7 +11224,7 @@ var ts; break; case 141: case 140: - if (ts.isClassLike(location.parent) && !(location.flags & 128)) { + if (ts.isClassLike(location.parent) && !(location.flags & 64)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -10867,7 +11237,7 @@ var ts; case 186: case 215: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { - if (lastLocation && lastLocation.flags & 128) { + if (lastLocation && lastLocation.flags & 64) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } @@ -11301,8 +11671,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { - var member = members[_i]; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; if (member.kind === 144 && ts.nodeIsPresent(member.body)) { return member; } @@ -11508,7 +11878,7 @@ var ts; if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 1) && + !(anyImportSyntax.flags & 2) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -11638,8 +12008,8 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { - var accessibleSymbol = accessibleSymbolChain[_i]; + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } @@ -11805,7 +12175,7 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 128; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { @@ -11911,8 +12281,8 @@ var ts; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var signature = signatures[_f]; + for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { + var signature = signatures_1[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 53); @@ -12115,7 +12485,7 @@ var ts; case 217: case 221: var parent_4 = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && + if (!(ts.getCombinedNodeFlags(node) & 2) && !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } @@ -12126,7 +12496,7 @@ var ts; case 146: case 143: case 142: - if (node.flags & (32 | 64)) { + if (node.flags & (16 | 32)) { return false; } case 144: @@ -12555,8 +12925,8 @@ var ts; } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -12737,13 +13107,13 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.kind === 215) { - if (declaration.flags & 524288) { + if (declaration.flags & 262144) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); if (baseTypeNodes) { - for (var _b = 0; _b < baseTypeNodes.length; _b++) { - var node = baseTypeNodes[_b]; + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; if (ts.isSupportedExpressionWithTypeArguments(node)) { var baseSymbol = resolveEntityName(node.expression, 793056, true); if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { @@ -12911,23 +13281,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { - var s = baseSymbols[_i]; + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -12935,8 +13305,8 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { - var signature = baseSignatures[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var signature = baseSignatures_1[_i]; signatures.push(signature); } } @@ -12979,8 +13349,8 @@ var ts; members = createSymbolTable(source.declaredProperties); } var thisArgument = ts.lastOrUndefined(typeArguments); - for (var _i = 0; _i < baseTypes.length; _i++) { - var baseType = baseTypes[_i]; + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); @@ -13026,8 +13396,8 @@ var ts; var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0; _i < baseSignatures.length; _i++) { - var baseSig = baseSignatures[_i]; + for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { + var baseSig = baseSignatures_2[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -13055,8 +13425,8 @@ var ts; setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { - for (var _i = 0; _i < signatureList.length; _i++) { - var s = signatureList[_i]; + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } @@ -13110,8 +13480,8 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type = types_1[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; @@ -13275,12 +13645,12 @@ var ts; function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (32 | 64))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 | 32))) { if (!props) { props = [prop]; } @@ -13301,8 +13671,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var prop = props[_a]; + for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { + var prop = props_1[_a]; if (prop.declarations) { ts.addRange(declarations, prop.declarations); } @@ -13635,8 +14005,8 @@ var ts; } function getPropagatingFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type = types_3[_i]; result |= type.flags; } return result & 14680064; @@ -13757,8 +14127,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; switch (declaration.kind) { case 214: case 215: @@ -13856,8 +14226,8 @@ var ts; } } function addTypesToSet(typeSet, types, typeSetKind) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; addTypeToSet(typeSet, type, typeSetKind); } } @@ -13879,8 +14249,8 @@ var ts; } } function containsTypeAny(types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (isTypeAny(type)) { return true; } @@ -13983,7 +14353,8 @@ var ts; var container = ts.getThisContainer(node, false); var parent = container && container.parent; if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { - if (!(container.flags & 128)) { + if (!(container.flags & 64) && + (container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -14048,8 +14419,8 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { - var v = items[_i]; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var v = items_1[_i]; result.push(instantiator(v, mapper)); } return result; @@ -14088,8 +14459,8 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { - var source = sources[_i]; + for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { + var source = sources_1[_i]; if (t === source) { return anyType; } @@ -14454,8 +14825,8 @@ var ts; function eachTypeRelatedToSomeType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; var related = typeRelatedToSomeType(sourceType, target, false); if (!related) { return 0; @@ -14477,8 +14848,8 @@ var ts; function typeRelatedToEachType(source, target, reportErrors) { var result = -1; var targetTypes = target.types; - for (var _i = 0; _i < targetTypes.length; _i++) { - var targetType = targetTypes[_i]; + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var targetType = targetTypes_1[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0; @@ -14500,8 +14871,8 @@ var ts; function eachTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { + var sourceType = sourceTypes_2[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; @@ -14614,8 +14985,8 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 524288); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var targetProp = properties_1[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -14629,20 +15000,20 @@ var ts; else if (!(targetProp.flags & 134217728)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 32 || targetPropFlags & 32) { + if (sourcePropFlags & 16 || targetPropFlags & 16) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 32 && targetPropFlags & 32) { + if (sourcePropFlags & 16 && targetPropFlags & 16) { 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(sourcePropFlags & 32 ? source : target), typeToString(sourcePropFlags & 32 ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 ? source : target), typeToString(sourcePropFlags & 16 ? target : source)); } } return 0; } } - else if (targetPropFlags & 64) { + else if (targetPropFlags & 32) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); @@ -14653,7 +15024,7 @@ var ts; return 0; } } - else if (sourcePropFlags & 64) { + else if (sourcePropFlags & 32) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -14688,8 +15059,8 @@ var ts; return 0; } var result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -14721,13 +15092,13 @@ var ts; return result; } } - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { - var t = targetSignatures[_i]; + outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; if (!t.hasStringLiterals || target.flags & 262144) { var localErrors = reportErrors; var checkedAbstractAssignability = false; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; if (!s.hasStringLiterals || source.flags & 262144) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -14755,8 +15126,8 @@ var ts; var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { if (reportErrors) { reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); @@ -14957,8 +15328,8 @@ var ts; if (sourceProp === targetProp) { return -1; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 | 64); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 | 64); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 | 32); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 | 32); if (sourcePropAccessibility !== targetPropAccessibility) { return 0; } @@ -15024,8 +15395,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } @@ -15238,8 +15609,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { - var unused = typeParameters[_i]; + for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { + var unused = typeParameters_1[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); @@ -15305,8 +15676,8 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0; _i < targetTypes.length; _i++) { - var t = targetTypes[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var t = targetTypes_2[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -15323,8 +15694,8 @@ var ts; } else if (source.flags & 49152) { var sourceTypes = source.types; - for (var _a = 0; _a < sourceTypes.length; _a++) { - var sourceType = sourceTypes[_a]; + for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { + var sourceType = sourceTypes_3[_a]; inferFromTypes(sourceType, target); } } @@ -15357,8 +15728,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var targetProp = properties_2[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -15849,7 +16220,7 @@ var ts; break; case 141: case 140: - if (container.flags & 128) { + if (container.flags & 64) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -15862,7 +16233,7 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return container.flags & 64 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } @@ -15890,7 +16261,7 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (canUseSuperExpression) { - if ((container.flags & 128) || isCallExpression) { + if ((container.flags & 64) || isCallExpression) { nodeCheckFlag = 512; } else { @@ -15935,7 +16306,7 @@ var ts; } else { if (container && ts.isClassLike(container.parent)) { - if (container.flags & 128) { + if (container.flags & 64) { return container.kind === 143 || container.kind === 142 || container.kind === 145 || @@ -16074,8 +16445,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var current = types_7[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -16239,8 +16610,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { @@ -16291,8 +16662,8 @@ var ts; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); - for (var _i = 0; _i < elements.length; _i++) { - var e = elements[_i]; + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var e = elements_1[_i]; if (inDestructuringPattern && e.kind === 185) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || @@ -16551,8 +16922,8 @@ var ts; function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { var type = checkExpression(node.expression); var props = getPropertiesOfType(type); - for (var _i = 0; _i < props.length; _i++) { - var prop = props[_i]; + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; if (!nameTable[prop.name]) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { @@ -16721,7 +17092,6 @@ var ts; var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } - var jsxElementClassType = undefined; function getJsxGlobalElementClassType() { if (!jsxElementClassType) { jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); @@ -16788,7 +17158,7 @@ var ts; return s.valueDeclaration ? s.valueDeclaration.kind : 141; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 8 | 64 : 0; } function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); @@ -16801,17 +17171,17 @@ var ts; error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } - if (flags & 256) { + if (flags & 128) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); return false; } } - if (!(flags & (32 | 64))) { + if (!(flags & (16 | 32))) { return true; } var enclosingClassDeclaration = ts.getContainingClass(node); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - if (flags & 32) { + if (flags & 16) { if (declaringClass !== enclosingClass) { error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; @@ -16825,7 +17195,7 @@ var ts; error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } - if (flags & 128) { + if (flags & 64) { return true; } if (type.flags & 33554432) { @@ -17005,8 +17375,8 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { - var signature = signatures[_i]; + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { @@ -17417,8 +17787,8 @@ var ts; reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { - var candidate = candidates[_i]; + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; if (hasCorrectArity(node, args, candidate)) { if (candidate.typeParameters && typeArguments) { candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); @@ -17437,8 +17807,8 @@ var ts; diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); } function chooseOverload(candidates, relation) { - for (var _i = 0; _i < candidates.length; _i++) { - var originalCandidate = candidates[_i]; + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var originalCandidate = candidates_2[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } @@ -17541,7 +17911,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && valueDecl.flags & 256) { + if (valueDecl && valueDecl.flags & 128) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); } @@ -17827,32 +18197,24 @@ var ts; }); return aggregatedTypes; } - function bodyContainsAReturnStatement(funcBody) { - return ts.forEachReturnStatement(funcBody, function (returnStatement) { - return true; - }); - } - function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 208); - } - function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 || !(func.flags & 524288)) { return; } - var bodyBlock = func.body; - if (bodyContainsAReturnStatement(bodyBlock)) { - return; + if (func.flags & 1048576) { + if (compilerOptions.noImplicitReturns) { + error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } - if (bodyContainsSingleThrowStatement(bodyBlock)) { - return; + else { + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } - error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); @@ -17911,7 +18273,7 @@ var ts; promisedType = checkAsyncFunctionReturnType(node); } if (returnType && !node.asteriskToken) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (node.body) { if (!node.type) { @@ -17970,7 +18332,7 @@ var ts; case 69: case 166: { var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384) !== 0; } case 167: { var index = n.argumentExpression; @@ -17978,7 +18340,7 @@ var ts; if (symbol && index && index.kind === 9) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768) !== 0; + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384) !== 0; } return false; } @@ -18058,8 +18420,8 @@ var ts; } if (type.flags & 49152) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; if (current.flags & kind) { return true; } @@ -18074,8 +18436,8 @@ var ts; } if (type.flags & 49152) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var current = types_10[_i]; if (!(current.flags & kind)) { return false; } @@ -18110,8 +18472,8 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { - var p = properties[_i]; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var p = properties_3[_i]; if (p.kind === 245 || p.kind === 246) { var name_13 = p.name; var type = isTypeAny(sourceType) @@ -18573,7 +18935,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 112) { + if (node.flags & 56) { func = ts.getContainingFunction(node); if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -18754,7 +19116,7 @@ var ts; function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); checkFunctionLikeDeclaration(node); - if (node.flags & 256 && node.body) { + if (node.flags & 128 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -18801,7 +19163,7 @@ var ts; } function isInstancePropertyWithInitializer(n) { return n.kind === 141 && - !(n.flags & 128) && + !(n.flags & 64) && !!n.initializer; } var containingClassDecl = node.parent; @@ -18814,12 +19176,12 @@ var ts; error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + ts.forEach(node.parameters, function (p) { return p.flags & (8 | 16 | 32); }); if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement; - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; @@ -18845,15 +19207,22 @@ var ts; if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); if (node.kind === 145) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(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); + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288)) { + if (node.flags & 1048576) { + if (compilerOptions.noImplicitReturns) { + error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); + } } } if (!ts.hasDynamicName(node)) { var otherKind = node.kind === 145 ? 146 : 145; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 112) !== (otherAccessor.flags & 112))) { + if (((node.flags & 56) !== (otherAccessor.flags & 56))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var currentAccessorType = getAnnotatedAccessorType(node); @@ -18920,7 +19289,7 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 32) && ts.isInAmbientContext(node); + return (node.flags & 16) && ts.isInAmbientContext(node); } function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { if (!produceDiagnostics) { @@ -18945,8 +19314,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { - var otherSignature = signaturesToCheck[_i]; + for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { + var otherSignature = signaturesToCheck_1[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -18959,10 +19328,10 @@ var ts; n.parent.kind !== 214 && n.parent.kind !== 186 && ts.isInAmbientContext(n)) { - if (!(flags & 2)) { - flags |= 1; + if (!(flags & 4)) { + flags |= 2; } - flags |= 2; + flags |= 4; } return flags & flagsToCheck; } @@ -18980,16 +19349,16 @@ var ts; var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 1) { + if (deviation & 2) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } - else if (deviation & 2) { + else if (deviation & 4) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (32 | 64)) { + else if (deviation & (16 | 32)) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 256) { + else if (deviation & 128) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); } }); @@ -19006,7 +19375,7 @@ var ts; }); } } - var flagsToCheck = 1 | 2 | 32 | 64 | 256; + var flagsToCheck = 2 | 4 | 16 | 32 | 128; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -19035,8 +19404,8 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); - var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + ts.Debug.assert((node.flags & 64) !== (subsequentNode.flags & 64)); + var diagnostic = node.flags & 64 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); return; } @@ -19051,7 +19420,7 @@ var ts; error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); } else { - if (node.flags & 256) { + if (node.flags & 128) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -19062,8 +19431,8 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; @@ -19112,7 +19481,7 @@ var ts; }); } if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 256)) { + !(lastSeenNonAmbientDeclaration.flags & 128)) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -19122,8 +19491,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19153,9 +19522,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); - if (effectiveDeclarationFlags & 1) { - if (effectiveDeclarationFlags & 1024) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 | 512); + if (effectiveDeclarationFlags & 2) { + if (effectiveDeclarationFlags & 512) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -19291,9 +19660,12 @@ var ts; if (promiseType === unknownType && compilerOptions.isolatedModules) { return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } var promiseConstructorType = getTypeOfSymbol(promiseConstructor); @@ -19452,7 +19824,7 @@ var ts; if (isAsync) { promisedType = checkAsyncFunctionReturnType(node); } - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (produceDiagnostics && !node.type) { if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { @@ -19555,7 +19927,7 @@ var ts; } } function checkVarDeclaredNamesNotShadowed(node) { - if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 24576) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 211 && !node.initializer) { @@ -19567,7 +19939,7 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent ? varDeclList.parent.parent @@ -19694,6 +20066,9 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 194) { + error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } checkSourceElement(node.elseStatement); } function checkDoStatement(node) { @@ -19943,7 +20318,7 @@ var ts; error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else if (func.kind === 144) { - if (!isTypeAssignableTo(exprType, returnType)) { + if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } @@ -20073,7 +20448,7 @@ var ts; var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; - if (!(member.flags & 128) && ts.hasDynamicName(member)) { + if (!(member.flags & 64) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); @@ -20149,7 +20524,7 @@ var ts; return getTypeOfSymbol(getSymbolOfNode(node)); } function checkClassDeclaration(node) { - if (!node.name && !(node.flags & 1024)) { + if (!node.name && !(node.flags & 512)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -20199,8 +20574,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - for (var _b = 0; _b < implementedTypeNodes.length; _b++) { - var typeRefNode = implementedTypeNodes[_b]; + for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { + var typeRefNode = implementedTypeNodes_1[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -20232,8 +20607,8 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { - var baseProperty = baseProperties[_i]; + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; @@ -20244,7 +20619,7 @@ var ts; if (derived) { if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); - if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { + if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { if (derivedClassDecl.kind === 186) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } @@ -20255,10 +20630,10 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 32) || (derivedDeclarationFlags & 32)) { + if ((baseDeclarationFlags & 16) || (derivedDeclarationFlags & 16)) { continue; } - if ((baseDeclarationFlags & 128) !== (derivedDeclarationFlags & 128)) { + if ((baseDeclarationFlags & 64) !== (derivedDeclarationFlags & 64)) { continue; } if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { @@ -20324,11 +20699,11 @@ var ts; var seen = {}; ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0; _i < baseTypes.length; _i++) { - var base = baseTypes[_i]; + for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { + var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0; _a < properties.length; _a++) { - var prop = properties[_a]; + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } @@ -20597,8 +20972,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; if ((declaration.kind === 214 || (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { @@ -20726,7 +21101,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -20753,7 +21128,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 1) { + if (node.flags & 2) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -20781,7 +21156,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -20820,7 +21195,7 @@ var ts; error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69) { @@ -21205,7 +21580,7 @@ var ts; } case 214: case 215: - if (!(memberFlags & 128)) { + if (!(memberFlags & 64)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; @@ -21467,7 +21842,7 @@ var ts; } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 128 + return node.flags & 64 ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -21753,7 +22128,7 @@ var ts; } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { - ts.bindSourceFile(file); + ts.bindSourceFile(file, compilerOptions); }); ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalModule(file)) { @@ -21897,19 +22272,19 @@ var ts; text = "private"; lastPrivate = modifier; } - if (flags & 112) { + if (flags & 56) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 128) { + else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } - else if (flags & 256) { + else if (flags & 128) { if (modifier.kind === 110) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -21920,10 +22295,10 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113: - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === 219 || node.parent.kind === 248) { @@ -21932,23 +22307,23 @@ var ts; else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 256) { + else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 128; + flags |= 64; lastStatic = modifier; break; case 82: - if (flags & 1) { + if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 2) { + else if (flags & 4) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 256) { + else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (node.parent.kind === 214) { @@ -21957,13 +22332,13 @@ var ts; else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 1; + flags |= 2; break; case 122: - if (flags & 2) { + if (flags & 4) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.parent.kind === 214) { @@ -21975,69 +22350,69 @@ var ts; else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 2; + flags |= 4; lastDeclare = modifier; break; case 115: - if (flags & 256) { + if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } if (node.kind !== 214) { if (node.kind !== 143) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 214 && node.parent.flags & 256)) { + if (!(node.parent.kind === 214 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 32) { + if (flags & 16) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } - flags |= 256; + flags |= 128; break; case 118: - if (flags & 512) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 2 || ts.isInAmbientContext(node.parent)) { + else if (flags & 4 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - flags |= 512; + flags |= 256; lastAsync = modifier; break; } } if (node.kind === 144) { - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - if (flags & 256) { + if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 64) { + else if (flags & 32) { return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (flags & 32) { + else if (flags & 16) { return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return; } - else if ((node.kind === 222 || node.kind === 221) && flags & 2) { + else if ((node.kind === 222 || node.kind === 221) && flags & 4) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 && (flags & 56) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } - if (flags & 512) { + if (flags & 256) { return checkGrammarAsyncModifier(node, lastAsync); } } @@ -22137,7 +22512,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 2035) { + if (parameter.flags & 1022) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -22157,7 +22532,7 @@ var ts; } } function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 2035) { + if (node.flags & 1022) { grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } } @@ -22179,8 +22554,8 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; if (arg.kind === 187) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -22420,7 +22795,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 2035) { + else if (parameter.flags & 1022) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } else if (parameter.questionToken) { @@ -22554,8 +22929,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { - var element = elements[_i]; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; if (element.kind !== 187) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22674,8 +23049,8 @@ var ts; node.kind === 221 || node.kind === 228 || node.kind === 227 || - (node.flags & 2) || - (node.flags & (1 | 1024))) { + (node.flags & 4) || + (node.flags & (2 | 512))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -22713,7 +23088,7 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.flags & 65536 && languageVersion >= 1) { + if (node.flags & 32768 && languageVersion >= 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -22760,7 +23135,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 8192) || + if (referencedFile && ((referencedFile.flags & 4096) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); @@ -22938,15 +23313,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -23088,6 +23463,7 @@ var ts; function emitSourceFile(node) { currentSourceFile = node; enclosingDeclaration = node; + ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true); emitLines(node.statements); } function getExportDefaultTempVariableName() { @@ -23194,10 +23570,10 @@ var ts; } function emitModuleElementDeclarationFlags(node) { if (node.parent === currentSourceFile) { - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } else if (node.kind !== 215) { @@ -23206,22 +23582,22 @@ var ts; } } function emitClassMemberDeclarationFlags(node) { - if (node.flags & 32) { + if (node.flags & 16) { write("private "); } - else if (node.flags & 64) { + else if (node.flags & 32) { write("protected "); } - if (node.flags & 128) { + if (node.flags & 64) { write("static "); } - if (node.flags & 256) { + if (node.flags & 128) { write("abstract "); } } function writeImportEqualsDeclaration(node) { emitJsDocComments(node); - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } write("import "); @@ -23256,11 +23632,11 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 1)) { + if (!node.importClause && !(node.flags & 2)) { return; } emitJsDocComments(node); - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } write("import "); @@ -23322,7 +23698,7 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 131072) { + if (node.flags & 65536) { write("namespace "); } else { @@ -23394,7 +23770,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 && (node.parent.flags & 32); + return node.parent.kind === 143 && (node.parent.flags & 16); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23436,7 +23812,7 @@ var ts; break; case 143: case 142: - if (node.parent.flags & 128) { + if (node.parent.flags & 64) { diagnosticMessage = 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 === 214) { @@ -23499,7 +23875,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 112) { + if (param.flags & 56) { emitPropertyDeclaration(param); } }); @@ -23507,7 +23883,7 @@ var ts; } emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 256) { + if (node.flags & 128) { write("abstract "); } write("class "); @@ -23571,7 +23947,7 @@ var ts; if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 32)) { + else if (!(node.flags & 16)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } @@ -23585,7 +23961,7 @@ var ts; ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 141 || node.kind === 140) { - if (node.flags & 128) { + if (node.flags & 64) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23680,7 +24056,7 @@ var ts; emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); - if (!(node.flags & 32)) { + if (!(node.flags & 16)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { @@ -23707,7 +24083,7 @@ var ts; function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 146) { - if (accessorWithTypeAnnotation.parent.flags & 128) { + if (accessorWithTypeAnnotation.parent.flags & 64) { 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; @@ -23724,7 +24100,7 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 128) { + if (accessorWithTypeAnnotation.flags & 64) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -23805,7 +24181,7 @@ var ts; emitType(node.type); } } - else if (node.kind !== 144 && !(node.flags & 32)) { + else if (node.kind !== 144 && !(node.flags & 16)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23833,7 +24209,7 @@ var ts; break; case 143: case 142: - if (node.flags & 128) { + if (node.flags & 64) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -23890,7 +24266,7 @@ var ts; node.parent.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 32)) { + else if (!(node.parent.flags & 16)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { @@ -23919,7 +24295,7 @@ var ts; ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case 143: case 142: - if (node.parent.flags & 128) { + if (node.parent.flags & 64) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -24035,7 +24411,7 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 8192 + var declFileName = referencedFile.flags & 4096 ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") @@ -24368,16 +24744,8 @@ var ts; diagnostics: diagnostics, sourceMaps: sourceMapDataList }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && ts.hasProperty(node.locals, name)) { if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { return false; @@ -25670,7 +26038,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); + emitListWithSpread(elements, true, (node.flags & 1024) !== 0, elements.hasTrailingComma, true); } } function emitObjectLiteralBody(node, numElements) { @@ -25685,7 +26053,7 @@ var ts; emitLinePreservingList(node, properties, languageVersion >= 1, true); } else { - var multiLine = (node.flags & 2048) !== 0; + var multiLine = (node.flags & 1024) !== 0; if (!multiLine) { write(" "); } @@ -25704,7 +26072,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048) !== 0; + var multiLine = (node.flags & 1024) !== 0; var properties = node.properties; write("("); if (multiLine) { @@ -26222,7 +26590,7 @@ var ts; var current = node; while (current) { if (current.kind === 248) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + return !isExported || ((ts.getCombinedNodeFlags(node) & 2) !== 0); } else if (ts.isFunctionLike(current) || current.kind === 219) { return false; @@ -26440,7 +26808,7 @@ var ts; if (shouldHoistVariable(decl, true)) { return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 49152) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576) === 0) { for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); @@ -26522,7 +26890,7 @@ var ts; break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 49152)) { + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576)) { loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; @@ -26779,22 +27147,22 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - var rhsIsIdentifier = node.expression.kind === 69; var counter = createTempVariable(268435456); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); + var rhsReference = ts.createSynthesizedNode(69); + rhsReference.text = node.expression.kind === 69 ? + makeUniqueName(node.expression.text) : + makeTempVariableName(0); emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); write(" = 0"); emitEnd(node.expression); - if (!rhsIsIdentifier) { - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); @@ -27029,7 +27397,7 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1) { + if (ts.getCombinedNodeFlags(node) & 2) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); @@ -27051,7 +27419,7 @@ var ts; } function emitEs6ExportDefaultCompat(node) { if (node.parent.kind === 248) { - ts.Debug.assert(!!(node.flags & 1024) || node.kind === 227); + ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); if (modulekind === 1 || modulekind === 2 || modulekind === 3) { if (!currentSourceFile.symbol.exports["___esModule"]) { if (languageVersion === 1) { @@ -27067,12 +27435,12 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 1) { + if (node.flags & 2) { writeLine(); emitStart(node); if (modulekind === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); - if (node.flags & 1024) { + if (node.flags & 512) { write("default"); } else { @@ -27083,7 +27451,7 @@ var ts; write(")"); } else { - if (node.flags & 1024) { + if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { write("exports[\"default\"]"); @@ -27171,7 +27539,7 @@ var ts; var emitCount = 0; var canDefineTempVariablesInPlace = false; if (root.kind === 211) { - var isExported = ts.getCombinedNodeFlags(root) & 1; + var isExported = ts.getCombinedNodeFlags(root) & 2; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } @@ -27237,8 +27605,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value, true); } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; + for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { + var p = properties_5[_a]; if (p.kind === 245 || p.kind === 246) { var propName = p.name; var target_1 = p.kind === 246 ? p : p.initializer || propName; @@ -27357,7 +27725,7 @@ var ts; var initializer = node.initializer; if (!initializer && languageVersion < 2) { var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 16384); + (getCombinedFlagsForIdentifier(node.name) & 8192); if (isLetDefinedInLoop && node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { @@ -27396,13 +27764,13 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && + return !!(node.flags & 2) && modulekind === 5 && node.parent.kind === 248; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 1) { + if (node.flags & 2) { if (isES6ExportedDeclaration(node)) { write("export "); startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); @@ -27426,7 +27794,7 @@ var ts; } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 1)) { + if (!(node.flags & 2)) { return true; } if (isES6ExportedDeclaration(node)) { @@ -27583,7 +27951,7 @@ var ts; if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } } @@ -27722,7 +28090,7 @@ var ts; emitRestParameter(node); } function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 || node.flags & 512) { + if (languageVersion < 2 || node.flags & 256) { emitDownLevelExpressionFunctionBody(node, body); return; } @@ -27738,7 +28106,7 @@ var ts; scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); - emitDetachedComments(node.body); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); @@ -27774,7 +28142,7 @@ var ts; scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); - emitDetachedComments(body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); var startIndex = emitDirectivePrologues(body.statements, true); emitFunctionBodyPreamble(node); decreaseIndent(); @@ -27816,7 +28184,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 112) { + if (param.flags & 56) { writeLine(); emitStart(param); emitStart(param.name); @@ -27848,15 +28216,15 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 141 && isStatic === ((member.flags & 64) !== 0) && member.initializer) { properties.push(member); } } return properties; } function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var property = properties_6[_a]; emitPropertyDeclaration(node, property); } } @@ -27869,7 +28237,7 @@ var ts; emit(receiver); } else { - if (property.flags & 128) { + if (property.flags & 64) { emitDeclarationName(node); } else { @@ -27968,7 +28336,7 @@ var ts; writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 128) { + if (member.flags & 64) { write("static "); } if (member.kind === 145) { @@ -28013,7 +28381,7 @@ var ts; if (member.kind === 144 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 141 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 141 && member.initializer && (member.flags & 64) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -28050,7 +28418,7 @@ var ts; increaseIndent(); if (ctor) { startIndex = emitDirectivePrologues(ctor.body.statements, true); - emitDetachedComments(ctor.body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); var superCall; @@ -28121,7 +28489,7 @@ var ts; var thisNodeIsDecorated = ts.nodeIsDecorated(node); if (node.kind === 214) { if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { + if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } write("let "); @@ -28130,7 +28498,7 @@ var ts; } else if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } } @@ -28146,7 +28514,7 @@ var ts; write(" = "); } write("class"); - if ((node.name || (node.flags & 1024 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if ((node.name || (node.flags & 512 && staticProperties.length > 0)) && !thisNodeIsDecorated) { write(" "); emitDeclarationName(node); } @@ -28169,8 +28537,8 @@ var ts; write(";"); } if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; + for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { + var property = staticProperties_1[_a]; write(","); writeLine(); emitPropertyDeclaration(node, property, tempVariable, true); @@ -28186,7 +28554,7 @@ var ts; emitPropertyDeclarations(node, staticProperties); emitDecoratorsOfClass(node); } - if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { + if (!isES6ExportedDeclaration(node) && (node.flags & 2)) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -28195,7 +28563,7 @@ var ts; emitEnd(node); write(";"); } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { + else if (isES6ExportedDeclaration(node) && (node.flags & 512) && thisNodeIsDecorated) { writeLine(); write("export default "); emitDeclarationName(node); @@ -28275,13 +28643,13 @@ var ts; } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 128)) { + if (!(member.flags & 64)) { write(".prototype"); } } function emitDecoratorsOfClass(node) { emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 128); + emitDecoratorsOfMembers(node, 64); emitDecoratorsOfConstructor(node); } function emitDecoratorsOfConstructor(node) { @@ -28316,7 +28684,7 @@ var ts; function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.flags & 128) !== staticFlag) { + if ((member.flags & 64) !== staticFlag) { continue; } if (!ts.nodeCanBeDecorated(member)) { @@ -28643,7 +29011,7 @@ var ts; return; } if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + if (!(node.flags & 2) || isES6ExportedDeclaration(node)) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -28674,7 +29042,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 2 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -28685,7 +29053,7 @@ var ts; write(";"); } if (modulekind !== 5 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 1)) { + if (modulekind === 4 && (node.flags & 2)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -28787,7 +29155,7 @@ var ts; scopeEmitEnd(); } write(")("); - if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 2) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -28797,7 +29165,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 1)) { + if (modulekind === 4 && (node.flags & 2)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -28895,7 +29263,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 221 && (node.flags & 2) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (modulekind !== 2) { emitLeadingComments(node); @@ -28961,7 +29329,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 1)) { + else if (!(node.flags & 2)) { write("var "); } } @@ -29049,8 +29417,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(modulekind === 5); var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; + for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { + var specifier = specifiers_1[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -29184,8 +29552,8 @@ var ts; } writeLine(); var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; + for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { + var importNode = externalImports_1[_a]; var skipNode = importNode.kind === 228 || (importNode.kind === 222 && !importNode.importClause); if (skipNode) { @@ -29210,8 +29578,8 @@ var ts; } if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; + for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { + var externalImport = externalImports_2[_a]; if (externalImport.kind === 228 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; @@ -29239,8 +29607,8 @@ var ts; } } } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; + for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { + var externalImport = externalImports_3[_d]; if (externalImport.kind !== 228) { continue; } @@ -29284,7 +29652,7 @@ var ts; return exportStarFunction; } function writeExportedName(node) { - if (node.kind !== 69 && node.flags & 1024) { + if (node.kind !== 69 && node.flags & 512) { return; } if (started) { @@ -29337,7 +29705,7 @@ var ts; emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); - if (flags & 1) { + if (flags & 2) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -29347,11 +29715,11 @@ var ts; write(";"); } if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; + for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { + var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 1) { + if (f.flags & 2) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -29361,7 +29729,7 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 2) { + if (node.flags & 4) { return; } if (node.kind === 213) { @@ -29431,7 +29799,7 @@ var ts; if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { return false; } - return (ts.getCombinedNodeFlags(node) & 49152) === 0 || + return (ts.getCombinedNodeFlags(node) & 24576) === 0 || ts.getEnclosingBlockScopeContainer(node).kind === 248; } function isCurrentFileSystemExternalModule() { @@ -29466,8 +29834,8 @@ var ts; var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; + for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { + var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { case 222: @@ -29601,8 +29969,8 @@ var ts; unaliasedModuleNames.push("\"" + amdDependency.path + "\""); } } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; + for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { + var importNode = externalImports_4[_c]; var externalModuleName = getExternalModuleNameText(importNode); var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -29855,7 +30223,7 @@ var ts; function emitSourceFileNode(node) { writeLine(); emitShebang(); - emitDetachedComments(node); + emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; emitModule(node); @@ -29878,7 +30246,7 @@ var ts; } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 2) { + if (node.flags & 4) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -30111,10 +30479,6 @@ var ts; } return leadingComments; } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } function isTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && @@ -30195,44 +30559,14 @@ var ts; ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + function emitDetachedCommentsAndUpdateCommentsInfo(node) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); } - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -30535,7 +30869,7 @@ var ts; var resolveModuleNamesWorker = host.resolveModuleNames ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); - var filesByName = ts.createFileMap(getCanonicalFileName); + var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; if (oldProgram) { var oldOptions = oldProgram.getCompilerOptions(); @@ -30583,8 +30917,8 @@ var ts; if (!classifiableNames) { getTypeChecker(); classifiableNames = {}; - for (var _i = 0; _i < files.length; _i++) { - var sourceFile = files[_i]; + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var sourceFile = files_3[_i]; ts.copyMap(sourceFile.classifiableNames, classifiableNames); } } @@ -30600,7 +30934,7 @@ var ts; return false; } var newSourceFiles = []; - var normalizedAbsoluteFileNames = []; + var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; @@ -30608,8 +30942,8 @@ var ts; if (!newSourceFile) { return false; } - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - normalizedAbsoluteFileNames.push(normalizedAbsolutePath); + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); if (oldSourceFile !== newSourceFile) { if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { return false; @@ -30623,7 +30957,7 @@ var ts; } if (resolveModuleNamesWorker) { var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, normalizedAbsolutePath); + var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); for (var i = 0; i < moduleNames.length; ++i) { var newResolution = resolutions[i]; var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); @@ -30646,12 +30980,12 @@ var ts; newSourceFiles.push(newSourceFile); } for (var i = 0, len = newSourceFiles.length; i < len; ++i) { - filesByName.set(normalizedAbsoluteFileNames[i], newSourceFiles[i]); + filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _b = 0; _b < modifiedSourceFiles.length; _b++) { - var modifiedFile = modifiedSourceFiles[_b]; + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } oldProgram.structureIsReused = true; @@ -30690,7 +31024,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.getNormalizedAbsolutePath(fileName, currentDirectory)); + return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -30799,7 +31133,7 @@ var ts; } break; case 218: - if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { collect(node, false); }); @@ -30816,7 +31150,7 @@ var ts; diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -30826,13 +31160,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.getNormalizedAbsolutePath(fileName + extension, currentDirectory), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -30874,6 +31208,7 @@ var ts; }); filesByName.set(normalizedAbsolutePath, file); if (file) { + file.path = normalizedAbsolutePath; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); if (existingFile) { @@ -30918,11 +31253,7 @@ var ts; var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - var absoluteImportPath = ts.isRootedDiskPath(resolution.resolvedFileName) - ? resolution.resolvedFileName - : ts.getNormalizedAbsolutePath(resolution.resolvedFileName, currentDirectory); - var relativePath = ts.getRelativePathToDirectoryOrUrl(currentDirectory, absoluteImportPath, currentDirectory, getCanonicalFileName, false); - var importedFile = findSourceFile(relativePath, absoluteImportPath, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); @@ -30973,8 +31304,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -31231,6 +31562,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "pretty", + paramType: ts.Diagnostics.KIND, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, { name: "project", shortName: "p", @@ -31329,11 +31666,31 @@ var ts; description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic }, + { + name: "allowUnusedLabels", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, { name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, + } ]; var optionNameMapCache; function getOptionNameMap() { @@ -31459,13 +31816,31 @@ var ts; ts.readConfigFile = readConfigFile; function parseConfigFileTextToJson(fileName, jsonText) { try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + var jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1, false, 0, jsonText); + var token; + while ((token = scanner.scan()) !== 1) { + switch (token) { + case 2: + case 3: + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } function parseJsonConfigFileContent(json, host, basePath) { var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; return { @@ -31554,6 +31929,13 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var reportDiagnostic = reportDiagnosticSimply; + function reportDiagnostics(diagnostics, host) { + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var diagnostic = diagnostics_1[_i]; + reportDiagnostic(diagnostic, host); + } + } function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -31612,20 +31994,84 @@ var ts; var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments); return diagnostic.messageText; } - function reportDiagnostic(diagnostic) { + function reportDiagnosticSimply(diagnostic, host) { var output = ""; if (diagnostic.file) { - var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; + var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; + var relativeFileName = host + ? ts.convertToRelativePath(diagnostic.file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) + : diagnostic.file.fileName; + output += diagnostic.file.fileName + "(" + (line + 1) + "," + (character + 1) + "): "; } var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; ts.sys.write(output); } - function reportDiagnostics(diagnostics) { - for (var i = 0; i < diagnostics.length; i++) { - reportDiagnostic(diagnostics[i]); + var redForegroundEscapeSequence = "\u001b[91m"; + var yellowForegroundEscapeSequence = "\u001b[93m"; + var blueForegroundEscapeSequence = "\u001b[93m"; + var gutterStyleSequence = "\u001b[100;30m"; + var gutterSeparator = " "; + var resetEscapeSequence = "\u001b[0m"; + var elipsis = "..."; + var categoryFormatMap = (_a = {}, + _a[ts.DiagnosticCategory.Warning] = yellowForegroundEscapeSequence, + _a[ts.DiagnosticCategory.Error] = redForegroundEscapeSequence, + _a[ts.DiagnosticCategory.Message] = blueForegroundEscapeSequence, + _a + ); + function formatAndReset(text, formatStyle) { + return formatStyle + text + resetEscapeSequence; + } + function reportDiagnosticWithColorAndContext(diagnostic, host) { + var output = ""; + if (diagnostic.file) { + var start = diagnostic.start, length_3 = diagnostic.length, file = diagnostic.file; + var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; + var _b = ts.getLineAndCharacterOfPosition(file, start + length_3), lastLine = _b.line, lastLineChar = _b.character; + var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line; + var hasMoreThanFiveLines = (lastLine - firstLine) >= 4; + var gutterWidth = (lastLine + 1 + "").length; + if (hasMoreThanFiveLines) { + gutterWidth = Math.max(elipsis.length, gutterWidth); + } + output += ts.sys.newLine; + for (var i = firstLine; i <= lastLine; i++) { + if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) { + output += formatAndReset(padLeft(elipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + ts.sys.newLine; + i = lastLine - 1; + } + var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0); + var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length; + var lineContent = file.text.slice(lineStart, lineEnd); + lineContent = lineContent.replace(/\s+$/g, ""); + lineContent = lineContent.replace("\t", " "); + output += formatAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator; + output += lineContent + ts.sys.newLine; + output += formatAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator; + output += redForegroundEscapeSequence; + if (i === firstLine) { + var lastCharForLine = i === lastLine ? lastLineChar : undefined; + output += lineContent.slice(0, firstLineChar).replace(/\S/g, " "); + output += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~"); + } + else if (i === lastLine) { + output += lineContent.slice(0, lastLineChar).replace(/./g, "~"); + } + else { + output += lineContent.replace(/./g, "~"); + } + output += resetEscapeSequence; + output += ts.sys.newLine; + } + output += ts.sys.newLine; + output += file.fileName + "(" + (firstLine + 1) + "," + (firstLineChar + 1) + "): "; } + var categoryColor = categoryFormatMap[diagnostic.category]; + var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); + output += formatAndReset(category, categoryColor) + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine); + output += ts.sys.newLine + ts.sys.newLine; + ts.sys.write(output); } function reportWatchDiagnostic(diagnostic) { var output = new Date().toLocaleTimeString() + " - "; @@ -31677,13 +32123,13 @@ var ts; var hostFileExists; if (commandLine.options.locale) { if (!isJSONSupported()) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } if (commandLine.errors.length > 0) { - reportDiagnostics(commandLine.errors); + reportDiagnostics(commandLine.errors, compilerHost); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (commandLine.options.init) { @@ -31691,7 +32137,7 @@ var ts; return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.version) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version)); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version), undefined); return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.help) { @@ -31701,12 +32147,12 @@ var ts; } if (commandLine.options.project) { if (!isJSONSupported()) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } configFileName = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); if (commandLine.fileNames.length !== 0) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } } @@ -31721,7 +32167,7 @@ var ts; } if (commandLine.options.watch && commandLine.options.hasOwnProperty("watch")) { if (!ts.sys.watchFile) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { @@ -31749,7 +32195,7 @@ var ts; var configObject = result.config; var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { - reportDiagnostics(configParseResult.errors); + reportDiagnostics(configParseResult.errors, undefined); ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); return; } @@ -31772,6 +32218,9 @@ var ts; hostFileExists = compilerHost.fileExists; compilerHost.fileExists = cachedFileExists; } + if (compilerOptions.pretty) { + reportDiagnostic = reportDiagnosticWithColorAndContext; + } cachedExistingFiles = {}; var compileResult = compile(rootFileNames, compilerOptions, compilerHost); if (!compilerOptions.watch) { @@ -31906,14 +32355,14 @@ var ts; diagnostics = program.getSemanticDiagnostics(); } } - reportDiagnostics(diagnostics); + reportDiagnostics(diagnostics, compilerHost); if (compilerOptions.noEmit) { return diagnostics.length ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success; } var emitOutput = program.emit(); - reportDiagnostics(emitOutput.diagnostics); + reportDiagnostics(emitOutput.diagnostics, compilerHost); if (emitOutput.emitSkipped) { return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } @@ -31988,7 +32437,7 @@ var ts; var currentDirectory = ts.sys.getCurrentDirectory(); var file = ts.normalizePath(ts.combinePaths(currentDirectory, "tsconfig.json")); if (ts.sys.fileExists(file)) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), undefined); } else { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); @@ -32000,7 +32449,7 @@ var ts; configurations.files = fileNames; } ts.sys.writeFile(file, JSON.stringify(configurations, undefined, 4)); - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file)); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file), undefined); } return; function serializeCompilerOptions(options) { @@ -32039,5 +32488,6 @@ var ts; return result; } } + var _a; })(ts || (ts = {})); ts.executeCommandLine(ts.sys.args); diff --git a/lib/tsserver.js b/lib/tsserver.js index ed62dd90686..2893dab82ef 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -49,40 +49,49 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function createFileMap(getCanonicalFileName) { + function createFileMap(keyMapper) { var files = {}; return { get: get, set: set, contains: contains, remove: remove, - clear: clear, - forEachValue: forEachValueInMap + forEachValue: forEachValueInMap, + clear: clear }; - function set(fileName, value) { - files[normalizeKey(fileName)] = value; - } - function get(fileName) { - return files[normalizeKey(fileName)]; - } - function contains(fileName) { - return hasProperty(files, normalizeKey(fileName)); - } - function remove(fileName) { - var key = normalizeKey(fileName); - delete files[key]; - } function forEachValueInMap(f) { - forEachValue(files, f); + for (var key in files) { + f(key, files[key]); + } } - function normalizeKey(key) { - return getCanonicalFileName(normalizeSlashes(key)); + function get(path) { + return files[toKey(path)]; + } + function set(path, value) { + files[toKey(path)] = value; + } + function contains(path) { + return hasProperty(files, toKey(path)); + } + function remove(path) { + var key = toKey(path); + delete files[key]; } function clear() { files = {}; } + function toKey(path) { + return keyMapper ? keyMapper(path) : path; + } } ts.createFileMap = createFileMap; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) + ? normalizePath(fileName) + : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts.toPath = toPath; function forEach(array, callback) { if (array) { for (var i = 0, len = array.length; i < len; i++) { @@ -97,8 +106,8 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; if (v === value) { return true; } @@ -121,8 +130,8 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; if (predicate(v)) { count++; } @@ -135,8 +144,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; if (f(item)) { result.push(item); } @@ -149,8 +158,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; result.push(f(v)); } } @@ -169,8 +178,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; if (!contains(result, item)) { result.push(item); } @@ -181,8 +190,8 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; result += v[prop]; } return result; @@ -190,8 +199,8 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0; _i < from.length; _i++) { - var v = from[_i]; + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; to.push(v); } } @@ -512,8 +521,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { - var part = parts[_i]; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); @@ -661,8 +670,8 @@ var ts; if (!fileName) { return false; } - for (var _i = 0; _i < ts.supportedExtensions.length; _i++) { - var extension = ts.supportedExtensions[_i]; + for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -672,8 +681,8 @@ var ts; ts.isSupportedSourceFileName = isSupportedSourceFileName; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { - for (var _i = 0; _i < extensionsToRemove.length; _i++) { - var ext = extensionsToRemove[_i]; + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -747,8 +756,8 @@ var ts; })(Debug = ts.Debug || (ts.Debug = {})); function copyListRemovingItem(item, list) { var copiedList = []; - for (var _i = 0; _i < list.length; _i++) { - var e = list[_i]; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var e = list_1[_i]; if (e !== item) { copiedList.push(e); } @@ -834,16 +843,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; var name_1 = ts.combinePaths(path, current); if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) { result.push(name_1); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _a = 0, subfolders_1 = subfolders; _a < subfolders_1.length; _a++) { + var current = subfolders_1[_a]; var name_2 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_2))) { visitDirectory(name_2); @@ -894,6 +903,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _tty = require("tty"); function createWatchedFileSet(interval, chunkSize) { if (interval === void 0) { interval = 2500; } if (chunkSize === void 0) { chunkSize = 30; } @@ -1006,8 +1016,8 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1021,8 +1031,8 @@ var ts; } } } - for (var _a = 0; _a < directories.length; _a++) { - var current = directories[_a]; + for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { + var current = directories_1[_a]; visitDirectory(current); } } @@ -1032,14 +1042,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, "utf8"); - var offset = 0; - var toWrite = buffer.length; - var written = 0; - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } + process.stdout.write(s); }, readFile: readFile, writeFile: writeFile, @@ -1306,6 +1309,7 @@ var ts; await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, + The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -1358,7 +1362,7 @@ var ts; Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_th_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "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: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, @@ -1379,7 +1383,7 @@ var ts; Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement_2378", message: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, @@ -1669,8 +1673,6 @@ var ts; NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, @@ -1678,7 +1680,14 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Disallow_inconsistently_cased_references_to_the_same_file: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6073", message: "Disallow inconsistently-cased references to the same file." }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, + Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, + Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, + Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, + Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -1696,6 +1705,10 @@ var ts; 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: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "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." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, + Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, + Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, + Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -3225,6 +3238,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "pretty", + paramType: ts.Diagnostics.KIND, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, { name: "project", shortName: "p", @@ -3323,11 +3342,31 @@ var ts; description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic }, + { + name: "allowUnusedLabels", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, { name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, + } ]; var optionNameMapCache; function getOptionNameMap() { @@ -3453,13 +3492,31 @@ var ts; ts.readConfigFile = readConfigFile; function parseConfigFileTextToJson(fileName, jsonText) { try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + var jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1, false, 0, jsonText); + var token; + while ((token = scanner.scan()) !== 1) { + switch (token) { + case 2: + case 3: + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } function parseJsonConfigFileContent(json, host, basePath) { var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors; return { @@ -3551,8 +3608,8 @@ var ts; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; if (declaration.kind === kind) { return declaration; } @@ -3722,7 +3779,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 49152) !== 0 || + return (getCombinedNodeFlags(declaration) & 24576) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; @@ -3823,7 +3880,7 @@ var ts; } ts.isExternalModule = isExternalModule; function isDeclarationFile(file) { - return (file.flags & 8192) !== 0; + return (file.flags & 4096) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { @@ -3853,11 +3910,11 @@ var ts; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 32768); + return !!(getCombinedNodeFlags(node) & 16384); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 16384); + return !!(getCombinedNodeFlags(node) & 8192); } ts.isLet = isLet; function isPrologueDirective(node) { @@ -4036,27 +4093,28 @@ var ts; } ts.isClassLike = isClassLike; function isFunctionLike(node) { - if (node) { - switch (node.kind) { - case 144: - case 173: - case 213: - case 174: - case 143: - case 142: - case 145: - case 146: - case 147: - case 148: - case 149: - case 152: - case 153: - return true; - } - } - return false; + return node && isFunctionLikeKind(node.kind); } ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 144: + case 173: + case 213: + case 174: + case 143: + case 142: + case 145: + case 146: + case 147: + case 148: + case 149: + case 152: + case 153: + return true; + } + } + ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { case 143: @@ -4520,9 +4578,18 @@ var ts; return !!node && (node.kind === 162 || node.kind === 161); } ts.isBindingPattern = isBindingPattern; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 | 8192)) { + if (node.flags & (4 | 4096)) { return true; } node = node.parent; @@ -4580,7 +4647,7 @@ var ts; case 207: case 204: case 206: - case 98: + case 208: case 209: case 193: case 198: @@ -4679,8 +4746,8 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { - var clause = clauses[_i]; + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; if (clause.token === kind) { return clause; } @@ -4692,7 +4759,6 @@ var ts; function tryResolveScriptReference(host, sourceFile, reference) { if (!host.getCompilerOptions().noResolve) { var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); - referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } } @@ -4750,7 +4816,7 @@ var ts; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { - return isFunctionLike(node) && (node.flags & 512) !== 0 && !isAccessor(node); + return isFunctionLike(node) && (node.flags & 256) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { @@ -5108,7 +5174,7 @@ var ts; else { ts.forEach(declarations, function (member) { if ((member.kind === 145 || member.kind === 146) - && (member.flags & 128) === (accessor.flags & 128)) { + && (member.flags & 64) === (accessor.flags & 64)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -5163,6 +5229,49 @@ var ts; }); } ts.emitComments = emitComments; + function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + } + ts.emitDetachedComments = emitDetachedComments; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); @@ -5227,16 +5336,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 113: return 128; - case 112: return 16; - case 111: return 64; - case 110: return 32; - case 115: return 256; - case 82: return 1; - case 122: return 2; - case 74: return 32768; - case 77: return 1024; - case 118: return 512; + case 113: return 64; + case 112: return 8; + case 111: return 32; + case 110: return 16; + case 115: return 128; + case 82: return 2; + case 122: return 4; + case 74: return 16384; + case 77: return 512; + case 118: return 256; } return 0; } @@ -5315,7 +5424,7 @@ var ts; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isJavaScript(fileName) { @@ -5379,6 +5488,12 @@ var ts; return result; } ts.convertToBase64 = convertToBase64; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !ts.isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false); + } + ts.convertToRelativePath = convertToRelativePath; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function getNewLineCharacter(options) { @@ -5551,8 +5666,8 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; var result = cbNode(node); if (result) { return result; @@ -6013,8 +6128,8 @@ var ts; function addJSDocComment(node) { var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); if (comments) { - for (var _i = 0; _i < comments.length; _i++) { - var comment = comments[_i]; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); if (jsDocComment) { node.jsDocComment = jsDocComment; @@ -6045,7 +6160,7 @@ var ts; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 8192 : 0; + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 : 0; sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 : 0; return sourceFile; } @@ -6881,7 +6996,7 @@ var ts; if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 65536; + node.flags |= 32768; } return node; } @@ -7450,7 +7565,7 @@ var ts; if (!arrowFunction) { return undefined; } - var isAsync = !!(arrowFunction.flags & 512); + var isAsync = !!(arrowFunction.flags & 256); var lastToken = token; arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); arrowFunction.body = (lastToken === 34 || lastToken === 15) @@ -7542,7 +7657,7 @@ var ts; function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNode(174); setModifiers(node, parseModifiersForArrowFunction()); - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -8156,7 +8271,7 @@ var ts; var node = createNode(164); parseExpected(19); if (scanner.hasPrecedingLineBreak()) - node.flags |= 2048; + node.flags |= 1024; node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); parseExpected(20); return finishNode(node); @@ -8211,7 +8326,7 @@ var ts; var node = createNode(165); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 2048; + node.flags |= 1024; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); parseExpected(16); @@ -8227,7 +8342,7 @@ var ts; parseExpected(87); node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : @@ -8765,10 +8880,10 @@ var ts; case 102: break; case 108: - node.flags |= 16384; + node.flags |= 8192; break; case 74: - node.flags |= 32768; + node.flags |= 16384; break; default: ts.Debug.fail(); @@ -8802,9 +8917,9 @@ var ts; setModifiers(node, modifiers); parseExpected(87); node.asteriskToken = parseOptionalToken(37); - node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); + node.name = node.flags & 512 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512); + var isAsync = !!(node.flags & 256); fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); @@ -8826,7 +8941,7 @@ var ts; method.name = name; method.questionToken = questionToken; var isGenerator = !!asteriskToken; - var isAsync = !!(method.flags & 512); + var isAsync = !!(method.flags & 256); fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); @@ -8838,7 +8953,7 @@ var ts; property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); - property.initializer = modifiers && modifiers.flags & 128 + property.initializer = modifiers && modifiers.flags & 64 ? allowInAnd(parseNonParameterInitializer) : doOutsideOfContext(2 | 1, parseNonParameterInitializer); parseSemicolon(); @@ -9128,13 +9243,13 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(218, fullStart); - var namespaceFlag = flags & 131072; + var namespaceFlag = flags & 65536; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 2 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -9149,7 +9264,7 @@ var ts; function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; if (parseOptional(126)) { - flags |= 131072; + flags |= 65536; } else { parseExpected(125); @@ -9363,7 +9478,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 + return node.flags & 2 || node.kind === 221 && node.moduleReference.kind === 232 || node.kind === 222 || node.kind === 227 @@ -9937,8 +10052,8 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var node = array_7[_i]; visitNode(node); } } @@ -10010,8 +10125,8 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; visitNode(node); } return; @@ -10164,6 +10279,13 @@ var ts; var ts; (function (ts) { ts.bindTime = 0; + function or(state1, state2) { + return (state1 | state2) & 2 + ? 2 + : (state1 & state2) & 8 + ? 8 + : 4; + } function getModuleInstanceState(node) { if (node.kind === 215 || node.kind === 216) { return 0; @@ -10171,7 +10293,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 1)) { + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 2)) { return 0; } else if (node.kind === 219) { @@ -10198,28 +10320,52 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function bindSourceFile(file) { + var binder = createBinder(); + function bindSourceFile(file, options) { var start = new Date().getTime(); - bindSourceFileWorker(file); + binder(file, options); ts.bindTime += new Date().getTime() - start; } ts.bindSourceFile = bindSourceFile; - function bindSourceFileWorker(file) { + function createBinder() { + var file; + var options; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; - var inStrictMode = !!file.externalModuleIndicator; + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; + var inStrictMode; var symbolCount = 0; - var Symbol = ts.objectAllocator.getSymbolConstructor(); - var classifiableNames = {}; - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } - return; + return bindSourceFile; function createSymbol(flags, name) { symbolCount++; return new Symbol(flags, name); @@ -10270,7 +10416,7 @@ var ts; return node.isExportEquals ? "export=" : "default"; case 213: case 214: - return node.flags & 1024 ? "default" : undefined; + return node.flags & 512 ? "default" : undefined; } } function getDisplayName(node) { @@ -10278,7 +10424,7 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 1024; + var isDefaultExport = node.flags & 512; var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { @@ -10296,7 +10442,7 @@ var ts; ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 1024) { + if (declaration.flags & 512) { message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); @@ -10315,7 +10461,7 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2; if (symbolFlags & 8388608) { if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); @@ -10325,7 +10471,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 262144) { + if (hasExportModifier || container.flags & 131072) { var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | (symbolFlags & 793056 ? 2097152 : 0) | (symbolFlags & 1536 ? 4194304 : 0); @@ -10356,18 +10502,202 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - if (node.kind === 215) { + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + flags &= ~1572864; + if (kind === 215) { seenThisKeyword = false; - ts.forEachChild(node, bind); - node.flags = seenThisKeyword ? node.flags | 524288 : node.flags & ~524288; } - else { - ts.forEachChild(node, bind); + var saveState = kind === 248 || kind === 219 || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288; + if (hasExplicitReturn) { + flags |= 1048576; + } + } + if (kind === 215) { + flags = seenThisKeyword ? flags | 262144 : flags & ~262144; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198: + bindWhileStatement(node); + break; + case 197: + bindDoStatement(node); + break; + case 199: + bindForStatement(node); + break; + case 200: + case 201: + bindForInOrForOfStatement(node); + break; + case 196: + bindIfStatement(node); + break; + case 204: + case 208: + bindReturnOrThrow(node); + break; + case 203: + case 202: + bindBreakOrContinueStatement(node); + break; + case 209: + bindTryStatement(node); + break; + case 206: + bindSwitchStatement(node); + break; + case 220: + bindCaseBlock(node); + break; + case 207: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var postWhileState = n.expression.kind === 99 ? 4 : currentReachabilityState; + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 ? 4 : preDoState; + popImplicitLabel(postDoLabel, postDoState); + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + var isInfiniteLoop = (!n.condition || n.condition.kind === 99); + var postForState = isInfiniteLoop ? 4 : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + var ifTrueState = n.expression.kind === 84 ? 4 : currentReachabilityState; + var ifFalseState = n.expression.kind === 99 ? 4 : currentReachabilityState; + currentReachabilityState = ifTrueState; + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + bind(n.expression); + if (n.kind === 204) { + hasExplicitReturn = true; + } + currentReachabilityState = 4; + } + function bindBreakOrContinueStatement(n) { + bind(n.label); + var isValidJump = jumpToLabel(n.label, n.kind === 203 ? currentReachabilityState : 4); + if (isValidJump) { + currentReachabilityState = 4; + } + } + function bindTryStatement(n) { + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242; }); + var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } function getContainerFlags(node) { switch (node.kind) { case 186: @@ -10447,7 +10777,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 128 + return node.flags & 64 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -10456,15 +10786,6 @@ var ts; ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } - function isAmbientContext(node) { - while (node) { - if (node.flags & 2) { - return true; - } - node = node.parent; - } - return false; - } function hasExportDeclarations(node) { var body = node.kind === 248 ? node : node.body; if (body.kind === 248 || body.kind === 219) { @@ -10478,11 +10799,11 @@ var ts; return false; } function setExportContextFlag(node) { - if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 262144; + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072; } else { - node.flags &= ~262144; + node.flags &= ~131072; } } function bindModuleDeclaration(node) { @@ -10633,7 +10954,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 65536) { + if (inStrictMode && node.flags & 32768) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -10651,10 +10972,10 @@ var ts; } function checkStrictModeWithStatement(node) { if (inStrictMode) { - grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } - function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + function errorOnFirstToken(node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } @@ -10662,6 +10983,9 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { + if (!node) { + return; + } node.parent = parent; var savedInStrictMode = inStrictMode; if (!savedInStrictMode) { @@ -10689,8 +11013,8 @@ var ts; } } function updateStrictModeStatementList(statements) { - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -10877,7 +11201,7 @@ var ts; else { declareSymbolAndAddToSymbolTable(node, 1, 107455); } - if (node.flags & 112 && + if (node.flags & 56 && node.parent.kind === 144 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; @@ -10889,6 +11213,95 @@ var ts; ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4: + var reportError = ts.isStatement(node) || + node.kind === 214 || + (node.kind === 218 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 217 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8; + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 || + ts.getCombinedNodeFlags(node.declarationList) & 24576 || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } } })(ts || (ts = {})); var ts; @@ -11014,6 +11427,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var jsxElementClassType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -11262,7 +11676,7 @@ var ts; } var initializerOfNonStaticProperty = current.parent && current.parent.kind === 141 && - (current.parent.flags & 128) === 0 && + (current.parent.flags & 64) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -11321,7 +11735,7 @@ var ts; break; case 141: case 140: - if (ts.isClassLike(location.parent) && !(location.flags & 128)) { + if (ts.isClassLike(location.parent) && !(location.flags & 64)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -11334,7 +11748,7 @@ var ts; case 186: case 215: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { - if (lastLocation && lastLocation.flags & 128) { + if (lastLocation && lastLocation.flags & 64) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } @@ -11768,8 +12182,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { - var member = members[_i]; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; if (member.kind === 144 && ts.nodeIsPresent(member.body)) { return member; } @@ -11975,7 +12389,7 @@ var ts; if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 1) && + !(anyImportSyntax.flags & 2) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -12105,8 +12519,8 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { - var accessibleSymbol = accessibleSymbolChain[_i]; + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } @@ -12272,7 +12686,7 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 128; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { @@ -12378,8 +12792,8 @@ var ts; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var signature = signatures[_f]; + for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { + var signature = signatures_1[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 53); @@ -12582,7 +12996,7 @@ var ts; case 217: case 221: var parent_4 = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && + if (!(ts.getCombinedNodeFlags(node) & 2) && !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } @@ -12593,7 +13007,7 @@ var ts; case 146: case 143: case 142: - if (node.flags & (32 | 64)) { + if (node.flags & (16 | 32)) { return false; } case 144: @@ -13022,8 +13436,8 @@ var ts; } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -13204,13 +13618,13 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.kind === 215) { - if (declaration.flags & 524288) { + if (declaration.flags & 262144) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); if (baseTypeNodes) { - for (var _b = 0; _b < baseTypeNodes.length; _b++) { - var node = baseTypeNodes[_b]; + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; if (ts.isSupportedExpressionWithTypeArguments(node)) { var baseSymbol = resolveEntityName(node.expression, 793056, true); if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { @@ -13378,23 +13792,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { - var s = baseSymbols[_i]; + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -13402,8 +13816,8 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { - var signature = baseSignatures[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var signature = baseSignatures_1[_i]; signatures.push(signature); } } @@ -13446,8 +13860,8 @@ var ts; members = createSymbolTable(source.declaredProperties); } var thisArgument = ts.lastOrUndefined(typeArguments); - for (var _i = 0; _i < baseTypes.length; _i++) { - var baseType = baseTypes[_i]; + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); @@ -13493,8 +13907,8 @@ var ts; var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0; _i < baseSignatures.length; _i++) { - var baseSig = baseSignatures[_i]; + for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { + var baseSig = baseSignatures_2[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -13522,8 +13936,8 @@ var ts; setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { - for (var _i = 0; _i < signatureList.length; _i++) { - var s = signatureList[_i]; + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } @@ -13577,8 +13991,8 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type = types_1[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; @@ -13742,12 +14156,12 @@ var ts; function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (32 | 64))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 | 32))) { if (!props) { props = [prop]; } @@ -13768,8 +14182,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var prop = props[_a]; + for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { + var prop = props_1[_a]; if (prop.declarations) { ts.addRange(declarations, prop.declarations); } @@ -14102,8 +14516,8 @@ var ts; } function getPropagatingFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type = types_3[_i]; result |= type.flags; } return result & 14680064; @@ -14224,8 +14638,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; switch (declaration.kind) { case 214: case 215: @@ -14323,8 +14737,8 @@ var ts; } } function addTypesToSet(typeSet, types, typeSetKind) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; addTypeToSet(typeSet, type, typeSetKind); } } @@ -14346,8 +14760,8 @@ var ts; } } function containsTypeAny(types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (isTypeAny(type)) { return true; } @@ -14450,7 +14864,8 @@ var ts; var container = ts.getThisContainer(node, false); var parent = container && container.parent; if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { - if (!(container.flags & 128)) { + if (!(container.flags & 64) && + (container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -14515,8 +14930,8 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { - var v = items[_i]; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var v = items_1[_i]; result.push(instantiator(v, mapper)); } return result; @@ -14555,8 +14970,8 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { - var source = sources[_i]; + for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { + var source = sources_1[_i]; if (t === source) { return anyType; } @@ -14921,8 +15336,8 @@ var ts; function eachTypeRelatedToSomeType(source, target) { var result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; var related = typeRelatedToSomeType(sourceType, target, false); if (!related) { return 0; @@ -14944,8 +15359,8 @@ var ts; function typeRelatedToEachType(source, target, reportErrors) { var result = -1; var targetTypes = target.types; - for (var _i = 0; _i < targetTypes.length; _i++) { - var targetType = targetTypes[_i]; + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var targetType = targetTypes_1[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0; @@ -14967,8 +15382,8 @@ var ts; function eachTypeRelatedToType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { + var sourceType = sourceTypes_2[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; @@ -15081,8 +15496,8 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 524288); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var targetProp = properties_1[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -15096,20 +15511,20 @@ var ts; else if (!(targetProp.flags & 134217728)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 32 || targetPropFlags & 32) { + if (sourcePropFlags & 16 || targetPropFlags & 16) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 32 && targetPropFlags & 32) { + if (sourcePropFlags & 16 && targetPropFlags & 16) { 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(sourcePropFlags & 32 ? source : target), typeToString(sourcePropFlags & 32 ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 ? source : target), typeToString(sourcePropFlags & 16 ? target : source)); } } return 0; } } - else if (targetPropFlags & 64) { + else if (targetPropFlags & 32) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); @@ -15120,7 +15535,7 @@ var ts; return 0; } } - else if (sourcePropFlags & 64) { + else if (sourcePropFlags & 32) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -15155,8 +15570,8 @@ var ts; return 0; } var result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -15188,13 +15603,13 @@ var ts; return result; } } - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { - var t = targetSignatures[_i]; + outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; if (!t.hasStringLiterals || target.flags & 262144) { var localErrors = reportErrors; var checkedAbstractAssignability = false; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; if (!s.hasStringLiterals || source.flags & 262144) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -15222,8 +15637,8 @@ var ts; var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { if (reportErrors) { reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); @@ -15424,8 +15839,8 @@ var ts; if (sourceProp === targetProp) { return -1; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 | 64); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 | 64); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 | 32); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 | 32); if (sourcePropAccessibility !== targetPropAccessibility) { return 0; } @@ -15491,8 +15906,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } @@ -15705,8 +16120,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { - var unused = typeParameters[_i]; + for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { + var unused = typeParameters_1[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); @@ -15772,8 +16187,8 @@ var ts; var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _i = 0; _i < targetTypes.length; _i++) { - var t = targetTypes[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var t = targetTypes_2[_i]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -15790,8 +16205,8 @@ var ts; } else if (source.flags & 49152) { var sourceTypes = source.types; - for (var _a = 0; _a < sourceTypes.length; _a++) { - var sourceType = sourceTypes[_a]; + for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { + var sourceType = sourceTypes_3[_a]; inferFromTypes(sourceType, target); } } @@ -15824,8 +16239,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var targetProp = properties_2[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -16316,7 +16731,7 @@ var ts; break; case 141: case 140: - if (container.flags & 128) { + if (container.flags & 64) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -16329,7 +16744,7 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return container.flags & 64 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } @@ -16357,7 +16772,7 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (canUseSuperExpression) { - if ((container.flags & 128) || isCallExpression) { + if ((container.flags & 64) || isCallExpression) { nodeCheckFlag = 512; } else { @@ -16402,7 +16817,7 @@ var ts; } else { if (container && ts.isClassLike(container.parent)) { - if (container.flags & 128) { + if (container.flags & 64) { return container.kind === 143 || container.kind === 142 || container.kind === 145 || @@ -16541,8 +16956,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var current = types_7[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -16706,8 +17121,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { @@ -16758,8 +17173,8 @@ var ts; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); - for (var _i = 0; _i < elements.length; _i++) { - var e = elements[_i]; + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var e = elements_1[_i]; if (inDestructuringPattern && e.kind === 185) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || @@ -17018,8 +17433,8 @@ var ts; function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { var type = checkExpression(node.expression); var props = getPropertiesOfType(type); - for (var _i = 0; _i < props.length; _i++) { - var prop = props[_i]; + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; if (!nameTable[prop.name]) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { @@ -17188,7 +17603,6 @@ var ts; var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } - var jsxElementClassType = undefined; function getJsxGlobalElementClassType() { if (!jsxElementClassType) { jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); @@ -17255,7 +17669,7 @@ var ts; return s.valueDeclaration ? s.valueDeclaration.kind : 141; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 8 | 64 : 0; } function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); @@ -17268,17 +17682,17 @@ var ts; error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } - if (flags & 256) { + if (flags & 128) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); return false; } } - if (!(flags & (32 | 64))) { + if (!(flags & (16 | 32))) { return true; } var enclosingClassDeclaration = ts.getContainingClass(node); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - if (flags & 32) { + if (flags & 16) { if (declaringClass !== enclosingClass) { error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; @@ -17292,7 +17706,7 @@ var ts; error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } - if (flags & 128) { + if (flags & 64) { return true; } if (type.flags & 33554432) { @@ -17472,8 +17886,8 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { - var signature = signatures[_i]; + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { @@ -17884,8 +18298,8 @@ var ts; reportError(ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { - var candidate = candidates[_i]; + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; if (hasCorrectArity(node, args, candidate)) { if (candidate.typeParameters && typeArguments) { candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); @@ -17904,8 +18318,8 @@ var ts; diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); } function chooseOverload(candidates, relation) { - for (var _i = 0; _i < candidates.length; _i++) { - var originalCandidate = candidates[_i]; + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var originalCandidate = candidates_2[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } @@ -18008,7 +18422,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && valueDecl.flags & 256) { + if (valueDecl && valueDecl.flags & 128) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); } @@ -18294,32 +18708,24 @@ var ts; }); return aggregatedTypes; } - function bodyContainsAReturnStatement(funcBody) { - return ts.forEachReturnStatement(funcBody, function (returnStatement) { - return true; - }); - } - function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 208); - } - function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 || !(func.flags & 524288)) { return; } - var bodyBlock = func.body; - if (bodyContainsAReturnStatement(bodyBlock)) { - return; + if (func.flags & 1048576) { + if (compilerOptions.noImplicitReturns) { + error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } - if (bodyContainsSingleThrowStatement(bodyBlock)) { - return; + else { + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } - error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); @@ -18378,7 +18784,7 @@ var ts; promisedType = checkAsyncFunctionReturnType(node); } if (returnType && !node.asteriskToken) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (node.body) { if (!node.type) { @@ -18437,7 +18843,7 @@ var ts; case 69: case 166: { var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384) !== 0; } case 167: { var index = n.argumentExpression; @@ -18445,7 +18851,7 @@ var ts; if (symbol && index && index.kind === 9) { var name_13 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_13); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768) !== 0; + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384) !== 0; } return false; } @@ -18525,8 +18931,8 @@ var ts; } if (type.flags & 49152) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; if (current.flags & kind) { return true; } @@ -18541,8 +18947,8 @@ var ts; } if (type.flags & 49152) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var current = types_10[_i]; if (!(current.flags & kind)) { return false; } @@ -18577,8 +18983,8 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { - var p = properties[_i]; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var p = properties_3[_i]; if (p.kind === 245 || p.kind === 246) { var name_14 = p.name; var type = isTypeAny(sourceType) @@ -19040,7 +19446,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 112) { + if (node.flags & 56) { func = ts.getContainingFunction(node); if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -19221,7 +19627,7 @@ var ts; function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); checkFunctionLikeDeclaration(node); - if (node.flags & 256 && node.body) { + if (node.flags & 128 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -19268,7 +19674,7 @@ var ts; } function isInstancePropertyWithInitializer(n) { return n.kind === 141 && - !(n.flags & 128) && + !(n.flags & 64) && !!n.initializer; } var containingClassDecl = node.parent; @@ -19281,12 +19687,12 @@ var ts; error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + ts.forEach(node.parameters, function (p) { return p.flags & (8 | 16 | 32); }); if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement; - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; @@ -19312,15 +19718,22 @@ var ts; if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); if (node.kind === 145) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(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); + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288)) { + if (node.flags & 1048576) { + if (compilerOptions.noImplicitReturns) { + error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); + } } } if (!ts.hasDynamicName(node)) { var otherKind = node.kind === 145 ? 146 : 145; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 112) !== (otherAccessor.flags & 112))) { + if (((node.flags & 56) !== (otherAccessor.flags & 56))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var currentAccessorType = getAnnotatedAccessorType(node); @@ -19387,7 +19800,7 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 32) && ts.isInAmbientContext(node); + return (node.flags & 16) && ts.isInAmbientContext(node); } function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { if (!produceDiagnostics) { @@ -19412,8 +19825,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { - var otherSignature = signaturesToCheck[_i]; + for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { + var otherSignature = signaturesToCheck_1[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -19426,10 +19839,10 @@ var ts; n.parent.kind !== 214 && n.parent.kind !== 186 && ts.isInAmbientContext(n)) { - if (!(flags & 2)) { - flags |= 1; + if (!(flags & 4)) { + flags |= 2; } - flags |= 2; + flags |= 4; } return flags & flagsToCheck; } @@ -19447,16 +19860,16 @@ var ts; var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 1) { + if (deviation & 2) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } - else if (deviation & 2) { + else if (deviation & 4) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (32 | 64)) { + else if (deviation & (16 | 32)) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 256) { + else if (deviation & 128) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); } }); @@ -19473,7 +19886,7 @@ var ts; }); } } - var flagsToCheck = 1 | 2 | 32 | 64 | 256; + var flagsToCheck = 2 | 4 | 16 | 32 | 128; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -19502,8 +19915,8 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); - var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + ts.Debug.assert((node.flags & 64) !== (subsequentNode.flags & 64)); + var diagnostic = node.flags & 64 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); return; } @@ -19518,7 +19931,7 @@ var ts; error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); } else { - if (node.flags & 256) { + if (node.flags & 128) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -19529,8 +19942,8 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; @@ -19579,7 +19992,7 @@ var ts; }); } if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 256)) { + !(lastSeenNonAmbientDeclaration.flags & 128)) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -19589,8 +20002,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19620,9 +20033,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); - if (effectiveDeclarationFlags & 1) { - if (effectiveDeclarationFlags & 1024) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 | 512); + if (effectiveDeclarationFlags & 2) { + if (effectiveDeclarationFlags & 512) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -19758,9 +20171,12 @@ var ts; if (promiseType === unknownType && compilerOptions.isolatedModules) { return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } var promiseConstructorType = getTypeOfSymbol(promiseConstructor); @@ -19919,7 +20335,7 @@ var ts; if (isAsync) { promisedType = checkAsyncFunctionReturnType(node); } - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (produceDiagnostics && !node.type) { if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { @@ -20022,7 +20438,7 @@ var ts; } } function checkVarDeclaredNamesNotShadowed(node) { - if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 24576) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 211 && !node.initializer) { @@ -20034,7 +20450,7 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent ? varDeclList.parent.parent @@ -20161,6 +20577,9 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 194) { + error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } checkSourceElement(node.elseStatement); } function checkDoStatement(node) { @@ -20410,7 +20829,7 @@ var ts; error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else if (func.kind === 144) { - if (!isTypeAssignableTo(exprType, returnType)) { + if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } @@ -20540,7 +20959,7 @@ var ts; var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; - if (!(member.flags & 128) && ts.hasDynamicName(member)) { + if (!(member.flags & 64) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); @@ -20616,7 +21035,7 @@ var ts; return getTypeOfSymbol(getSymbolOfNode(node)); } function checkClassDeclaration(node) { - if (!node.name && !(node.flags & 1024)) { + if (!node.name && !(node.flags & 512)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -20666,8 +21085,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - for (var _b = 0; _b < implementedTypeNodes.length; _b++) { - var typeRefNode = implementedTypeNodes[_b]; + for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { + var typeRefNode = implementedTypeNodes_1[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -20699,8 +21118,8 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { - var baseProperty = baseProperties[_i]; + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; @@ -20711,7 +21130,7 @@ var ts; if (derived) { if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); - if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { + if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { if (derivedClassDecl.kind === 186) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } @@ -20722,10 +21141,10 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 32) || (derivedDeclarationFlags & 32)) { + if ((baseDeclarationFlags & 16) || (derivedDeclarationFlags & 16)) { continue; } - if ((baseDeclarationFlags & 128) !== (derivedDeclarationFlags & 128)) { + if ((baseDeclarationFlags & 64) !== (derivedDeclarationFlags & 64)) { continue; } if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { @@ -20791,11 +21210,11 @@ var ts; var seen = {}; ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0; _i < baseTypes.length; _i++) { - var base = baseTypes[_i]; + for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { + var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0; _a < properties.length; _a++) { - var prop = properties[_a]; + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } @@ -21064,8 +21483,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; if ((declaration.kind === 214 || (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { @@ -21193,7 +21612,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -21220,7 +21639,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 1) { + if (node.flags & 2) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21248,7 +21667,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -21287,7 +21706,7 @@ var ts; error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69) { @@ -21672,7 +22091,7 @@ var ts; } case 214: case 215: - if (!(memberFlags & 128)) { + if (!(memberFlags & 64)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; @@ -21934,7 +22353,7 @@ var ts; } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 128 + return node.flags & 64 ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -22220,7 +22639,7 @@ var ts; } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { - ts.bindSourceFile(file); + ts.bindSourceFile(file, compilerOptions); }); ts.forEach(host.getSourceFiles(), function (file) { if (!ts.isExternalModule(file)) { @@ -22364,19 +22783,19 @@ var ts; text = "private"; lastPrivate = modifier; } - if (flags & 112) { + if (flags & 56) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 128) { + else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } - else if (flags & 256) { + else if (flags & 128) { if (modifier.kind === 110) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -22387,10 +22806,10 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113: - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === 219 || node.parent.kind === 248) { @@ -22399,23 +22818,23 @@ var ts; else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 256) { + else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 128; + flags |= 64; lastStatic = modifier; break; case 82: - if (flags & 1) { + if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 2) { + else if (flags & 4) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 256) { + else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (node.parent.kind === 214) { @@ -22424,13 +22843,13 @@ var ts; else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 1; + flags |= 2; break; case 122: - if (flags & 2) { + if (flags & 4) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.parent.kind === 214) { @@ -22442,69 +22861,69 @@ var ts; else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 2; + flags |= 4; lastDeclare = modifier; break; case 115: - if (flags & 256) { + if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } if (node.kind !== 214) { if (node.kind !== 143) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 214 && node.parent.flags & 256)) { + if (!(node.parent.kind === 214 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 32) { + if (flags & 16) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } - flags |= 256; + flags |= 128; break; case 118: - if (flags & 512) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 2 || ts.isInAmbientContext(node.parent)) { + else if (flags & 4 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - flags |= 512; + flags |= 256; lastAsync = modifier; break; } } if (node.kind === 144) { - if (flags & 128) { + if (flags & 64) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - if (flags & 256) { + if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 64) { + else if (flags & 32) { return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (flags & 32) { + else if (flags & 16) { return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (flags & 512) { + else if (flags & 256) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return; } - else if ((node.kind === 222 || node.kind === 221) && flags & 2) { + else if ((node.kind === 222 || node.kind === 221) && flags & 4) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 && (flags & 56) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } - if (flags & 512) { + if (flags & 256) { return checkGrammarAsyncModifier(node, lastAsync); } } @@ -22604,7 +23023,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 2035) { + if (parameter.flags & 1022) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -22624,7 +23043,7 @@ var ts; } } function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 2035) { + if (node.flags & 1022) { grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } } @@ -22646,8 +23065,8 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; if (arg.kind === 187) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -22887,7 +23306,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 2035) { + else if (parameter.flags & 1022) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } else if (parameter.questionToken) { @@ -23021,8 +23440,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { - var element = elements[_i]; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; if (element.kind !== 187) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -23141,8 +23560,8 @@ var ts; node.kind === 221 || node.kind === 228 || node.kind === 227 || - (node.flags & 2) || - (node.flags & (1 | 1024))) { + (node.flags & 4) || + (node.flags & (2 | 512))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -23180,7 +23599,7 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.flags & 65536 && languageVersion >= 1) { + if (node.flags & 32768 && languageVersion >= 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -23227,7 +23646,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 8192) || + if (referencedFile && ((referencedFile.flags & 4096) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); @@ -23405,15 +23824,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -23555,6 +23974,7 @@ var ts; function emitSourceFile(node) { currentSourceFile = node; enclosingDeclaration = node; + ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true); emitLines(node.statements); } function getExportDefaultTempVariableName() { @@ -23661,10 +24081,10 @@ var ts; } function emitModuleElementDeclarationFlags(node) { if (node.parent === currentSourceFile) { - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } else if (node.kind !== 215) { @@ -23673,22 +24093,22 @@ var ts; } } function emitClassMemberDeclarationFlags(node) { - if (node.flags & 32) { + if (node.flags & 16) { write("private "); } - else if (node.flags & 64) { + else if (node.flags & 32) { write("protected "); } - if (node.flags & 128) { + if (node.flags & 64) { write("static "); } - if (node.flags & 256) { + if (node.flags & 128) { write("abstract "); } } function writeImportEqualsDeclaration(node) { emitJsDocComments(node); - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } write("import "); @@ -23723,11 +24143,11 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 1)) { + if (!node.importClause && !(node.flags & 2)) { return; } emitJsDocComments(node); - if (node.flags & 1) { + if (node.flags & 2) { write("export "); } write("import "); @@ -23789,7 +24209,7 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 131072) { + if (node.flags & 65536) { write("namespace "); } else { @@ -23861,7 +24281,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 && (node.parent.flags & 32); + return node.parent.kind === 143 && (node.parent.flags & 16); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23903,7 +24323,7 @@ var ts; break; case 143: case 142: - if (node.parent.flags & 128) { + if (node.parent.flags & 64) { diagnosticMessage = 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 === 214) { @@ -23966,7 +24386,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 112) { + if (param.flags & 56) { emitPropertyDeclaration(param); } }); @@ -23974,7 +24394,7 @@ var ts; } emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 256) { + if (node.flags & 128) { write("abstract "); } write("class "); @@ -24038,7 +24458,7 @@ var ts; if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 32)) { + else if (!(node.flags & 16)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } @@ -24052,7 +24472,7 @@ var ts; ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 141 || node.kind === 140) { - if (node.flags & 128) { + if (node.flags & 64) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -24147,7 +24567,7 @@ var ts; emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); - if (!(node.flags & 32)) { + if (!(node.flags & 16)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { @@ -24174,7 +24594,7 @@ var ts; function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 146) { - if (accessorWithTypeAnnotation.parent.flags & 128) { + if (accessorWithTypeAnnotation.parent.flags & 64) { 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; @@ -24191,7 +24611,7 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 128) { + if (accessorWithTypeAnnotation.flags & 64) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -24272,7 +24692,7 @@ var ts; emitType(node.type); } } - else if (node.kind !== 144 && !(node.flags & 32)) { + else if (node.kind !== 144 && !(node.flags & 16)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -24300,7 +24720,7 @@ var ts; break; case 143: case 142: - if (node.flags & 128) { + if (node.flags & 64) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -24357,7 +24777,7 @@ var ts; node.parent.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 32)) { + else if (!(node.parent.flags & 16)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { @@ -24386,7 +24806,7 @@ var ts; ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case 143: case 142: - if (node.parent.flags & 128) { + if (node.parent.flags & 64) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? 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 : @@ -24502,7 +24922,7 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 8192 + var declFileName = referencedFile.flags & 4096 ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") @@ -24835,16 +25255,8 @@ var ts; diagnostics: diagnostics, sourceMaps: sourceMapDataList }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && ts.hasProperty(node.locals, name)) { if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { return false; @@ -26137,7 +26549,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); + emitListWithSpread(elements, true, (node.flags & 1024) !== 0, elements.hasTrailingComma, true); } } function emitObjectLiteralBody(node, numElements) { @@ -26152,7 +26564,7 @@ var ts; emitLinePreservingList(node, properties, languageVersion >= 1, true); } else { - var multiLine = (node.flags & 2048) !== 0; + var multiLine = (node.flags & 1024) !== 0; if (!multiLine) { write(" "); } @@ -26171,7 +26583,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048) !== 0; + var multiLine = (node.flags & 1024) !== 0; var properties = node.properties; write("("); if (multiLine) { @@ -26689,7 +27101,7 @@ var ts; var current = node; while (current) { if (current.kind === 248) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + return !isExported || ((ts.getCombinedNodeFlags(node) & 2) !== 0); } else if (ts.isFunctionLike(current) || current.kind === 219) { return false; @@ -26907,7 +27319,7 @@ var ts; if (shouldHoistVariable(decl, true)) { return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 49152) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576) === 0) { for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { var varDecl = _b[_a]; hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); @@ -26989,7 +27401,7 @@ var ts; break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 49152)) { + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576)) { loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { var varDeclaration = _b[_a]; @@ -27246,22 +27658,22 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - var rhsIsIdentifier = node.expression.kind === 69; var counter = createTempVariable(268435456); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); + var rhsReference = ts.createSynthesizedNode(69); + rhsReference.text = node.expression.kind === 69 ? + makeUniqueName(node.expression.text) : + makeTempVariableName(0); emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); write(" = 0"); emitEnd(node.expression); - if (!rhsIsIdentifier) { - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); @@ -27496,7 +27908,7 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1) { + if (ts.getCombinedNodeFlags(node) & 2) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); @@ -27518,7 +27930,7 @@ var ts; } function emitEs6ExportDefaultCompat(node) { if (node.parent.kind === 248) { - ts.Debug.assert(!!(node.flags & 1024) || node.kind === 227); + ts.Debug.assert(!!(node.flags & 512) || node.kind === 227); if (modulekind === 1 || modulekind === 2 || modulekind === 3) { if (!currentSourceFile.symbol.exports["___esModule"]) { if (languageVersion === 1) { @@ -27534,12 +27946,12 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 1) { + if (node.flags & 2) { writeLine(); emitStart(node); if (modulekind === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); - if (node.flags & 1024) { + if (node.flags & 512) { write("default"); } else { @@ -27550,7 +27962,7 @@ var ts; write(")"); } else { - if (node.flags & 1024) { + if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { write("exports[\"default\"]"); @@ -27638,7 +28050,7 @@ var ts; var emitCount = 0; var canDefineTempVariablesInPlace = false; if (root.kind === 211) { - var isExported = ts.getCombinedNodeFlags(root) & 1; + var isExported = ts.getCombinedNodeFlags(root) & 2; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } @@ -27704,8 +28116,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value, true); } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; + for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { + var p = properties_5[_a]; if (p.kind === 245 || p.kind === 246) { var propName = p.name; var target_1 = p.kind === 246 ? p : p.initializer || propName; @@ -27824,7 +28236,7 @@ var ts; var initializer = node.initializer; if (!initializer && languageVersion < 2) { var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 16384); + (getCombinedFlagsForIdentifier(node.name) & 8192); if (isLetDefinedInLoop && node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { @@ -27863,13 +28275,13 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && + return !!(node.flags & 2) && modulekind === 5 && node.parent.kind === 248; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 1) { + if (node.flags & 2) { if (isES6ExportedDeclaration(node)) { write("export "); startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); @@ -27893,7 +28305,7 @@ var ts; } } function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 1)) { + if (!(node.flags & 2)) { return true; } if (isES6ExportedDeclaration(node)) { @@ -28050,7 +28462,7 @@ var ts; if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } } @@ -28189,7 +28601,7 @@ var ts; emitRestParameter(node); } function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 || node.flags & 512) { + if (languageVersion < 2 || node.flags & 256) { emitDownLevelExpressionFunctionBody(node, body); return; } @@ -28205,7 +28617,7 @@ var ts; scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); - emitDetachedComments(node.body); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); @@ -28241,7 +28653,7 @@ var ts; scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); - emitDetachedComments(body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); var startIndex = emitDirectivePrologues(body.statements, true); emitFunctionBodyPreamble(node); decreaseIndent(); @@ -28283,7 +28695,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 112) { + if (param.flags & 56) { writeLine(); emitStart(param); emitStart(param.name); @@ -28315,15 +28727,15 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 141 && isStatic === ((member.flags & 64) !== 0) && member.initializer) { properties.push(member); } } return properties; } function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var property = properties_6[_a]; emitPropertyDeclaration(node, property); } } @@ -28336,7 +28748,7 @@ var ts; emit(receiver); } else { - if (property.flags & 128) { + if (property.flags & 64) { emitDeclarationName(node); } else { @@ -28435,7 +28847,7 @@ var ts; writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 128) { + if (member.flags & 64) { write("static "); } if (member.kind === 145) { @@ -28480,7 +28892,7 @@ var ts; if (member.kind === 144 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 141 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 141 && member.initializer && (member.flags & 64) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -28517,7 +28929,7 @@ var ts; increaseIndent(); if (ctor) { startIndex = emitDirectivePrologues(ctor.body.statements, true); - emitDetachedComments(ctor.body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); var superCall; @@ -28588,7 +29000,7 @@ var ts; var thisNodeIsDecorated = ts.nodeIsDecorated(node); if (node.kind === 214) { if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { + if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } write("let "); @@ -28597,7 +29009,7 @@ var ts; } else if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024) { + if (node.flags & 512) { write("default "); } } @@ -28613,7 +29025,7 @@ var ts; write(" = "); } write("class"); - if ((node.name || (node.flags & 1024 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if ((node.name || (node.flags & 512 && staticProperties.length > 0)) && !thisNodeIsDecorated) { write(" "); emitDeclarationName(node); } @@ -28636,8 +29048,8 @@ var ts; write(";"); } if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; + for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { + var property = staticProperties_1[_a]; write(","); writeLine(); emitPropertyDeclaration(node, property, tempVariable, true); @@ -28653,7 +29065,7 @@ var ts; emitPropertyDeclarations(node, staticProperties); emitDecoratorsOfClass(node); } - if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { + if (!isES6ExportedDeclaration(node) && (node.flags & 2)) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -28662,7 +29074,7 @@ var ts; emitEnd(node); write(";"); } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { + else if (isES6ExportedDeclaration(node) && (node.flags & 512) && thisNodeIsDecorated) { writeLine(); write("export default "); emitDeclarationName(node); @@ -28742,13 +29154,13 @@ var ts; } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 128)) { + if (!(member.flags & 64)) { write(".prototype"); } } function emitDecoratorsOfClass(node) { emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 128); + emitDecoratorsOfMembers(node, 64); emitDecoratorsOfConstructor(node); } function emitDecoratorsOfConstructor(node) { @@ -28783,7 +29195,7 @@ var ts; function emitDecoratorsOfMembers(node, staticFlag) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.flags & 128) !== staticFlag) { + if ((member.flags & 64) !== staticFlag) { continue; } if (!ts.nodeCanBeDecorated(member)) { @@ -29110,7 +29522,7 @@ var ts; return; } if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + if (!(node.flags & 2) || isES6ExportedDeclaration(node)) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -29141,7 +29553,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 2 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -29152,7 +29564,7 @@ var ts; write(";"); } if (modulekind !== 5 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 1)) { + if (modulekind === 4 && (node.flags & 2)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -29254,7 +29666,7 @@ var ts; scopeEmitEnd(); } write(")("); - if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 2) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -29264,7 +29676,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { - if (modulekind === 4 && (node.flags & 1)) { + if (modulekind === 4 && (node.flags & 2)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -29362,7 +29774,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 221 && (node.flags & 2) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (modulekind !== 2) { emitLeadingComments(node); @@ -29428,7 +29840,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 1)) { + else if (!(node.flags & 2)) { write("var "); } } @@ -29516,8 +29928,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(modulekind === 5); var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; + for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { + var specifier = specifiers_1[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -29651,8 +30063,8 @@ var ts; } writeLine(); var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; + for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { + var importNode = externalImports_1[_a]; var skipNode = importNode.kind === 228 || (importNode.kind === 222 && !importNode.importClause); if (skipNode) { @@ -29677,8 +30089,8 @@ var ts; } if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; + for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { + var externalImport = externalImports_2[_a]; if (externalImport.kind === 228 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; @@ -29706,8 +30118,8 @@ var ts; } } } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; + for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { + var externalImport = externalImports_3[_d]; if (externalImport.kind !== 228) { continue; } @@ -29751,7 +30163,7 @@ var ts; return exportStarFunction; } function writeExportedName(node) { - if (node.kind !== 69 && node.flags & 1024) { + if (node.kind !== 69 && node.flags & 512) { return; } if (started) { @@ -29804,7 +30216,7 @@ var ts; emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); - if (flags & 1) { + if (flags & 2) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -29814,11 +30226,11 @@ var ts; write(";"); } if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; + for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { + var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 1) { + if (f.flags & 2) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -29828,7 +30240,7 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 2) { + if (node.flags & 4) { return; } if (node.kind === 213) { @@ -29898,7 +30310,7 @@ var ts; if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { return false; } - return (ts.getCombinedNodeFlags(node) & 49152) === 0 || + return (ts.getCombinedNodeFlags(node) & 24576) === 0 || ts.getEnclosingBlockScopeContainer(node).kind === 248; } function isCurrentFileSystemExternalModule() { @@ -29933,8 +30345,8 @@ var ts; var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; + for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { + var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { case 222: @@ -30068,8 +30480,8 @@ var ts; unaliasedModuleNames.push("\"" + amdDependency.path + "\""); } } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; + for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { + var importNode = externalImports_4[_c]; var externalModuleName = getExternalModuleNameText(importNode); var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { @@ -30322,7 +30734,7 @@ var ts; function emitSourceFileNode(node) { writeLine(); emitShebang(); - emitDetachedComments(node); + emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; emitModule(node); @@ -30345,7 +30757,7 @@ var ts; } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 2) { + if (node.flags & 4) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -30578,10 +30990,6 @@ var ts; } return leadingComments; } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } function isTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && @@ -30662,44 +31070,14 @@ var ts; ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + function emitDetachedCommentsAndUpdateCommentsInfo(node) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); } - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -31002,7 +31380,7 @@ var ts; var resolveModuleNamesWorker = host.resolveModuleNames ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); - var filesByName = ts.createFileMap(getCanonicalFileName); + var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; if (oldProgram) { var oldOptions = oldProgram.getCompilerOptions(); @@ -31050,8 +31428,8 @@ var ts; if (!classifiableNames) { getTypeChecker(); classifiableNames = {}; - for (var _i = 0; _i < files.length; _i++) { - var sourceFile = files[_i]; + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var sourceFile = files_3[_i]; ts.copyMap(sourceFile.classifiableNames, classifiableNames); } } @@ -31067,7 +31445,7 @@ var ts; return false; } var newSourceFiles = []; - var normalizedAbsoluteFileNames = []; + var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; @@ -31075,8 +31453,8 @@ var ts; if (!newSourceFile) { return false; } - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - normalizedAbsoluteFileNames.push(normalizedAbsolutePath); + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); if (oldSourceFile !== newSourceFile) { if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { return false; @@ -31090,7 +31468,7 @@ var ts; } if (resolveModuleNamesWorker) { var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, normalizedAbsolutePath); + var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); for (var i = 0; i < moduleNames.length; ++i) { var newResolution = resolutions[i]; var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); @@ -31113,12 +31491,12 @@ var ts; newSourceFiles.push(newSourceFile); } for (var i = 0, len = newSourceFiles.length; i < len; ++i) { - filesByName.set(normalizedAbsoluteFileNames[i], newSourceFiles[i]); + filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _b = 0; _b < modifiedSourceFiles.length; _b++) { - var modifiedFile = modifiedSourceFiles[_b]; + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } oldProgram.structureIsReused = true; @@ -31157,7 +31535,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.getNormalizedAbsolutePath(fileName, currentDirectory)); + return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -31266,7 +31644,7 @@ var ts; } break; case 218: - if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + if (node.name.kind === 9 && (node.flags & 4 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { collect(node, false); }); @@ -31283,7 +31661,7 @@ var ts; diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -31293,13 +31671,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.getNormalizedAbsolutePath(fileName + extension, currentDirectory), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -31341,6 +31719,7 @@ var ts; }); filesByName.set(normalizedAbsolutePath, file); if (file) { + file.path = normalizedAbsolutePath; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); if (existingFile) { @@ -31385,11 +31764,7 @@ var ts; var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - var absoluteImportPath = ts.isRootedDiskPath(resolution.resolvedFileName) - ? resolution.resolvedFileName - : ts.getNormalizedAbsolutePath(resolution.resolvedFileName, currentDirectory); - var relativePath = ts.getRelativePathToDirectoryOrUrl(currentDirectory, absoluteImportPath, currentDirectory, getCanonicalFileName, false); - var importedFile = findSourceFile(relativePath, absoluteImportPath, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); @@ -31440,8 +31815,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -31557,7 +31932,7 @@ var ts; var BreakpointResolver; (function (BreakpointResolver) { function spanInSourceFileAtLocation(sourceFile, position) { - if (sourceFile.flags & 8192) { + if (sourceFile.flags & 4096) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); @@ -31732,7 +32107,7 @@ var ts; : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; - if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { + if (variableDeclaration.initializer || (variableDeclaration.flags & 2)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { return textSpan(variableDeclaration.parent, variableDeclaration); @@ -31753,7 +32128,7 @@ var ts; } function canHaveSpanInParameterDeclaration(parameter) { return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16) || !!(parameter.flags & 32); + !!(parameter.flags & 8) || !!(parameter.flags & 16); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -31771,7 +32146,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || + return !!(functionDeclaration.flags & 2) || (functionDeclaration.parent.kind === 214 && functionDeclaration.kind !== 144); } function spanInFunctionDeclaration(functionDeclaration) { @@ -31853,7 +32228,6 @@ var ts; } case 244: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - ; case 220: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -31888,7 +32262,6 @@ var ts; default: return spanInNode(node.parent); } - return spanInNode(node.parent); } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || node.parent.kind === 245) { @@ -31949,8 +32322,8 @@ var ts; var lastSingleLineCommentEnd = -1; var isFirstSingleLineComment = true; var singleLineCommentCount = 0; - for (var _i = 0; _i < comments.length; _i++) { - var currentComment = comments[_i]; + for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { + var currentComment = comments_2[_i]; if (currentComment.kind === 2) { if (isFirstSingleLineComment) { firstSingleLineCommentStart = currentComment.pos; @@ -32071,6 +32444,7 @@ var ts; function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; + var baseSensitivity = { sensitivity: "base" }; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); @@ -32081,8 +32455,8 @@ var ts; if (!matches) { continue; } - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { @@ -32108,8 +32482,8 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; if (!match.isCaseSensitive) { return false; } @@ -32177,8 +32551,8 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { + var match = matches_2[_i]; var kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; @@ -32186,7 +32560,6 @@ var ts; } return bestMatchKind; } - var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || @@ -32314,8 +32687,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; switch (node.kind) { case 214: case 217: @@ -32353,8 +32726,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var child = nodes_5[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -32397,7 +32770,7 @@ var ts; if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 2035) === 0) { + if ((node.flags & 1022) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); @@ -32661,8 +33034,8 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { - var span = wordSpans[_i]; + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); } @@ -32714,8 +33087,8 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { - var subWordTextChunk = subWordTextChunks[_i]; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { return undefined; @@ -33078,8 +33451,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0; _b < declarations.length; _b++) { - var declaration = declarations[_b]; + for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { + var declaration = declarations_7[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -33155,8 +33528,8 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { - var child = listChildren[_i]; + for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) { + var child = listChildren_1[_i]; if (child === node) { break; } @@ -33598,8 +33971,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { - var child = children[_i]; + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -33722,17 +34095,17 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 32) - result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 64) - result.push(ts.ScriptElementKindModifier.protectedMemberModifier); if (flags & 16) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 32) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 8) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 128) + if (flags & 64) result.push(ts.ScriptElementKindModifier.staticModifier); - if (flags & 256) + if (flags & 128) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 1) + if (flags & 2) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); @@ -35533,8 +35906,8 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true); } if (listEndToken !== 0) { @@ -35616,8 +35989,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { - var triviaItem = trivia[_i]; + for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { + var triviaItem = trivia_1[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -36146,7 +36519,6 @@ var ts; return node; } } - return node; } } function deriveActualIndentationFromList(list, index, sourceFile, options) { @@ -36374,17 +36746,17 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 4096, this)); + nodes.push(createNode(token, pos, textPos, 2048, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271, nodes.pos, nodes.end, 4096, this); + var list = createNode(271, nodes.pos, nodes.end, 2048, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -36890,7 +37262,7 @@ var ts; } break; case 138: - if (!(node.flags & 112)) { + if (!(node.flags & 56)) { break; } case 211: @@ -37089,18 +37461,20 @@ var ts; var HostCache = (function () { function HostCache(host, getCanonicalFileName) { this.host = host; - this.fileNameToEntry = ts.createFileMap(getCanonicalFileName); + this.getCanonicalFileName = getCanonicalFileName; + this.currentDirectory = host.getCurrentDirectory(); + this.fileNameToEntry = ts.createFileMap(); var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; - this.createEntry(fileName); + for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { + var fileName = rootFileNames_1[_i]; + this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName)); } this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); } HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; - HostCache.prototype.createEntry = function (fileName) { + HostCache.prototype.createEntry = function (fileName, path) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { @@ -37110,36 +37484,37 @@ var ts; scriptSnapshot: scriptSnapshot }; } - this.fileNameToEntry.set(fileName, entry); + this.fileNameToEntry.set(path, entry); return entry; }; - HostCache.prototype.getEntry = function (fileName) { - return this.fileNameToEntry.get(fileName); + HostCache.prototype.getEntry = function (path) { + return this.fileNameToEntry.get(path); }; - HostCache.prototype.contains = function (fileName) { - return this.fileNameToEntry.contains(fileName); + HostCache.prototype.contains = function (path) { + return this.fileNameToEntry.contains(path); }; HostCache.prototype.getOrCreateEntry = function (fileName) { - if (this.contains(fileName)) { - return this.getEntry(fileName); + var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); + if (this.contains(path)) { + return this.getEntry(path); } - return this.createEntry(fileName); + return this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; - this.fileNameToEntry.forEachValue(function (value) { + this.fileNameToEntry.forEachValue(function (path, value) { if (value) { fileNames.push(value.hostFileName); } }); return fileNames; }; - HostCache.prototype.getVersion = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getVersion = function (path) { + var file = this.getEntry(path); return file && file.version; }; - HostCache.prototype.getScriptSnapshot = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getScriptSnapshot = function (path) { + var file = this.getEntry(path); return file && file.scriptSnapshot; }; return HostCache; @@ -37282,7 +37657,8 @@ var ts; : (function (fileName) { return fileName.toLowerCase(); }); } ts.createGetCanonicalFileName = createGetCanonicalFileName; - function createDocumentRegistry(useCaseSensitiveFileNames) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } var buckets = {}; var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyFromCompilationSettings(settings) { @@ -37292,7 +37668,7 @@ var ts; var key = getKeyFromCompilationSettings(settings); var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(getCanonicalFileName); + buckets[key] = bucket = ts.createFileMap(); } return bucket; } @@ -37300,14 +37676,13 @@ var ts; var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; - for (var i in entries) { - var entry = entries.get(i); + entries.forEachValue(function (key, entry) { sourceFiles.push({ - name: i, + name: key, refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); - } + }); sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, @@ -37324,7 +37699,8 @@ var ts; } function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { var bucket = getBucketForCompilationSettings(compilationSettings, true); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); @@ -37333,7 +37709,7 @@ var ts; languageServiceRefCount: 0, owners: [] }; - bucket.set(fileName, entry); + bucket.set(path, entry); } else { if (entry.sourceFile.version !== version) { @@ -37348,11 +37724,12 @@ var ts; function releaseDocument(fileName, compilationSettings) { var bucket = getBucketForCompilationSettings(compilationSettings, false); ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); if (entry.languageServiceRefCount === 0) { - bucket.remove(fileName); + bucket.remove(path); } } return { @@ -37705,7 +38082,7 @@ var ts; case 144: return ScriptElementKind.constructorImplementationElement; case 137: return ScriptElementKind.typeParameterElement; case 247: return ScriptElementKind.variableElement; - case 138: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138: return (node.flags & 56) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 221: case 226: case 223: @@ -37731,13 +38108,14 @@ var ts; return CancellationTokenObject; })(); function createLanguageService(host, documentRegistry) { - if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var currentDirectory = host.getCurrentDirectory(); if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); } @@ -37748,8 +38126,7 @@ var ts; } var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { - fileName = ts.normalizeSlashes(fileName); - var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { throw new Error("Could not find file: '" + fileName + "'."); } @@ -37791,7 +38168,7 @@ var ts; getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { ts.Debug.assert(!host.resolveModuleNames); return hostCache.getOrCreateEntry(fileName) !== undefined; @@ -37807,11 +38184,10 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { - var oldSourceFile = oldSourceFiles[_i]; - var fileName = oldSourceFile.fileName; - if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(fileName, oldSettings); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; + if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); } } } @@ -37834,7 +38210,8 @@ var ts; return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } function sourceFileUpToDate(sourceFile) { - return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); + return sourceFile && sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { if (!program) { @@ -37844,8 +38221,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; + for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) { + var fileName = rootFileNames_2[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; } @@ -38007,8 +38384,8 @@ var ts; } function checkModifiers(modifiers) { if (modifiers) { - for (var _i = 0; _i < modifiers.length; _i++) { - var modifier = modifiers[_i]; + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; switch (modifier.kind) { case 112: case 110: @@ -38571,8 +38948,8 @@ var ts; } function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { var exisingImportsOrExports = {}; - for (var _i = 0; _i < namedImportsOrExports.length; _i++) { - var element = namedImportsOrExports[_i]; + for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { + var element = namedImportsOrExports_1[_i]; if (element.getStart() <= position && position <= element.getEnd()) { continue; } @@ -38589,8 +38966,8 @@ var ts; return contextualMemberSymbols; } var existingMemberNames = {}; - for (var _i = 0; _i < existingMembers.length; _i++) { - var m = existingMembers[_i]; + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; if (m.kind !== 245 && m.kind !== 246 && m.kind !== 163) { @@ -38612,8 +38989,8 @@ var ts; } function filterJsxAttributes(symbols, attributes) { var seenNames = {}; - for (var _i = 0; _i < attributes.length; _i++) { - var attr = attributes[_i]; + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } @@ -38701,8 +39078,8 @@ var ts; var entries = []; if (symbols) { var nameToSymbol = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -39385,8 +39762,8 @@ var ts; } var fileNameToDocumentHighlights = {}; var result = []; - for (var _i = 0; _i < referencedSymbols.length; _i++) { - var referencedSymbol = referencedSymbols[_i]; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { var referenceEntry = _b[_a]; var fileName_1 = referenceEntry.fileName; @@ -39522,7 +39899,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } function getThrowStatementOwner(throwStatement) { var child = throwStatement; @@ -39553,7 +39929,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } function ownsBreakOrContinueStatement(owner, statement) { var actualOwner = getBreakOrContinueOwner(statement); @@ -39617,7 +39992,7 @@ var ts; switch (container.kind) { case 219: case 248: - if (modifierFlag & 256) { + if (modifierFlag & 128) { nodes = declaration.members.concat(declaration); } else { @@ -39630,7 +40005,7 @@ var ts; case 214: case 186: nodes = container.members; - if (modifierFlag & 112) { + if (modifierFlag & 56) { var constructor = ts.forEach(container.members, function (member) { return member.kind === 144 && member; }); @@ -39638,7 +40013,7 @@ var ts; nodes = nodes.concat(constructor.parameters); } } - else if (modifierFlag & 256) { + else if (modifierFlag & 128) { nodes = nodes.concat(container); } break; @@ -39654,19 +40029,19 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112: - return 16; + return 8; case 110: - return 32; + return 16; case 111: - return 64; + return 32; case 113: - return 128; + return 64; case 82: - return 1; - case 122: return 2; + case 122: + return 4; case 115: - return 256; + return 128; default: ts.Debug.fail(); } @@ -39851,8 +40226,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0; _i < documentHighlights.length; _i++) { - var entry = documentHighlights[_i]; + for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { + var entry = documentHighlights_1[_i]; for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { var highlightSpan = _b[_a]; result.push({ @@ -39870,8 +40245,8 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0; _i < referenceSymbols.length; _i++) { - var referenceSymbol = referenceSymbols[_i]; + for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { + var referenceSymbol = referenceSymbols_1[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } return referenceEntries; @@ -39939,8 +40314,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var sourceFile = sourceFiles_2[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName)) { @@ -39985,7 +40360,7 @@ var ts; return valueDeclaration; } if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 214); } @@ -39999,8 +40374,8 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -40153,7 +40528,7 @@ var ts; if (!searchSpaceNode) { return undefined; } - var staticFlag = 128; + var staticFlag = 64; switch (searchSpaceNode.kind) { case 141: case 140: @@ -40178,7 +40553,7 @@ var ts; return; } var container = ts.getSuperContainer(node, false); - if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (64 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -40187,7 +40562,7 @@ var ts; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); - var staticFlag = 128; + var staticFlag = 64; switch (searchSpaceNode.kind) { case 143: case 142: @@ -40259,7 +40634,7 @@ var ts; break; case 186: case 214: - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; @@ -40386,8 +40761,8 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -40500,7 +40875,6 @@ var ts; return 4 | 1; } return 1 | 2 | 4; - ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { @@ -41007,8 +41381,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { - var current = childNodes[_i]; + for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { + var current = childNodes_1[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -41224,8 +41598,8 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var current = declarations_10[_i]; var sourceFile_2 = current.getSourceFile(); var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -41962,8 +42336,8 @@ var ts; if (this.logger.isVerbose()) { this.logger.info(msg.type + ": " + json); } - this.sendLineToClient('Content-Length: ' + (1 + this.byteLength(json, 'utf8')) + - '\r\n\r\n' + json); + this.sendLineToClient("Content-Length: " + (1 + this.byteLength(json, "utf8")) + + "\r\n\r\n" + json); }; Session.prototype.event = function (info, eventName) { var ev = { @@ -42346,7 +42720,8 @@ var ts; }; var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); var hasIndent = 0; - for (var i = 0, len = lineText.length; i < len; i++) { + var i, len; + for (i = 0, len = lineText.length; i < len; i++) { if (lineText.charAt(i) == " ") { hasIndent++; } @@ -42553,7 +42928,7 @@ var ts; if (navItem.kindModifiers && (navItem.kindModifiers != "")) { bakedItem.kindModifiers = navItem.kindModifiers; } - if (navItem.matchKind != 'none') { + if (navItem.matchKind !== "none") { bakedItem.matchKind = navItem.matchKind; } if (navItem.containerName && (navItem.containerName.length > 0)) { @@ -42592,8 +42967,8 @@ var ts; var veryLowPriorityFiles = []; var normalizedFileName = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(normalizedFileName); - for (var _i = 0; _i < fileNamesInProject.length; _i++) { - var fileNameInProject = fileNamesInProject[_i]; + for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) { + var fileNameInProject = fileNamesInProject_1[_i]; if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) highPriorityFiles.push(fileNameInProject); else { @@ -42641,12 +43016,14 @@ var ts; } }; Session.prototype.onMessage = function (message) { + var start; if (this.logger.isVerbose()) { this.logger.info("request: " + message); - var start = this.hrtime(); + start = this.hrtime(); } + var request; try { - var request = JSON.parse(message); + request = JSON.parse(message); var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired; if (this.logger.isVerbose()) { var elapsed = this.hrtime(start); @@ -42701,6 +43078,7 @@ var ts; this.isOpen = isOpen; this.children = []; this.formatCodeOptions = ts.clone(CompilerService.defaultFormatCodeOptions); + this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); this.svc = ScriptVersionCache.fromString(host, content); } ScriptInfo.prototype.setFormatOptions = function (formatOptions) { @@ -42742,23 +43120,23 @@ var ts; var _this = this; this.host = host; this.project = project; - this.ls = null; this.roots = []; - var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); - this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName); - this.filenameToScript = ts.createFileMap(getCanonicalFileName); + this.getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + this.resolvedModuleNames = ts.createFileMap(); + this.filenameToScript = ts.createFileMap(); this.moduleResolutionHost = { fileExists: function (fileName) { return _this.fileExists(fileName); }, readFile: function (fileName) { return _this.host.readFile(fileName); } }; } LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { - var currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); + var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var currentResolutionsInFile = this.resolvedModuleNames.get(path); var newResolutions = {}; var resolvedModules = []; var compilerOptions = this.getCompilationSettings(); - for (var _i = 0; _i < moduleNames.length; _i++) { - var moduleName = moduleNames[_i]; + for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { + var moduleName = moduleNames_1[_i]; var resolution = ts.lookUp(newResolutions, moduleName); if (!resolution) { var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); @@ -42774,7 +43152,7 @@ var ts; ts.Debug.assert(resolution !== undefined); resolvedModules.push(resolution.resolvedModule); } - this.resolvedModuleNames.set(containingFile, newResolutions); + this.resolvedModuleNames.set(path, newResolutions); return resolvedModules; function moduleResolutionIsValid(resolution) { if (!resolution) { @@ -42825,31 +43203,32 @@ var ts; }; LSHost.prototype.removeReferencedFile = function (info) { if (!info.isOpen) { - this.filenameToScript.remove(info.fileName); - this.resolvedModuleNames.remove(info.fileName); + this.filenameToScript.remove(info.path); + this.resolvedModuleNames.remove(info.path); } }; LSHost.prototype.getScriptInfo = function (filename) { - var scriptInfo = this.filenameToScript.get(filename); + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var scriptInfo = this.filenameToScript.get(path); if (!scriptInfo) { scriptInfo = this.project.openReferencedFile(filename); if (scriptInfo) { - this.filenameToScript.set(scriptInfo.fileName, scriptInfo); + this.filenameToScript.set(path, scriptInfo); } } return scriptInfo; }; LSHost.prototype.addRoot = function (info) { - if (!this.filenameToScript.contains(info.fileName)) { - this.filenameToScript.set(info.fileName, info); + if (!this.filenameToScript.contains(info.path)) { + this.filenameToScript.set(info.path, info); this.roots.push(info); } }; LSHost.prototype.removeRoot = function (info) { - if (!this.filenameToScript.contains(info.fileName)) { - this.filenameToScript.remove(info.fileName); + if (!this.filenameToScript.contains(info.path)) { + this.filenameToScript.remove(info.path); this.roots = copyListRemovingItem(info, this.roots); - this.resolvedModuleNames.remove(info.fileName); + this.resolvedModuleNames.remove(info.path); } }; LSHost.prototype.saveTo = function (filename, tmpfilename) { @@ -42887,7 +43266,8 @@ var ts; return this.host.directoryExists(path); }; LSHost.prototype.lineToTextSpan = function (filename, line) { - var script = this.filenameToScript.get(filename); + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line + 1); var len; @@ -42901,13 +43281,15 @@ var ts; return ts.createTextSpan(lineInfo.offset, len); }; LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) { - var script = this.filenameToScript.get(filename); + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line); return (lineInfo.offset + offset - 1); }; LSHost.prototype.positionToLineOffset = function (filename, position) { - var script = this.filenameToScript.get(filename); + var path = ts.toPath(filename, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var script = this.filenameToScript.get(path); var index = script.snap().index; var lineOffset = index.charOffsetToLineNumberAndPos(position); return { line: lineOffset.line, offset: lineOffset.offset + 1 }; @@ -42921,22 +43303,22 @@ var ts; return filename; } else { - var splitFilename = filename.split('/'); - var splitDir = directory.split('/'); + var splitFilename = filename.split("/"); + var splitDir = directory.split("/"); var i = 0; var dirTail = 0; var sflen = splitFilename.length; - while ((i < sflen) && (splitFilename[i].charAt(0) == '.')) { + while ((i < sflen) && (splitFilename[i].charAt(0) == ".")) { var dots = splitFilename[i]; - if (dots == '..') { + if (dots == "..") { dirTail++; } - else if (dots != '.') { + else if (dots != ".") { return undefined; } i++; } - return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join('/'); + return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join("/"); } } var Project = (function () { @@ -43111,8 +43493,8 @@ var ts; var _a = this.configFileToProjectOptions(fileName), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; var rootFilesInTsconfig = projectOptions.files.map(function (f) { return _this.getCanonicalFileName(f); }); var openFileRoots = this.openFileRoots.map(function (s) { return _this.getCanonicalFileName(s.fileName); }); - for (var _i = 0; _i < openFileRoots.length; _i++) { - var openFileRoot = openFileRoots[_i]; + for (var _i = 0, openFileRoots_1 = openFileRoots; _i < openFileRoots_1.length; _i++) { + var openFileRoot = openFileRoots_1[_i]; if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) { this.reloadProjects(); return; @@ -43236,8 +43618,8 @@ var ts; this.inferredProjects = copyListRemovingItem(project, this.inferredProjects); } var fileNames = project.getFileNames(); - for (var _b = 0; _b < fileNames.length; _b++) { - var fileName = fileNames[_b]; + for (var _b = 0, fileNames_1 = fileNames; _b < fileNames_1.length; _b++) { + var fileName = fileNames_1[_b]; var info = this.getScriptInfo(fileName); if (info.defaultProject == project) { info.defaultProject = undefined; @@ -43591,10 +43973,11 @@ var ts; } else { var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath); + ts.Debug.assert(!!parsedCommandLine.fileNames); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { succeeded: false, error: { errorMsg: "tsconfig option errors" } }; } - else if (parsedCommandLine.fileNames == null) { + else if (parsedCommandLine.fileNames.length === 0) { return { succeeded: false, error: { errorMsg: "no files found" } }; } else { @@ -43646,15 +44029,15 @@ var ts; var newFileNames = projectOptions.files; var fileNamesToRemove = oldFileNames.filter(function (f) { return newFileNames.indexOf(f) < 0; }); var fileNamesToAdd = newFileNames.filter(function (f) { return oldFileNames.indexOf(f) < 0; }); - for (var _i = 0; _i < fileNamesToRemove.length; _i++) { - var fileName = fileNamesToRemove[_i]; + for (var _i = 0, fileNamesToRemove_1 = fileNamesToRemove; _i < fileNamesToRemove_1.length; _i++) { + var fileName = fileNamesToRemove_1[_i]; var info = this.getScriptInfo(fileName); if (info) { project.removeRoot(info); } } - for (var _b = 0; _b < fileNamesToAdd.length; _b++) { - var fileName = fileNamesToAdd[_b]; + for (var _b = 0, fileNamesToAdd_1 = fileNamesToAdd; _b < fileNamesToAdd_1.length; _b++) { + var fileName = fileNamesToAdd_1[_b]; var info = this.getScriptInfo(fileName); if (!info) { info = this.openFile(fileName, false); @@ -43714,7 +44097,7 @@ var ts; CompilerService.defaultFormatCodeOptions = { IndentSize: 4, TabSize: 4, - NewLineCharacter: ts.sys ? ts.sys.newLine : '\n', + NewLineCharacter: ts.sys ? ts.sys.newLine : "\n", ConvertTabsToSpaces: true, IndentStyle: ts.IndentStyle.Smart, InsertSpaceAfterCommaDelimiter: true, @@ -43804,7 +44187,7 @@ var ts; if (len > 1) { var insertedNodes = new Array(len - 1); var startNode = leafNode; - for (var i = 1, len = lines.length; i < len; i++) { + for (var i = 1, len_1 = lines.length; i < len_1; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } var pathIndex = this.startPath.length - 2; @@ -44172,8 +44555,9 @@ var ts; } } else { + var checkText; if (this.checkEdits) { - var checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); } var walker = new EditWalker(); if (pos >= this.root.charCount()) { @@ -44399,7 +44783,9 @@ var ts; LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { var child; var relativeLineNumber = lineNumber; - for (var i = 0, len = this.children.length; i < len; i++) { + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { child = this.children[i]; var childLineCount = child.lineCount(); if (childLineCount >= relativeLineNumber) { @@ -44419,7 +44805,9 @@ var ts; }; LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { var child; - for (var i = 0, len = this.children.length; i < len; i++) { + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { child = this.children[i]; if (child.charCount() > charOffset) { break; @@ -44501,7 +44889,7 @@ var ts; splitNode = splitNodes[splitNodeIndex]; } } - for (i = splitNodes.length - 1; i >= 0; i--) { + for (var i = splitNodes.length - 1; i >= 0; i--) { if (splitNodes[i].children.length === 0) { splitNodes.length--; } @@ -44511,7 +44899,7 @@ var ts; splitNodes[splitNodes.length] = shiftNode; } this.updateCounts(); - for (i = 0; i < splitNodeCount; i++) { + for (var i = 0; i < splitNodeCount; i++) { splitNodes[i].updateCounts(); } return splitNodes; @@ -44561,10 +44949,10 @@ var ts; (function (ts) { var server; (function (server) { - var nodeproto = require('_debugger'); - var readline = require('readline'); - var path = require('path'); - var fs = require('fs'); + var nodeproto = require("_debugger"); + var readline = require("readline"); + var path = require("path"); + var fs = require("fs"); var rl = readline.createInterface({ input: process.stdin, output: process.stdout, @@ -44644,11 +45032,11 @@ var ts; }; IOSession.prototype.listen = function () { var _this = this; - rl.on('line', function (input) { + rl.on("line", function (input) { var message = input.trim(); _this.onMessage(message); }); - rl.on('close', function () { + rl.on("close", function () { _this.exit(); }); }; @@ -44656,7 +45044,7 @@ var ts; })(server.Session); function parseLoggingEnvironmentString(logEnvStr) { var logEnv = {}; - var args = logEnvStr.split(' '); + var args = logEnvStr.split(" "); for (var i = 0, len = args.length; i < (len - 1); i += 2) { var option = args[i]; var value = args[i + 1]; @@ -44711,7 +45099,7 @@ var ts; } ts.sys.write = function (s) { return writeMessage(s); }; var ioSession = new IOSession(ts.sys, logger); - process.on('uncaughtException', function (err) { + process.on("uncaughtException", function (err) { ioSession.logError(err, "unknown"); }); ioSession.listen(); @@ -44794,7 +45182,6 @@ var ts; var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - return null; } return JSON.parse(settingsJson); }; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index d94e55eb48f..972ebfa472d 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -17,19 +17,22 @@ declare namespace ts { interface Map { [index: string]: T; } + type Path = string & { + __pathBrand: any; + }; interface FileMap { - get(fileName: string): T; - set(fileName: string, value: T): void; - contains(fileName: string): boolean; - remove(fileName: string): void; - forEachValue(f: (v: T) => void): void; + get(fileName: Path): T; + set(fileName: Path, value: T): void; + contains(fileName: Path): boolean; + remove(fileName: Path): void; + forEachValue(f: (key: Path, v: T) => void): void; clear(): void; } interface TextRange { pos: number; end: number; } - const enum SyntaxKind { + enum SyntaxKind { Unknown = 0, EndOfFileToken = 1, SingleLineCommentTrivia = 2, @@ -327,31 +330,34 @@ declare namespace ts { LastBinaryOperator = 68, FirstNode = 135, } - const enum NodeFlags { + enum NodeFlags { None = 0, - Export = 1, - Ambient = 2, - Public = 16, - Private = 32, - Protected = 64, - Static = 128, - Abstract = 256, - Async = 512, - Default = 1024, - MultiLine = 2048, - Synthetic = 4096, - DeclarationFile = 8192, - Let = 16384, - Const = 32768, - OctalLiteral = 65536, - Namespace = 131072, - ExportContext = 262144, - ContainsThis = 524288, - Modifier = 2035, - AccessibilityModifier = 112, - BlockScoped = 49152, + Export = 2, + Ambient = 4, + Public = 8, + Private = 16, + Protected = 32, + Static = 64, + Abstract = 128, + Async = 256, + Default = 512, + MultiLine = 1024, + Synthetic = 2048, + DeclarationFile = 4096, + Let = 8192, + Const = 16384, + OctalLiteral = 32768, + Namespace = 65536, + ExportContext = 131072, + ContainsThis = 262144, + HasImplicitReturn = 524288, + HasExplicitReturn = 1048576, + Modifier = 1022, + AccessibilityModifier = 56, + BlockScoped = 24576, + ReachabilityCheckFlags = 1572864, } - const enum JsxFlags { + enum JsxFlags { None = 0, IntrinsicNamedElement = 1, IntrinsicIndexedElement = 2, @@ -931,6 +937,7 @@ declare namespace ts { statements: NodeArray; endOfFileToken: Node; fileName: string; + path: Path; text: string; amdDependencies: { path: string; @@ -1093,7 +1100,7 @@ declare namespace ts { trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; } - const enum TypeFormatFlags { + enum TypeFormatFlags { None = 0, WriteArrayAsGenericType = 1, UseTypeOfFunction = 2, @@ -1104,7 +1111,7 @@ declare namespace ts { InElementType = 64, UseFullyQualifiedType = 128, } - const enum SymbolFormatFlags { + enum SymbolFormatFlags { None = 0, WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, @@ -1114,7 +1121,7 @@ declare namespace ts { parameterIndex: number; type: Type; } - const enum SymbolFlags { + enum SymbolFlags { None = 0, FunctionScopedVariable = 1, BlockScopedVariable = 2, @@ -1191,7 +1198,7 @@ declare namespace ts { interface SymbolTable { [index: string]: Symbol; } - const enum TypeFlags { + enum TypeFlags { Any = 1, String = 2, Number = 4, @@ -1262,7 +1269,7 @@ declare namespace ts { interface TypeParameter extends Type { constraint: Type; } - const enum SignatureKind { + enum SignatureKind { Call = 0, Construct = 1, } @@ -1272,7 +1279,7 @@ declare namespace ts { parameters: Symbol[]; typePredicate?: TypePredicate; } - const enum IndexKind { + enum IndexKind { String = 0, Number = 1, } @@ -1307,7 +1314,7 @@ declare namespace ts { Error = 1, Message = 2, } - const enum ModuleResolutionKind { + enum ModuleResolutionKind { Classic = 1, NodeJs = 2, } @@ -1352,10 +1359,14 @@ declare namespace ts { experimentalDecorators?: boolean; emitDecoratorMetadata?: boolean; moduleResolution?: ModuleResolutionKind; + allowUnusedLabels?: boolean; + allowUnreachableCode?: boolean; + noImplicitReturns?: boolean; + noFallthroughCasesInSwitch?: boolean; forceConsistentCasingInFileNames?: boolean; [option: string]: string | number | boolean; } - const enum ModuleKind { + enum ModuleKind { None = 0, CommonJS = 1, AMD = 2, @@ -1364,12 +1375,12 @@ declare namespace ts { ES6 = 5, ES2015 = 5, } - const enum JsxEmit { + enum JsxEmit { None = 0, Preserve = 1, React = 2, } - const enum NewLineKind { + enum NewLineKind { CarriageReturnLineFeed = 0, LineFeed = 1, } @@ -1377,14 +1388,14 @@ declare namespace ts { line: number; character: number; } - const enum ScriptTarget { + enum ScriptTarget { ES3 = 0, ES5 = 1, ES6 = 2, ES2015 = 2, Latest = 2, } - const enum LanguageVariant { + enum LanguageVariant { Standard = 0, JSX = 1, } @@ -1938,7 +1949,7 @@ declare namespace ts { outputFiles: OutputFile[]; emitSkipped: boolean; } - const enum OutputFileType { + enum OutputFileType { JavaScript = 0, SourceMap = 1, Declaration = 2, @@ -1948,7 +1959,7 @@ declare namespace ts { writeByteOrderMark: boolean; text: string; } - const enum EndOfLineState { + enum EndOfLineState { None = 0, InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, @@ -2116,7 +2127,7 @@ declare namespace ts { static parameterName: string; static docCommentTagName: string; } - const enum ClassificationType { + enum ClassificationType { comment = 1, identifier = 2, keyword = 3, @@ -2159,7 +2170,7 @@ declare namespace ts { let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; diff --git a/lib/typescript.js b/lib/typescript.js index 1e0c0edad05..8b0ef04f96e 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -350,27 +350,30 @@ var ts; var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { NodeFlags[NodeFlags["None"] = 0] = "None"; - NodeFlags[NodeFlags["Export"] = 1] = "Export"; - NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; - NodeFlags[NodeFlags["Public"] = 16] = "Public"; - NodeFlags[NodeFlags["Private"] = 32] = "Private"; - NodeFlags[NodeFlags["Protected"] = 64] = "Protected"; - NodeFlags[NodeFlags["Static"] = 128] = "Static"; - NodeFlags[NodeFlags["Abstract"] = 256] = "Abstract"; - NodeFlags[NodeFlags["Async"] = 512] = "Async"; - NodeFlags[NodeFlags["Default"] = 1024] = "Default"; - NodeFlags[NodeFlags["MultiLine"] = 2048] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 4096] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 8192] = "DeclarationFile"; - NodeFlags[NodeFlags["Let"] = 16384] = "Let"; - NodeFlags[NodeFlags["Const"] = 32768] = "Const"; - NodeFlags[NodeFlags["OctalLiteral"] = 65536] = "OctalLiteral"; - NodeFlags[NodeFlags["Namespace"] = 131072] = "Namespace"; - NodeFlags[NodeFlags["ExportContext"] = 262144] = "ExportContext"; - NodeFlags[NodeFlags["ContainsThis"] = 524288] = "ContainsThis"; - NodeFlags[NodeFlags["Modifier"] = 2035] = "Modifier"; - NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; - NodeFlags[NodeFlags["BlockScoped"] = 49152] = "BlockScoped"; + NodeFlags[NodeFlags["Export"] = 2] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 4] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 8] = "Public"; + NodeFlags[NodeFlags["Private"] = 16] = "Private"; + NodeFlags[NodeFlags["Protected"] = 32] = "Protected"; + NodeFlags[NodeFlags["Static"] = 64] = "Static"; + NodeFlags[NodeFlags["Abstract"] = 128] = "Abstract"; + NodeFlags[NodeFlags["Async"] = 256] = "Async"; + NodeFlags[NodeFlags["Default"] = 512] = "Default"; + NodeFlags[NodeFlags["MultiLine"] = 1024] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 2048] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 4096] = "DeclarationFile"; + NodeFlags[NodeFlags["Let"] = 8192] = "Let"; + NodeFlags[NodeFlags["Const"] = 16384] = "Const"; + NodeFlags[NodeFlags["OctalLiteral"] = 32768] = "OctalLiteral"; + NodeFlags[NodeFlags["Namespace"] = 65536] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 131072] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 262144] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 524288] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 1048576] = "HasExplicitReturn"; + NodeFlags[NodeFlags["Modifier"] = 1022] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 56] = "AccessibilityModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 24576] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 1572864] = "ReachabilityCheckFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; /* @internal */ @@ -690,6 +693,12 @@ var ts; })(ts.LanguageVariant || (ts.LanguageVariant = {})); var LanguageVariant = ts.LanguageVariant; /* @internal */ + (function (DiagnosticStyle) { + DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple"; + DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty"; + })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); + var DiagnosticStyle = ts.DiagnosticStyle; + /* @internal */ (function (CharacterCodes) { CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; @@ -838,40 +847,50 @@ var ts; Ternary[Ternary["True"] = -1] = "True"; })(ts.Ternary || (ts.Ternary = {})); var Ternary = ts.Ternary; - function createFileMap(getCanonicalFileName) { + function createFileMap(keyMapper) { var files = {}; return { get: get, set: set, contains: contains, remove: remove, - clear: clear, - forEachValue: forEachValueInMap + forEachValue: forEachValueInMap, + clear: clear }; - function set(fileName, value) { - files[normalizeKey(fileName)] = value; - } - function get(fileName) { - return files[normalizeKey(fileName)]; - } - function contains(fileName) { - return hasProperty(files, normalizeKey(fileName)); - } - function remove(fileName) { - var key = normalizeKey(fileName); - delete files[key]; - } function forEachValueInMap(f) { - forEachValue(files, f); + for (var key in files) { + f(key, files[key]); + } } - function normalizeKey(key) { - return getCanonicalFileName(normalizeSlashes(key)); + // path should already be well-formed so it does not need to be normalized + function get(path) { + return files[toKey(path)]; + } + function set(path, value) { + files[toKey(path)] = value; + } + function contains(path) { + return hasProperty(files, toKey(path)); + } + function remove(path) { + var key = toKey(path); + delete files[key]; } function clear() { files = {}; } + function toKey(path) { + return keyMapper ? keyMapper(path) : path; + } } ts.createFileMap = createFileMap; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) + ? normalizePath(fileName) + : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts.toPath = toPath; (function (Comparison) { Comparison[Comparison["LessThan"] = -1] = "LessThan"; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; @@ -897,8 +916,8 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; if (v === value) { return true; } @@ -921,8 +940,8 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; if (predicate(v)) { count++; } @@ -935,8 +954,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; if (f(item)) { result.push(item); } @@ -949,8 +968,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; result.push(f(v)); } } @@ -969,8 +988,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; if (!contains(result, item)) { result.push(item); } @@ -981,8 +1000,8 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; result += v[prop]; } return result; @@ -990,8 +1009,8 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0; _i < from.length; _i++) { - var v = from[_i]; + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; to.push(v); } } @@ -1341,8 +1360,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { - var part = parts[_i]; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); @@ -1521,8 +1540,8 @@ var ts; if (!fileName) { return false; } - for (var _i = 0; _i < ts.supportedExtensions.length; _i++) { - var extension = ts.supportedExtensions[_i]; + for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -1532,8 +1551,8 @@ var ts; ts.isSupportedSourceFileName = isSupportedSourceFileName; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { - for (var _i = 0; _i < extensionsToRemove.length; _i++) { - var ext = extensionsToRemove[_i]; + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1614,8 +1633,8 @@ var ts; })(Debug = ts.Debug || (ts.Debug = {})); function copyListRemovingItem(item, list) { var copiedList = []; - for (var _i = 0; _i < list.length; _i++) { - var e = list[_i]; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var e = list_1[_i]; if (e !== item) { copiedList.push(e); } @@ -1709,16 +1728,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; var name_1 = ts.combinePaths(path, current); if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) { result.push(name_1); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _a = 0, subfolders_1 = subfolders; _a < subfolders_1.length; _a++) { + var current = subfolders_1[_a]; var name_2 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_2))) { visitDirectory(name_2); @@ -1769,6 +1788,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _tty = require("tty"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond function createWatchedFileSet(interval, chunkSize) { @@ -1906,8 +1926,8 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1921,8 +1941,8 @@ var ts; } } } - for (var _a = 0; _a < directories.length; _a++) { - var current = directories[_a]; + for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { + var current = directories_1[_a]; visitDirectory(current); } } @@ -1932,15 +1952,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, "utf8"); - var offset = 0; - var toWrite = buffer.length; - var written = 0; - // 1 is a standard descriptor for stdout - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } + process.stdout.write(s); }, readFile: readFile, writeFile: writeFile, @@ -2223,6 +2235,7 @@ var ts; await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, + The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2275,7 +2288,7 @@ var ts; Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_th_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "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: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, @@ -2296,7 +2309,7 @@ var ts; Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement_2378", message: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, @@ -2586,8 +2599,6 @@ var ts; NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, @@ -2595,7 +2606,14 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Disallow_inconsistently_cased_references_to_the_same_file: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6073", message: "Disallow inconsistently-cased references to the same file." }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, + Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, + Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, + Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, + Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2613,6 +2631,10 @@ var ts; 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: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "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." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, + Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, + Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, + Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -4166,6 +4188,20 @@ var ts; ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; + var Reachability; + (function (Reachability) { + Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; + Reachability[Reachability["Reachable"] = 2] = "Reachable"; + Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; + Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; + })(Reachability || (Reachability = {})); + function or(state1, state2) { + return (state1 | state2) & 2 /* Reachable */ + ? 2 /* Reachable */ + : (state1 & state2) & 8 /* ReportedUnreachable */ + ? 8 /* ReportedUnreachable */ + : 4 /* Unreachable */; + } function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations @@ -4175,7 +4211,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { return 0 /* NonInstantiated */; } else if (node.kind === 219 /* ModuleBlock */) { @@ -4226,31 +4262,56 @@ var ts; // Functions, Methods, Modules, Source-files. ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; })(ContainerFlags || (ContainerFlags = {})); - function bindSourceFile(file) { + var binder = createBinder(); + function bindSourceFile(file, options) { var start = new Date().getTime(); - bindSourceFileWorker(file); + binder(file, options); ts.bindTime += new Date().getTime() - start; } ts.bindSourceFile = bindSourceFile; - function bindSourceFileWorker(file) { + function createBinder() { + var file; + var options; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; + // state used by reachability checks + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). - var inStrictMode = !!file.externalModuleIndicator; + var inStrictMode; var symbolCount = 0; - var Symbol = ts.objectAllocator.getSymbolConstructor(); - var classifiableNames = {}; - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } - return; + return bindSourceFile; function createSymbol(flags, name) { symbolCount++; return new Symbol(flags, name); @@ -4303,7 +4364,7 @@ var ts; return node.isExportEquals ? "export=" : "default"; case 213 /* FunctionDeclaration */: case 214 /* ClassDeclaration */: - return node.flags & 1024 /* Default */ ? "default" : undefined; + return node.flags & 512 /* Default */ ? "default" : undefined; } } function getDisplayName(node) { @@ -4319,7 +4380,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 1024 /* Default */; + var isDefaultExport = node.flags & 512 /* Default */; // The exported symbol for an export default function/class node is always named "default" var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; @@ -4358,7 +4419,7 @@ var ts; ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 1024 /* Default */) { + if (declaration.flags & 512 /* Default */) { message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); @@ -4377,7 +4438,7 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; if (symbolFlags & 8388608 /* Alias */) { if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); @@ -4398,7 +4459,7 @@ var ts; // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 262144 /* ExportContext */) { + if (hasExportModifier || container.flags & 131072 /* ExportContext */) { var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -4453,18 +4514,229 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - if (node.kind === 215 /* InterfaceDeclaration */) { + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + // reset all reachability check related flags on node (for incremental scenarios) + flags &= ~1572864 /* ReachabilityCheckFlags */; + if (kind === 215 /* InterfaceDeclaration */) { seenThisKeyword = false; - ts.forEachChild(node, bind); - node.flags = seenThisKeyword ? node.flags | 524288 /* ContainsThis */ : node.flags & ~524288 /* ContainsThis */; } - else { - ts.forEachChild(node, bind); + var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2 /* Reachable */; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288 /* HasImplicitReturn */; + if (hasExplicitReturn) { + flags |= 1048576 /* HasExplicitReturn */; + } + } + if (kind === 215 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } + /** + * Returns true if node and its subnodes were successfully traversed. + * Returning false means that node was not examined and caller needs to dive into the node himself. + */ + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198 /* WhileStatement */: + bindWhileStatement(node); + break; + case 197 /* DoStatement */: + bindDoStatement(node); + break; + case 199 /* ForStatement */: + bindForStatement(node); + break; + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + bindForInOrForOfStatement(node); + break; + case 196 /* IfStatement */: + bindIfStatement(node); + break; + case 204 /* ReturnStatement */: + case 208 /* ThrowStatement */: + bindReturnOrThrow(node); + break; + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + bindBreakOrContinueStatement(node); + break; + case 209 /* TryStatement */: + bindTryStatement(node); + break; + case 206 /* SwitchStatement */: + bindSwitchStatement(node); + break; + case 220 /* CaseBlock */: + bindCaseBlock(node); + break; + case 207 /* LabeledStatement */: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // bind expressions (don't affect reachability) + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; + popImplicitLabel(postDoLabel, postDoState); + // bind expressions (don't affect reachability) + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + // for statement is considered infinite when it condition is either omitted or is true keyword + // - for(..;;..) + // - for(..;true;..) + var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); + var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + // denotes reachability state when entering 'thenStatement' part of the if statement: + // i.e. if condition is false then thenStatement is unreachable + var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // denotes reachability state when entering 'elseStatement': + // i.e. if condition is true then elseStatement is unreachable + var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + currentReachabilityState = ifTrueState; + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + // bind expression (don't affect reachability) + bind(n.expression); + if (n.kind === 204 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentReachabilityState = 4 /* Unreachable */; + } + function bindBreakOrContinueStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + // for continue case touch label so it will be marked a used + var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + if (isValidJump) { + currentReachabilityState = 4 /* Unreachable */; + } + } + function bindTryStatement(n) { + // catch\finally blocks has the same reachability as try block + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + // post catch/finally state is reachable if + // - post try state is reachable - control flow can fall out of try block + // - post catch state is reachable - control flow can fall out of catch block + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); + // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case + var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } function getContainerFlags(node) { switch (node.kind) { case 186 /* ClassExpression */: @@ -4576,7 +4848,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 128 /* Static */ + return node.flags & 64 /* Static */ ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -4585,15 +4857,6 @@ var ts; ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } - function isAmbientContext(node) { - while (node) { - if (node.flags & 2 /* Ambient */) { - return true; - } - node = node.parent; - } - return false; - } function hasExportDeclarations(node) { var body = node.kind === 248 /* SourceFile */ ? node : node.body; if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { @@ -4609,11 +4872,11 @@ var ts; function setExportContextFlag(node) { // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. - if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 262144 /* ExportContext */; + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072 /* ExportContext */; } else { - node.flags &= ~262144 /* ExportContext */; + node.flags &= ~131072 /* ExportContext */; } } function bindModuleDeclaration(node) { @@ -4805,7 +5068,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 65536 /* OctalLiteral */) { + if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -4829,10 +5092,10 @@ var ts; function checkStrictModeWithStatement(node) { // Grammar checking for withStatement if (inStrictMode) { - grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } - function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + function errorOnFirstToken(node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } @@ -4840,6 +5103,9 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { + if (!node) { + return; + } node.parent = parent; var savedInStrictMode = inStrictMode; if (!savedInStrictMode) { @@ -4882,8 +5148,8 @@ var ts; } } function updateStrictModeStatementList(statements) { - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -5105,7 +5371,7 @@ var ts; } // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (node.flags & 112 /* AccessibilityModifier */ && + if (node.flags & 56 /* AccessibilityModifier */ && node.parent.kind === 144 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; @@ -5117,6 +5383,112 @@ var ts; ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } + // reachability checks + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1 /* Unintialized */) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1 /* Unintialized */) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + // reference to unknown label or + // break/continue used outside of loops + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4 /* Unreachable */: + var reportError = + // report error on all statements + ts.isStatement(node) || + // report error on class declarations + node.kind === 214 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8 /* ReportedUnreachable */; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8 /* ReportedUnreachable */: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2 /* Reachable */; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } } })(ts || (ts = {})); /// @@ -5127,8 +5499,8 @@ var ts; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; if (declaration.kind === kind) { return declaration; } @@ -5328,7 +5700,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 49152 /* BlockScoped */) !== 0 || + return (getCombinedNodeFlags(declaration) & 24576 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; @@ -5441,7 +5813,7 @@ var ts; } ts.isExternalModule = isExternalModule; function isDeclarationFile(file) { - return (file.flags & 8192 /* DeclarationFile */) !== 0; + return (file.flags & 4096 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { @@ -5478,11 +5850,11 @@ var ts; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 32768 /* Const */); + return !!(getCombinedNodeFlags(node) & 16384 /* Const */); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 16384 /* Let */); + return !!(getCombinedNodeFlags(node) & 8192 /* Let */); } ts.isLet = isLet; function isPrologueDirective(node) { @@ -5683,27 +6055,28 @@ var ts; } ts.isClassLike = isClassLike; function isFunctionLike(node) { - if (node) { - switch (node.kind) { - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - return true; - } - } - return false; + return node && isFunctionLikeKind(node.kind); } ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + return true; + } + } + ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { case 143 /* MethodDeclaration */: @@ -6206,9 +6579,18 @@ var ts; return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 /* Ambient */ | 8192 /* DeclarationFile */)) { + if (node.flags & (4 /* Ambient */ | 4096 /* DeclarationFile */)) { return true; } node = node.parent; @@ -6266,7 +6648,7 @@ var ts; case 207 /* LabeledStatement */: case 204 /* ReturnStatement */: case 206 /* SwitchStatement */: - case 98 /* ThrowKeyword */: + case 208 /* ThrowStatement */: case 209 /* TryStatement */: case 193 /* VariableStatement */: case 198 /* WhileStatement */: @@ -6379,8 +6761,8 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { - var clause = clauses[_i]; + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; if (clause.token === kind) { return clause; } @@ -6392,7 +6774,6 @@ var ts; function tryResolveScriptReference(host, sourceFile, reference) { if (!host.getCompilerOptions().noResolve) { var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); - referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } } @@ -6450,7 +6831,7 @@ var ts; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { - return isFunctionLike(node) && (node.flags & 512 /* Async */) !== 0 && !isAccessor(node); + return isFunctionLike(node) && (node.flags & 256 /* Async */) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; /** @@ -6837,7 +7218,7 @@ var ts; else { ts.forEach(declarations, function (member) { if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) - && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -6894,6 +7275,66 @@ var ts; }); } ts.emitComments = emitComments; + /** + * Detached comment is a comment at the top of file or function body that is separated from + * the next statement by space. + */ + function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + // There was a blank line between the last comment and this comment. This + // comment is not part of the copyright comments. Return what we have so + // far. + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + // All comments look like they could have been part of the copyright header. Make + // sure there is at least one blank line between it and the node. If not, it's not + // a copyright header. + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + // Valid detachedComments + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + } + ts.emitDetachedComments = emitDetachedComments; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); @@ -6983,16 +7424,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 113 /* StaticKeyword */: return 128 /* Static */; - case 112 /* PublicKeyword */: return 16 /* Public */; - case 111 /* ProtectedKeyword */: return 64 /* Protected */; - case 110 /* PrivateKeyword */: return 32 /* Private */; - case 115 /* AbstractKeyword */: return 256 /* Abstract */; - case 82 /* ExportKeyword */: return 1 /* Export */; - case 122 /* DeclareKeyword */: return 2 /* Ambient */; - case 74 /* ConstKeyword */: return 32768 /* Const */; - case 77 /* DefaultKeyword */: return 1024 /* Default */; - case 118 /* AsyncKeyword */: return 512 /* Async */; + case 113 /* StaticKeyword */: return 64 /* Static */; + case 112 /* PublicKeyword */: return 8 /* Public */; + case 111 /* ProtectedKeyword */: return 32 /* Protected */; + case 110 /* PrivateKeyword */: return 16 /* Private */; + case 115 /* AbstractKeyword */: return 128 /* Abstract */; + case 82 /* ExportKeyword */: return 2 /* Export */; + case 122 /* DeclareKeyword */: return 4 /* Ambient */; + case 74 /* ConstKeyword */: return 16384 /* Const */; + case 77 /* DefaultKeyword */: return 512 /* Default */; + case 118 /* AsyncKeyword */: return 256 /* Async */; } return 0; } @@ -7073,7 +7514,7 @@ var ts; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isJavaScript(fileName) { @@ -7150,6 +7591,12 @@ var ts; return result; } ts.convertToBase64 = convertToBase64; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !ts.isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /* isAbsolutePathAnUrl */ false); + } + ts.convertToRelativePath = convertToRelativePath; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function getNewLineCharacter(options) { @@ -7414,8 +7861,8 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; var result = cbNode(node); if (result) { return result; @@ -7982,8 +8429,8 @@ var ts; function addJSDocComment(node) { var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); if (comments) { - for (var _i = 0; _i < comments.length; _i++) { - var comment = comments[_i]; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); if (jsDocComment) { node.jsDocComment = jsDocComment; @@ -8021,7 +8468,7 @@ var ts; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 8192 /* DeclarationFile */ : 0; + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; return sourceFile; } @@ -9079,7 +9526,7 @@ var ts; if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 65536 /* OctalLiteral */; + node.flags |= 32768 /* OctalLiteral */; } return node; } @@ -9832,7 +10279,7 @@ var ts; // Didn't appear to actually be a parenthesized arrow function. Just bail out. return undefined; } - var isAsync = !!(arrowFunction.flags & 512 /* Async */); + var isAsync = !!(arrowFunction.flags & 256 /* Async */); // 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. var lastToken = token; @@ -9959,7 +10406,7 @@ var ts; function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNode(174 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -10802,7 +11249,7 @@ var ts; var node = createNode(164 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) - node.flags |= 2048 /* MultiLine */; + node.flags |= 1024 /* MultiLine */; node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); parseExpected(20 /* CloseBracketToken */); return finishNode(node); @@ -10863,7 +11310,7 @@ var ts; var node = createNode(165 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 2048 /* MultiLine */; + node.flags |= 1024 /* MultiLine */; } node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); parseExpected(16 /* CloseBraceToken */); @@ -10884,7 +11331,7 @@ var ts; parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : @@ -11476,10 +11923,10 @@ var ts; case 102 /* VarKeyword */: break; case 108 /* LetKeyword */: - node.flags |= 16384 /* Let */; + node.flags |= 8192 /* Let */; break; case 74 /* ConstKeyword */: - node.flags |= 32768 /* Const */; + node.flags |= 16384 /* Const */; break; default: ts.Debug.fail(); @@ -11522,9 +11969,9 @@ var ts; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); - node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); + node.name = node.flags & 512 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); @@ -11546,7 +11993,7 @@ var ts; method.name = name; method.questionToken = questionToken; var isGenerator = !!asteriskToken; - var isAsync = !!(method.flags & 512 /* Async */); + var isAsync = !!(method.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); @@ -11567,7 +12014,7 @@ var ts; // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield]; // // The checker may still error in the static case to explicitly disallow the yield expression. - property.initializer = modifiers && modifiers.flags & 128 /* Static */ + property.initializer = modifiers && modifiers.flags & 64 /* Static */ ? allowInAnd(parseNonParameterInitializer) : doOutsideOfContext(2 /* Yield */ | 1 /* DisallowIn */, parseNonParameterInitializer); parseSemicolon(); @@ -11900,13 +12347,13 @@ var ts; var node = createNode(218 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. - var namespaceFlag = flags & 131072 /* Namespace */; + var namespaceFlag = flags & 65536 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 2 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -11921,7 +12368,7 @@ var ts; function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; if (parseOptional(126 /* NamespaceKeyword */)) { - flags |= 131072 /* Namespace */; + flags |= 65536 /* Namespace */; } else { parseExpected(125 /* ModuleKeyword */); @@ -12179,7 +12626,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 /* Export */ + return node.flags & 2 /* Export */ || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ || node.kind === 222 /* ImportDeclaration */ || node.kind === 227 /* ExportAssignment */ @@ -12868,8 +13315,8 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var node = array_7[_i]; visitNode(node); } } @@ -13006,8 +13453,8 @@ var ts; array._children = undefined; // Adjust the pos or end (or both) of the intersecting array accordingly. adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; visitNode(node); } return; @@ -13374,6 +13821,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var jsxElementClassType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -13643,7 +14091,7 @@ var ts; } var initializerOfNonStaticProperty = current.parent && current.parent.kind === 141 /* PropertyDeclaration */ && - (current.parent.flags & 128 /* Static */) === 0 && + (current.parent.flags & 64 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -13725,7 +14173,7 @@ var ts; // 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. - if (ts.isClassLike(location.parent) && !(location.flags & 128 /* Static */)) { + if (ts.isClassLike(location.parent) && !(location.flags & 64 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -13739,7 +14187,7 @@ var ts; case 186 /* ClassExpression */: case 215 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { - if (lastLocation && lastLocation.flags & 128 /* Static */) { + if (lastLocation && lastLocation.flags & 64 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // 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. @@ -14267,8 +14715,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { - var member = members[_i]; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } @@ -14515,7 +14963,7 @@ var ts; // because these kind of aliases can be used to name types in declaration file var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 1 /* Export */) && + !(anyImportSyntax.flags & 2 /* Export */) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -14669,8 +15117,8 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { - var accessibleSymbol = accessibleSymbolChain[_i]; + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } @@ -14860,7 +15308,7 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { @@ -14971,8 +15419,8 @@ var ts; var t = getTypeOfSymbol(p); if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); - for (var _f = 0; _f < signatures.length; _f++) { - var signature = signatures[_f]; + for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { + var signature = signatures_1[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { writePunctuation(writer, 53 /* QuestionToken */); @@ -15186,7 +15634,7 @@ var ts; case 221 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) - if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && + if (!(ts.getCombinedNodeFlags(node) & 2 /* Export */) && !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } @@ -15198,7 +15646,7 @@ var ts; case 146 /* SetAccessor */: case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.flags & (32 /* Private */ | 64 /* Protected */)) { + if (node.flags & (16 /* Private */ | 32 /* Protected */)) { // Private/protected properties/methods are not visible return false; } @@ -15728,8 +16176,8 @@ var ts; // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set // in-place and returns the same array. function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -15934,13 +16382,13 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.kind === 215 /* InterfaceDeclaration */) { - if (declaration.flags & 524288 /* ContainsThis */) { + if (declaration.flags & 262144 /* ContainsThis */) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); if (baseTypeNodes) { - for (var _b = 0; _b < baseTypeNodes.length; _b++) { - var node = baseTypeNodes[_b]; + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; if (ts.isSupportedExpressionWithTypeArguments(node)) { var baseSymbol = resolveEntityName(node.expression, 793056 /* Type */, /*ignoreErrors*/ true); if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { @@ -16130,8 +16578,8 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; result[symbol.name] = symbol; } return result; @@ -16140,15 +16588,15 @@ var ts; // we check symbols to see if we can quickly conclude they are free of "this" references, thus needing no instantiation. function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { - var s = baseSymbols[_i]; + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -16156,8 +16604,8 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { - var signature = baseSignatures[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var signature = baseSignatures_1[_i]; signatures.push(signature); } } @@ -16200,8 +16648,8 @@ var ts; members = createSymbolTable(source.declaredProperties); } var thisArgument = ts.lastOrUndefined(typeArguments); - for (var _i = 0; _i < baseTypes.length; _i++) { - var baseType = baseTypes[_i]; + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); @@ -16247,8 +16695,8 @@ var ts; var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0; _i < baseSignatures.length; _i++) { - var baseSig = baseSignatures[_i]; + for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { + var baseSig = baseSignatures_2[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -16277,8 +16725,8 @@ var ts; setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { - for (var _i = 0; _i < signatureList.length; _i++) { - var s = signatureList[_i]; + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } @@ -16342,8 +16790,8 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type = types_1[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; @@ -16522,12 +16970,12 @@ var ts; function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (32 /* Private */ | 64 /* Protected */))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 /* Private */ | 32 /* Protected */))) { if (!props) { props = [prop]; } @@ -16549,8 +16997,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var prop = props[_a]; + for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { + var prop = props_1[_a]; if (prop.declarations) { ts.addRange(declarations, prop.declarations); } @@ -16908,8 +17356,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type = types_3[_i]; result |= type.flags; } return result & 14680064 /* PropagatingFlags */; @@ -17059,8 +17507,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; switch (declaration.kind) { case 214 /* ClassDeclaration */: case 215 /* InterfaceDeclaration */: @@ -17170,8 +17618,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToSet(typeSet, types, typeSetKind) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; addTypeToSet(typeSet, type, typeSetKind); } } @@ -17193,8 +17641,8 @@ var ts; } } function containsTypeAny(types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (isTypeAny(type)) { return true; } @@ -17310,7 +17758,8 @@ var ts; var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { - if (!(container.flags & 128 /* Static */)) { + if (!(container.flags & 64 /* Static */) && + (container.kind !== 144 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -17377,8 +17826,8 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { - var v = items[_i]; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var v = items_1[_i]; result.push(instantiator(v, mapper)); } return result; @@ -17417,8 +17866,8 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { - var source = sources[_i]; + for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { + var source = sources_1[_i]; if (t === source) { return anyType; } @@ -17836,8 +18285,8 @@ var ts; function eachTypeRelatedToSomeType(source, target) { var result = -1 /* True */; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; var related = typeRelatedToSomeType(sourceType, target, false); if (!related) { return 0 /* False */; @@ -17859,8 +18308,8 @@ var ts; function typeRelatedToEachType(source, target, reportErrors) { var result = -1 /* True */; var targetTypes = target.types; - for (var _i = 0; _i < targetTypes.length; _i++) { - var targetType = targetTypes[_i]; + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var targetType = targetTypes_1[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0 /* False */; @@ -17882,8 +18331,8 @@ var ts; function eachTypeRelatedToType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { + var sourceType = sourceTypes_2[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0 /* False */; @@ -18008,8 +18457,8 @@ var ts; var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 524288 /* ObjectLiteral */); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var targetProp = properties_1[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -18023,20 +18472,20 @@ var ts; else if (!(targetProp.flags & 134217728 /* Prototype */)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 32 /* Private */ || targetPropFlags & 32 /* Private */) { + if (sourcePropFlags & 16 /* Private */ || targetPropFlags & 16 /* Private */) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 32 /* Private */ && targetPropFlags & 32 /* Private */) { + if (sourcePropFlags & 16 /* Private */ && targetPropFlags & 16 /* 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(sourcePropFlags & 32 /* Private */ ? source : target), typeToString(sourcePropFlags & 32 /* Private */ ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 /* Private */ ? source : target), typeToString(sourcePropFlags & 16 /* Private */ ? target : source)); } } return 0 /* False */; } } - else if (targetPropFlags & 64 /* Protected */) { + else if (targetPropFlags & 32 /* Protected */) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); @@ -18047,7 +18496,7 @@ var ts; return 0 /* False */; } } - else if (sourcePropFlags & 64 /* Protected */) { + else if (sourcePropFlags & 32 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -18089,8 +18538,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0 /* False */; @@ -18130,13 +18579,13 @@ var ts; return result; } } - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { - var t = targetSignatures[_i]; + outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) { var localErrors = reportErrors; var checkedAbstractAssignability = false; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -18167,8 +18616,8 @@ var ts; var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128 /* Abstract */; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128 /* Abstract */; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. if (reportErrors) { @@ -18284,7 +18733,7 @@ var ts; var targetType = getIndexTypeOfType(target, 0 /* String */); if (targetType) { if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg + // non-primitive assignment to any is always allowed, eg // `var x: { [index: string]: any } = { property: 12 };` return -1 /* True */; } @@ -18313,7 +18762,7 @@ var ts; var targetType = getIndexTypeOfType(target, 1 /* Number */); if (targetType) { if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg + // non-primitive assignment to any is always allowed, eg // `var x: { [index: number]: any } = { property: 12 };` return -1 /* True */; } @@ -18386,8 +18835,8 @@ var ts; if (sourceProp === targetProp) { return -1 /* True */; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 /* Private */ | 32 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 /* Private */ | 32 /* Protected */); if (sourcePropAccessibility !== targetPropAccessibility) { return 0 /* False */; } @@ -18455,8 +18904,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } @@ -18692,8 +19141,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { - var unused = typeParameters[_i]; + for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { + var unused = typeParameters_1[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); @@ -18774,8 +19223,8 @@ var ts; var typeParameterCount = 0; var typeParameter; // First infer to each type in union or intersection that isn't a type parameter - for (var _i = 0; _i < targetTypes.length; _i++) { - var t = targetTypes[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var t = targetTypes_2[_i]; if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -18797,8 +19246,8 @@ var ts; else if (source.flags & 49152 /* UnionOrIntersection */) { // Source is a union or intersection type, infer from each consituent type var sourceTypes = source.types; - for (var _a = 0; _a < sourceTypes.length; _a++) { - var sourceType = sourceTypes[_a]; + for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { + var sourceType = sourceTypes_3[_a]; inferFromTypes(sourceType, target); } } @@ -18832,8 +19281,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var targetProp = properties_2[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -19324,9 +19773,9 @@ var ts; symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { return; } - // 1. walk from the use site up to the declaration and check + // 1. walk from the use site up to the declaration and check // if there is anything function like between declaration and use-site (is binding/class is captured in function). - // 2. walk from the declaration up to the boundary of lexical environment and check + // 2. walk from the declaration up to the boundary of lexical environment and check // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement) var container; if (symbol.flags & 32 /* Class */) { @@ -19398,7 +19847,7 @@ var ts; break; case 141 /* PropertyDeclaration */: case 140 /* PropertySignature */: - if (container.flags & 128 /* Static */) { + if (container.flags & 64 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -19411,7 +19860,7 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } @@ -19441,7 +19890,7 @@ var ts; var nodeCheckFlag = 0; // always set NodeCheckFlags for 'super' expression node if (canUseSuperExpression) { - if ((container.flags & 128 /* Static */) || isCallExpression) { + if ((container.flags & 64 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } else { @@ -19497,7 +19946,7 @@ var ts; // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { - if (container.flags & 128 /* Static */) { + if (container.flags & 64 /* Static */) { return container.kind === 143 /* MethodDeclaration */ || container.kind === 142 /* MethodSignature */ || container.kind === 145 /* GetAccessor */ || @@ -19654,8 +20103,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var current = types_7[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -19845,8 +20294,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { @@ -19926,8 +20375,8 @@ var ts; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); - for (var _i = 0; _i < elements.length; _i++) { - var e = elements[_i]; + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var e = elements_1[_i]; if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; @@ -20259,8 +20708,8 @@ var ts; function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { var type = checkExpression(node.expression); var props = getPropertiesOfType(type); - for (var _i = 0; _i < props.length; _i++) { - var prop = props[_i]; + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; // Is there a corresponding property in the element attributes type? Skip checking of properties // that have already been assigned to, as these are not actually pushed into the resulting type if (!nameTable[prop.name]) { @@ -20479,7 +20928,6 @@ var ts; var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } - var jsxElementClassType = undefined; function getJsxGlobalElementClassType() { if (!jsxElementClassType) { jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); @@ -20558,7 +21006,7 @@ var ts; return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 8 /* Public */ | 64 /* Static */ : 0; } /** * Check whether the requested property access is valid. @@ -20588,7 +21036,7 @@ var ts; error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -20598,7 +21046,7 @@ var ts; } } // Public properties are otherwise accessible. - if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + if (!(flags & (16 /* Private */ | 32 /* Protected */))) { return true; } // Property is known to be private or protected at this point @@ -20606,7 +21054,7 @@ var ts; var enclosingClassDeclaration = ts.getContainingClass(node); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; // Private property is accessible if declaring and enclosing class are the same - if (flags & 32 /* Private */) { + if (flags & 16 /* Private */) { if (declaringClass !== enclosingClass) { error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; @@ -20624,7 +21072,7 @@ var ts; return false; } // No further restrictions for static properties - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return true; } // An instance property must be accessed through an instance of the enclosing class @@ -20851,8 +21299,8 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { - var signature = signatures[_i]; + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { @@ -21494,8 +21942,8 @@ var ts; // declare function f(a: { xa: number; xb: number; }); // f({ | if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { - var candidate = candidates[_i]; + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; if (hasCorrectArity(node, args, candidate)) { if (candidate.typeParameters && typeArguments) { candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); @@ -21514,8 +21962,8 @@ var ts; diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); } function chooseOverload(candidates, relation) { - for (var _i = 0; _i < candidates.length; _i++) { - var originalCandidate = candidates[_i]; + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var originalCandidate = candidates_2[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } @@ -21652,7 +22100,7 @@ var ts; // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && valueDecl.flags & 256 /* Abstract */) { + if (valueDecl && valueDecl.flags & 128 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); } @@ -22017,19 +22465,11 @@ var ts; }); return aggregatedTypes; } - function bodyContainsAReturnStatement(funcBody) { - return ts.forEachReturnStatement(funcBody, function (returnStatement) { - return true; - }); - } - function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 208 /* ThrowStatement */); - } // TypeScript Specification 1.0 (6.3) - July 2014 // 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. - function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } @@ -22038,22 +22478,19 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */) { + // also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */ || !(func.flags & 524288 /* HasImplicitReturn */)) { return; } - var bodyBlock = func.body; - // Ensure the body has at least one return expression. - if (bodyContainsAReturnStatement(bodyBlock)) { - return; + if (func.flags & 1048576 /* HasExplicitReturn */) { + if (compilerOptions.noImplicitReturns) { + error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } - // If there are no return expressions, then we need to check if - // the function body consists solely of a throw statement; - // this is to make an exception for unimplemented functions. - if (bodyContainsSingleThrowStatement(bodyBlock)) { - return; + else { + // This function does not conform to the specification. + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } - // This function does not conform to the specification. - error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); @@ -22120,7 +22557,7 @@ var ts; promisedType = checkAsyncFunctionReturnType(node); } if (returnType && !node.asteriskToken) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (node.body) { if (!node.type) { @@ -22205,7 +22642,7 @@ var ts; case 69 /* Identifier */: case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); - return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; + return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384 /* Const */) !== 0; } case 167 /* ElementAccessExpression */: { var index = n.argumentExpression; @@ -22213,7 +22650,7 @@ var ts; if (symbol && index && index.kind === 9 /* StringLiteral */) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768 /* Const */) !== 0; + return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384 /* Const */) !== 0; } return false; } @@ -22298,8 +22735,8 @@ var ts; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; if (current.flags & kind) { return true; } @@ -22315,8 +22752,8 @@ var ts; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var current = types_10[_i]; if (!(current.flags & kind)) { return false; } @@ -22361,8 +22798,8 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { - var p = properties[_i]; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var p = properties_3[_i]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; @@ -22896,7 +23333,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 112 /* AccessibilityModifier */) { + if (node.flags & 56 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -23096,7 +23533,7 @@ var ts; checkFunctionLikeDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. - if (node.flags & 256 /* Abstract */ && node.body) { + if (node.flags & 128 /* Abstract */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -23147,7 +23584,7 @@ var ts; } function isInstancePropertyWithInitializer(n) { return n.kind === 141 /* PropertyDeclaration */ && - !(n.flags & 128 /* Static */) && + !(n.flags & 64 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 @@ -23168,14 +23605,14 @@ var ts; // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + ts.forEach(node.parameters, function (p) { return p.flags & (8 /* Public */ | 16 /* Private */ | 32 /* Protected */); }); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement; - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; @@ -23203,8 +23640,15 @@ var ts; // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); if (node.kind === 145 /* GetAccessor */) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(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); + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288 /* HasImplicitReturn */)) { + if (node.flags & 1048576 /* HasExplicitReturn */) { + if (compilerOptions.noImplicitReturns) { + error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); + } } } if (!ts.hasDynamicName(node)) { @@ -23213,7 +23657,7 @@ var ts; var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { + if (((node.flags & 56 /* AccessibilityModifier */) !== (otherAccessor.flags & 56 /* AccessibilityModifier */))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var currentAccessorType = getAnnotatedAccessorType(node); @@ -23284,7 +23728,7 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); + return (node.flags & 16 /* Private */) && ts.isInAmbientContext(node); } function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { if (!produceDiagnostics) { @@ -23316,8 +23760,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { - var otherSignature = signaturesToCheck[_i]; + for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { + var otherSignature = signaturesToCheck_1[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -23332,11 +23776,11 @@ var ts; n.parent.kind !== 214 /* ClassDeclaration */ && n.parent.kind !== 186 /* ClassExpression */ && ts.isInAmbientContext(n)) { - if (!(flags & 2 /* Ambient */)) { + if (!(flags & 4 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported - flags |= 1 /* Export */; + flags |= 2 /* Export */; } - flags |= 2 /* Ambient */; + flags |= 4 /* Ambient */; } return flags & flagsToCheck; } @@ -23361,16 +23805,16 @@ var ts; var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 1 /* Export */) { + if (deviation & 2 /* Export */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } - else if (deviation & 2 /* Ambient */) { + else if (deviation & 4 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + else if (deviation & (16 /* Private */ | 32 /* Protected */)) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 256 /* Abstract */) { + else if (deviation & 128 /* Abstract */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); } }); @@ -23387,7 +23831,7 @@ var ts; }); } } - var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */ | 256 /* Abstract */; + var flagsToCheck = 2 /* Export */ | 4 /* Ambient */ | 16 /* Private */ | 32 /* Protected */ | 128 /* Abstract */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -23418,8 +23862,8 @@ var ts; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - 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; + 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; error(errorNode_1, diagnostic); return; } @@ -23436,7 +23880,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -23449,8 +23893,8 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536 /* Module */; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; @@ -23507,7 +23951,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 256 /* Abstract */)) { + !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */)) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -23533,8 +23977,8 @@ var ts; // function g(x: string, y: string) { } // // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -23571,9 +24015,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 1024 /* Default */); - if (effectiveDeclarationFlags & 1 /* Export */) { - if (effectiveDeclarationFlags & 1024 /* Default */) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 /* Export */ | 512 /* Default */); + if (effectiveDeclarationFlags & 2 /* Export */) { + if (effectiveDeclarationFlags & 512 /* Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -23826,9 +24270,12 @@ var ts; // type as a value. As such, we will just return unknownType; return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } // Validate the promise constructor type. @@ -24020,7 +24467,7 @@ var ts; if (isAsync) { promisedType = checkAsyncFunctionReturnType(node); } - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -24162,7 +24609,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -24177,7 +24624,7 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576 /* BlockScoped */) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent @@ -24330,6 +24777,9 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 194 /* EmptyStatement */) { + error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } checkSourceElement(node.elseStatement); } function checkDoStatement(node) { @@ -24688,7 +25138,7 @@ var ts; error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else if (func.kind === 144 /* Constructor */) { - if (!isTypeAssignableTo(exprType, returnType)) { + if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } @@ -24835,7 +25285,7 @@ var ts; // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!(member.flags & 128 /* Static */) && ts.hasDynamicName(member)) { + if (!(member.flags & 64 /* Static */) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); @@ -24921,7 +25371,7 @@ var ts; return getTypeOfSymbol(getSymbolOfNode(node)); } function checkClassDeclaration(node) { - if (!node.name && !(node.flags & 1024 /* Default */)) { + if (!node.name && !(node.flags & 512 /* Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -24975,8 +25425,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - for (var _b = 0; _b < implementedTypeNodes.length; _b++) { - var typeRefNode = implementedTypeNodes[_b]; + for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { + var typeRefNode = implementedTypeNodes_1[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -25024,8 +25474,8 @@ var ts; // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { - var baseProperty = baseProperties[_i]; + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728 /* Prototype */) { continue; @@ -25043,7 +25493,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { + if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 128 /* Abstract */))) { if (derivedClassDecl.kind === 186 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } @@ -25055,11 +25505,11 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { + if ((baseDeclarationFlags & 16 /* Private */) || (derivedDeclarationFlags & 16 /* Private */)) { // either base or derived property is private - not override, skip it continue; } - if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { + if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { // value of 'static' is not the same for properties - not override, skip it continue; } @@ -25130,11 +25580,11 @@ var ts; var seen = {}; ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0; _i < baseTypes.length; _i++) { - var base = baseTypes[_i]; + for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { + var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0; _a < properties.length; _a++) { - var prop = properties[_a]; + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } @@ -25431,8 +25881,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; if ((declaration.kind === 214 /* ClassDeclaration */ || (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { @@ -25571,7 +26021,7 @@ var ts; // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -25599,7 +26049,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -25630,7 +26080,7 @@ var ts; // If we hit an export in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -25674,7 +26124,7 @@ var ts; return; } // Grammar checking - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69 /* Identifier */) { @@ -26087,7 +26537,7 @@ var ts; // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. - if (!(memberFlags & 128 /* Static */)) { + if (!(memberFlags & 64 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; @@ -26388,7 +26838,7 @@ var ts; */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 128 /* Static */ + return node.flags & 64 /* Static */ ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -26709,7 +27159,7 @@ var ts; function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { - ts.bindSourceFile(file); + ts.bindSourceFile(file, compilerOptions); }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { @@ -26863,19 +27313,19 @@ var ts; text = "private"; lastPrivate = modifier; } - if (flags & 112 /* AccessibilityModifier */) { + if (flags & 56 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 128 /* Static */) { + else if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { if (modifier.kind === 110 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -26886,10 +27336,10 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113 /* StaticKeyword */: - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { @@ -26898,23 +27348,23 @@ var ts; else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 128 /* Static */; + flags |= 64 /* Static */; lastStatic = modifier; break; case 82 /* ExportKeyword */: - if (flags & 1 /* Export */) { + if (flags & 2 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 2 /* Ambient */) { + else if (flags & 4 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (node.parent.kind === 214 /* ClassDeclaration */) { @@ -26923,13 +27373,13 @@ var ts; else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 1 /* Export */; + flags |= 2 /* Export */; break; case 122 /* DeclareKeyword */: - if (flags & 2 /* Ambient */) { + if (flags & 4 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.parent.kind === 214 /* ClassDeclaration */) { @@ -26941,69 +27391,69 @@ var ts; else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 2 /* Ambient */; + flags |= 4 /* Ambient */; lastDeclare = modifier; break; case 115 /* AbstractKeyword */: - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } if (node.kind !== 214 /* ClassDeclaration */) { if (node.kind !== 143 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 32 /* Private */) { + if (flags & 16 /* Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } - flags |= 256 /* Abstract */; + flags |= 128 /* Abstract */; break; case 118 /* AsyncKeyword */: - if (flags & 512 /* Async */) { + if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { + else if (flags & 4 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - flags |= 512 /* Async */; + flags |= 256 /* Async */; lastAsync = modifier; break; } } if (node.kind === 144 /* Constructor */) { - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 64 /* Protected */) { + else if (flags & 32 /* Protected */) { return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (flags & 32 /* Private */) { + else if (flags & 16 /* Private */) { return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 4 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 /* Parameter */ && (flags & 56 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } - if (flags & 512 /* Async */) { + if (flags & 256 /* Async */) { return checkGrammarAsyncModifier(node, lastAsync); } } @@ -27104,7 +27554,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 2035 /* Modifier */) { + if (parameter.flags & 1022 /* Modifier */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -27124,7 +27574,7 @@ var ts; } } function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 2035 /* Modifier */) { + if (node.flags & 1022 /* Modifier */) { grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } } @@ -27147,8 +27597,8 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; if (arg.kind === 187 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -27403,7 +27853,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 2035 /* Modifier */) { + else if (parameter.flags & 1022 /* Modifier */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } else if (parameter.questionToken) { @@ -27554,8 +28004,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { - var element = elements[_i]; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; if (element.kind !== 187 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -27691,8 +28141,8 @@ var ts; node.kind === 221 /* ImportEqualsDeclaration */ || node.kind === 228 /* ExportDeclaration */ || node.kind === 227 /* ExportAssignment */ || - (node.flags & 2 /* Ambient */) || - (node.flags & (1 /* Export */ | 1024 /* Default */))) { + (node.flags & 4 /* Ambient */) || + (node.flags & (2 /* Export */ | 512 /* Default */))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -27739,7 +28189,7 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.flags & 65536 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { + if (node.flags & 32768 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -27793,7 +28243,7 @@ var ts; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); // All the references that are not going to be part of same file - if (referencedFile && ((referencedFile.flags & 8192 /* DeclarationFile */) || + if (referencedFile && ((referencedFile.flags & 4096 /* DeclarationFile */) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); @@ -27988,15 +28438,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -28142,6 +28592,7 @@ var ts; function emitSourceFile(node) { currentSourceFile = node; enclosingDeclaration = node; + ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -28258,10 +28709,10 @@ var ts; // If the node is parented in the current source file we need to emit export declare or just export if (node.parent === currentSourceFile) { // If the node is exported - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } else if (node.kind !== 215 /* InterfaceDeclaration */) { @@ -28270,16 +28721,16 @@ var ts; } } function emitClassMemberDeclarationFlags(node) { - if (node.flags & 32 /* Private */) { + if (node.flags & 16 /* Private */) { write("private "); } - else if (node.flags & 64 /* Protected */) { + else if (node.flags & 32 /* Protected */) { write("protected "); } - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* Static */) { write("static "); } - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { write("abstract "); } } @@ -28287,7 +28738,7 @@ var ts; // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } write("import "); @@ -28322,12 +28773,12 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 1 /* Export */)) { + if (!node.importClause && !(node.flags & 2 /* Export */)) { // do not write non-exported import declarations that don't have import clauses return; } emitJsDocComments(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } write("import "); @@ -28392,7 +28843,7 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 131072 /* Namespace */) { + if (node.flags & 65536 /* Namespace */) { write("namespace "); } else { @@ -28464,7 +28915,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 16 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -28508,7 +28959,7 @@ var ts; break; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { + if (node.parent.flags & 64 /* Static */) { diagnosticMessage = 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 === 214 /* ClassDeclaration */) { @@ -28574,7 +29025,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 56 /* AccessibilityModifier */) { emitPropertyDeclaration(param); } }); @@ -28582,7 +29033,7 @@ var ts; } emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { write("abstract "); } write("class "); @@ -28652,7 +29103,7 @@ var ts; if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 32 /* Private */)) { + else if (!(node.flags & 16 /* Private */)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } @@ -28667,7 +29118,7 @@ var ts; } else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* Static */) { return 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 : @@ -28771,7 +29222,7 @@ var ts; emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); - if (!(node.flags & 32 /* Private */)) { + if (!(node.flags & 16 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { @@ -28800,7 +29251,7 @@ var ts; var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named - if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { + if (accessorWithTypeAnnotation.parent.flags & 64 /* 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; @@ -28818,7 +29269,7 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 128 /* Static */) { + if (accessorWithTypeAnnotation.flags & 64 /* 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 : @@ -28905,7 +29356,7 @@ var ts; emitType(node.type); } } - else if (node.kind !== 144 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 144 /* Constructor */ && !(node.flags & 16 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -28936,7 +29387,7 @@ var ts; break; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* 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 : @@ -28997,7 +29448,7 @@ var ts; node.parent.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 32 /* Private */)) { + else if (!(node.parent.flags & 16 /* Private */)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { @@ -29028,7 +29479,7 @@ var ts; ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { + if (node.parent.flags & 64 /* Static */) { return 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 : @@ -29170,7 +29621,7 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 8192 /* DeclarationFile */ + var declFileName = referencedFile.flags & 4096 /* DeclarationFile */ ? referencedFile.fileName // Declaration file, use declaration file name : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file @@ -29216,6 +29667,12 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + var Jump; + (function (Jump) { + Jump[Jump["Break"] = 2] = "Break"; + Jump[Jump["Continue"] = 4] = "Continue"; + Jump[Jump["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); var entities = { "quot": 0x0022, "amp": 0x0026, @@ -29525,16 +29982,8 @@ var ts; diagnostics: diagnostics, sourceMaps: sourceMapDataList }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && ts.hasProperty(node.locals, name)) { // We conservatively include alias symbols to cover cases where they're emitted as locals if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { @@ -29544,12 +29993,6 @@ var ts; } return true; } - var Jump; - (function (Jump) { - Jump[Jump["Break"] = 2] = "Break"; - Jump[Jump["Continue"] = 4] = "Continue"; - Jump[Jump["Return"] = 8] = "Return"; - })(Jump || (Jump = {})); function setLabeledJump(state, isBreak, labelText, labelMarker) { if (isBreak) { if (!state.labeledNonLocalBreaks) { @@ -31026,7 +31469,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 1024 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -31045,7 +31488,7 @@ var ts; emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); } else { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; if (!multiLine) { write(" "); } @@ -31064,7 +31507,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; var properties = node.properties; write("("); if (multiLine) { @@ -31693,7 +32136,7 @@ var ts; var current = node; while (current) { if (current.kind === 248 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + return !isExported || ((ts.getCombinedNodeFlags(node) & 2 /* Export */) !== 0); } else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { return false; @@ -31934,7 +32377,7 @@ var ts; // variables in variable declaration list were already hoisted return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 49152 /* BlockScoped */) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576 /* BlockScoped */) === 0) { // we are inside a converted loop - this can only happen in downlevel scenarios // record names for all variable declarations for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { @@ -32019,7 +32462,7 @@ var ts; break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 49152 /* BlockScoped */)) { + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576 /* BlockScoped */)) { // if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { @@ -32334,10 +32777,12 @@ var ts; // // for (let v of arr) { } // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 69 /* Identifier */; + // we can't reuse 'arr' because it might be modified within the body of the loop. var counter = createTempVariable(268435456 /* _i */); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); + var rhsReference = ts.createSynthesizedNode(69 /* Identifier */); + rhsReference.text = node.expression.kind === 69 /* Identifier */ ? + makeUniqueName(node.expression.text) : + makeTempVariableName(0 /* Auto */); // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. emitStart(node.expression); @@ -32346,15 +32791,13 @@ var ts; emitNodeWithoutSourceMap(counter); write(" = 0"); emitEnd(node.expression); - if (!rhsIsIdentifier) { - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } + // , _a = expr + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); write("; "); // _i < _a.length; emitStart(node.initializer); @@ -32609,7 +33052,7 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { + if (ts.getCombinedNodeFlags(node) & 2 /* Export */) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); @@ -32631,7 +33074,7 @@ var ts; } function emitEs6ExportDefaultCompat(node) { if (node.parent.kind === 248 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 227 /* ExportAssignment */); + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); // only allow export default at a source file level if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { if (!currentSourceFile.symbol.exports["___esModule"]) { @@ -32649,7 +33092,7 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { writeLine(); emitStart(node); // emit call to exporter only for top level nodes @@ -32657,7 +33100,7 @@ var ts; // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default"); } else { @@ -32668,7 +33111,7 @@ var ts; write(")"); } else { - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { write("exports[\"default\"]"); @@ -32772,7 +33215,7 @@ var ts; // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; if (root.kind === 211 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isExported = ts.getCombinedNodeFlags(root) & 2 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } @@ -32854,8 +33297,8 @@ var ts; // to ensure value is evaluated exactly once. value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; + for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { + var p = properties_5[_a]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { var propName = p.name; var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; @@ -32990,7 +33433,7 @@ var ts; // this is necessary to preserve ES6 semantic in scenarios like // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); + (getCombinedFlagsForIdentifier(node.name) & 8192 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isLetDefinedInLoop && node.parent.parent.kind !== 200 /* ForInStatement */ && @@ -33030,13 +33473,13 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1 /* Export */) && + return !!(node.flags & 2 /* Export */) && modulekind === 5 /* ES6 */ && node.parent.kind === 248 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); @@ -33063,7 +33506,7 @@ var ts; function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { // If we're not exporting the variables, there's nothing special here. // Always emit comments for these nodes. - if (!(node.flags & 1 /* Export */)) { + if (!(node.flags & 2 /* Export */)) { return true; } // If we are exporting, but it's a top-level ES6 module exports, @@ -33246,7 +33689,7 @@ var ts; if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } } @@ -33466,7 +33909,7 @@ var ts; emitRestParameter(node); } function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { + if (languageVersion < 2 /* ES6 */ || node.flags & 256 /* Async */) { emitDownLevelExpressionFunctionBody(node, body); return; } @@ -33487,7 +33930,7 @@ var ts; scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); - emitDetachedComments(node.body); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); @@ -33525,7 +33968,7 @@ var ts; scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); - emitDetachedComments(body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); @@ -33569,7 +34012,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 56 /* AccessibilityModifier */) { writeLine(); emitStart(param); emitStart(param.name); @@ -33604,15 +34047,15 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 64 /* Static */) !== 0) && member.initializer) { properties.push(member); } } return properties; } function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var property = properties_6[_a]; emitPropertyDeclaration(node, property); } } @@ -33625,7 +34068,7 @@ var ts; emit(receiver); } else { - if (property.flags & 128 /* Static */) { + if (property.flags & 64 /* Static */) { emitDeclarationName(node); } else { @@ -33724,7 +34167,7 @@ var ts; writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 128 /* Static */) { + if (member.flags & 64 /* Static */) { write("static "); } if (member.kind === 145 /* GetAccessor */) { @@ -33774,7 +34217,7 @@ var ts; emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 64 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -33821,7 +34264,7 @@ var ts; // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedComments(ctor.body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); var superCall; @@ -33941,7 +34384,7 @@ var ts; // _default = __decorate([dec], _default); // export default _default; // - if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { + if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } write("let "); @@ -33950,7 +34393,7 @@ var ts; } else if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } } @@ -33980,7 +34423,7 @@ var ts; // emit name if // - node has a name // - this is default export with static initializers - if ((node.name || (node.flags & 1024 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if ((node.name || (node.flags & 512 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { write(" "); emitDeclarationName(node); } @@ -34016,8 +34459,8 @@ var ts; // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; + for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { + var property = staticProperties_1[_a]; write(","); writeLine(); emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); @@ -34035,7 +34478,7 @@ var ts; } // If this is an exported class, but not on the top level (i.e. on an internal // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { + if (!isES6ExportedDeclaration(node) && (node.flags & 2 /* Export */)) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -34044,7 +34487,7 @@ var ts; emitEnd(node); write(";"); } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { + else if (isES6ExportedDeclaration(node) && (node.flags & 512 /* Default */) && thisNodeIsDecorated) { // if this is a top level default export of decorated class, write the export after the declaration. writeLine(); write("export default "); @@ -34126,13 +34569,13 @@ var ts; } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 128 /* Static */)) { + if (!(member.flags & 64 /* Static */)) { write(".prototype"); } } function emitDecoratorsOfClass(node) { emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 128 /* Static */); + emitDecoratorsOfMembers(node, 64 /* Static */); emitDecoratorsOfConstructor(node); } function emitDecoratorsOfConstructor(node) { @@ -34179,7 +34622,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; // only emit members in the correct group - if ((member.flags & 128 /* Static */) !== staticFlag) { + if ((member.flags & 64 /* Static */) !== staticFlag) { continue; } // skip members that cannot be decorated (such as the constructor) @@ -34580,7 +35023,7 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + if (!(node.flags & 2 /* Export */) || isES6ExportedDeclaration(node)) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -34611,7 +35054,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 2 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted writeLine(); emitStart(node); @@ -34623,7 +35066,7 @@ var ts; write(";"); } if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { // write the call to exporter for enum writeLine(); write(exportFunctionForFile + "(\""); @@ -34728,7 +35171,7 @@ var ts; } write(")("); // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 2 /* Export */) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -34738,7 +35181,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -34841,7 +35284,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 2 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (modulekind !== 2 /* AMD */) { emitLeadingComments(node); @@ -34923,7 +35366,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 1 /* Export */)) { + else if (!(node.flags & 2 /* Export */)) { write("var "); } } @@ -35014,8 +35457,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(modulekind === 5 /* ES6 */); var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; + for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { + var specifier = specifiers_1[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -35158,8 +35601,8 @@ var ts; } writeLine(); var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; + for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { + var importNode = externalImports_1[_a]; // do not create variable declaration for exports and imports that lack import clause var skipNode = importNode.kind === 228 /* ExportDeclaration */ || (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); @@ -35193,8 +35636,8 @@ var ts; // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; + for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { + var externalImport = externalImports_2[_a]; if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; @@ -35225,8 +35668,8 @@ var ts; } } } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; + for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { + var externalImport = externalImports_3[_d]; if (externalImport.kind !== 228 /* ExportDeclaration */) { continue; } @@ -35275,7 +35718,7 @@ var ts; function writeExportedName(node) { // do not record default exports // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 69 /* Identifier */ && node.flags & 1024 /* Default */) { + if (node.kind !== 69 /* Identifier */ && node.flags & 512 /* Default */) { return; } if (started) { @@ -35338,7 +35781,7 @@ var ts; emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); - if (flags & 1 /* Export */) { + if (flags & 2 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -35348,11 +35791,11 @@ var ts; write(";"); } if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; + for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { + var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 1 /* Export */) { + if (f.flags & 2 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -35362,7 +35805,7 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 2 /* Ambient */) { + if (node.flags & 4 /* Ambient */) { return; } if (node.kind === 213 /* FunctionDeclaration */) { @@ -35437,7 +35880,7 @@ var ts; // - it is top level block scoped // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || + return (ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) === 0 || ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; } function isCurrentFileSystemExternalModule() { @@ -35509,8 +35952,8 @@ var ts; var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; + for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { + var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { case 222 /* ImportDeclaration */: @@ -35679,8 +36122,8 @@ var ts; unaliasedModuleNames.push("\"" + amdDependency.path + "\""); } } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; + for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { + var importNode = externalImports_4[_c]; // Find the name of the external module var externalModuleName = getExternalModuleNameText(importNode); // Find the name of the module alias, if there is one @@ -35959,7 +36402,7 @@ var ts; // Start new file on new line writeLine(); emitShebang(); - emitDetachedComments(node); + emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; emitModule(node); @@ -35983,7 +36426,7 @@ var ts; } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 2 /* Ambient */) { + if (node.flags & 4 /* Ambient */) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -36232,10 +36675,6 @@ var ts; } return leadingComments; } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } /** * Determine if the given comment is a triple-slash * @@ -36350,57 +36789,14 @@ var ts; // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - // removeComments is true, only reserve pinned comment at the top of file - // For example: - // /*! Pinned Comment */ - // - // var x = 10; - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + function emitDetachedCommentsAndUpdateCommentsInfo(node) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); } - } - else { - // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - // Valid detachedComments - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -36716,7 +37112,7 @@ var ts; var resolveModuleNamesWorker = host.resolveModuleNames ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); - var filesByName = ts.createFileMap(getCanonicalFileName); + var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; @@ -36774,8 +37170,8 @@ var ts; // Initialize a checker so that all our files are bound. getTypeChecker(); classifiableNames = {}; - for (var _i = 0; _i < files.length; _i++) { - var sourceFile = files[_i]; + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var sourceFile = files_3[_i]; ts.copyMap(sourceFile.classifiableNames, classifiableNames); } } @@ -36793,7 +37189,7 @@ var ts; } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; - var normalizedAbsoluteFileNames = []; + var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; @@ -36801,8 +37197,8 @@ var ts; if (!newSourceFile) { return false; } - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - normalizedAbsoluteFileNames.push(normalizedAbsolutePath); + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); if (oldSourceFile !== newSourceFile) { if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { // value of no-default-lib has changed @@ -36822,7 +37218,7 @@ var ts; } if (resolveModuleNamesWorker) { var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, normalizedAbsolutePath); + var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); // ensure that module resolution results are still correct for (var i = 0; i < moduleNames.length; ++i) { var newResolution = resolutions[i]; @@ -36850,12 +37246,12 @@ var ts; } // update fileName -> file mapping for (var i = 0, len = newSourceFiles.length; i < len; ++i) { - filesByName.set(normalizedAbsoluteFileNames[i], newSourceFiles[i]); + filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _b = 0; _b < modifiedSourceFiles.length; _b++) { - var modifiedFile = modifiedSourceFiles[_b]; + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } oldProgram.structureIsReused = true; @@ -36905,7 +37301,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.getNormalizedAbsolutePath(fileName, currentDirectory)); + return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -37024,7 +37420,7 @@ var ts; } break; case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.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. @@ -37049,7 +37445,7 @@ var ts; diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -37059,13 +37455,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.getNormalizedAbsolutePath(fileName + extension, currentDirectory), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -37111,6 +37507,7 @@ var ts; }); filesByName.set(normalizedAbsolutePath, file); if (file) { + file.path = normalizedAbsolutePath; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); @@ -37157,13 +37554,7 @@ var ts; var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - var absoluteImportPath = ts.isRootedDiskPath(resolution.resolvedFileName) - ? resolution.resolvedFileName - : ts.getNormalizedAbsolutePath(resolution.resolvedFileName, currentDirectory); - // convert an absolute import path to path that is relative to current directory - // this was host still can locate it but files names in user output will be shorter (and thus look nicer). - var relativePath = ts.getRelativePathToDirectoryOrUrl(currentDirectory, absoluteImportPath, currentDirectory, getCanonicalFileName, false); - var importedFile = findSourceFile(relativePath, absoluteImportPath, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); @@ -37219,8 +37610,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -37344,6 +37735,7 @@ var ts; /// /// /// +/// /// var ts; (function (ts) { @@ -37493,6 +37885,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "pretty", + paramType: ts.Diagnostics.KIND, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, { name: "project", shortName: "p", @@ -37591,11 +37989,31 @@ var ts; description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic }, + { + name: "allowUnusedLabels", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, { name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, + } ]; var optionNameMapCache; /* @internal */ @@ -37734,13 +38152,38 @@ var ts; */ function parseConfigFileTextToJson(fileName, jsonText) { try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + var jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + /** + * Remove the comments from a json like text. + * Comments can be single line comments (starting with # or //) or multiline comments using / * * / + * + * This method replace comment content by whitespace rather than completely remove them to keep positions in json parsing error reporting accurate. + */ + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1 /* ES5 */, /* skipTrivia */ false, 0 /* Standard */, jsonText); + var token; + while ((token = scanner.scan()) !== 1 /* EndOfFileToken */) { + switch (token) { + case 2 /* SingleLineCommentTrivia */: + case 3 /* MultiLineCommentTrivia */: + // replace comments with whitespace to preserve original character positions + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -37871,8 +38314,8 @@ var ts; var lastSingleLineCommentEnd = -1; var isFirstSingleLineComment = true; var singleLineCommentCount = 0; - for (var _i = 0; _i < comments.length; _i++) { - var currentComment = comments[_i]; + for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { + var currentComment = comments_2[_i]; // For single line comments, combine consecutive ones (2 or more) into // a single span from the start of the first till the end of the last if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { @@ -38004,6 +38447,8 @@ var ts; function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; + // This means "compare in a case insensitive manner." + var baseSensitivity = { sensitivity: "base" }; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); @@ -38017,8 +38462,8 @@ var ts; if (!matches) { continue; } - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { @@ -38047,8 +38492,8 @@ var ts; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; if (!match.isCaseSensitive) { return false; } @@ -38123,8 +38568,8 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { + var match = matches_2[_i]; var kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; @@ -38132,8 +38577,6 @@ var ts; } return bestMatchKind; } - // This means "compare in a case insensitive manner." - var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. // Right now we just sort by kind first, and then by name of the item. @@ -38296,8 +38739,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; switch (node.kind) { case 214 /* ClassDeclaration */: case 217 /* EnumDeclaration */: @@ -38340,8 +38783,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var child = nodes_5[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -38389,7 +38832,7 @@ var ts; if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 2035 /* Modifier */) === 0) { + if ((node.flags & 1022 /* Modifier */) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); @@ -38693,8 +39136,8 @@ var ts; // word part. That way we don't match something like 'Class' when the user types 'a'. // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { - var span = wordSpans[_i]; + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); @@ -38800,8 +39243,8 @@ var ts; // Only if all words have some sort of match is the pattern considered matched. var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { - var subWordTextChunk = subWordTextChunks[_i]; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; // Try to match the candidate with this word var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { @@ -39386,8 +39829,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0; _b < declarations.length; _b++) { - var declaration = declarations[_b]; + for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { + var declaration = declarations_7[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -39503,8 +39946,8 @@ var ts; // arg index. var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { - var child = listChildren[_i]; + for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) { + var child = listChildren_1[_i]; if (child === node) { break; } @@ -40049,8 +40492,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { - var child = children[_i]; + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -40212,17 +40655,17 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 32 /* Private */) + if (flags & 16 /* Private */) result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 64 /* Protected */) + if (flags & 32 /* Protected */) result.push(ts.ScriptElementKindModifier.protectedMemberModifier); - if (flags & 16 /* Public */) + if (flags & 8 /* Public */) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 128 /* Static */) + if (flags & 64 /* Static */) result.push(ts.ScriptElementKindModifier.staticModifier); - if (flags & 256 /* Abstract */) + if (flags & 128 /* Abstract */) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 1 /* Export */) + if (flags & 2 /* Export */) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); @@ -42366,8 +42809,8 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { @@ -42458,8 +42901,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { - var triviaItem = trivia[_i]; + for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { + var triviaItem = trivia_1[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -43056,7 +43499,6 @@ var ts; return node; } } - return node; } } function deriveActualIndentationFromList(list, index, sourceFile, options) { @@ -43307,17 +43749,17 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 4096 /* Synthetic */, this)); + nodes.push(createNode(token, pos, textPos, 2048 /* Synthetic */, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 2048 /* Synthetic */, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -43872,7 +44314,7 @@ var ts; break; case 138 /* Parameter */: // Only consider properties defined as constructor parameters - if (!(node.flags & 112 /* AccessibilityModifier */)) { + if (!(node.flags & 56 /* AccessibilityModifier */)) { break; } // fall through @@ -44148,13 +44590,15 @@ var ts; var HostCache = (function () { function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index - this.fileNameToEntry = ts.createFileMap(getCanonicalFileName); + this.currentDirectory = host.getCurrentDirectory(); + this.fileNameToEntry = ts.createFileMap(); // Initialize the list with the root file names var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; - this.createEntry(fileName); + for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { + var fileName = rootFileNames_1[_i]; + this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName)); } // store the compilation settings this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); @@ -44162,7 +44606,7 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; - HostCache.prototype.createEntry = function (fileName) { + HostCache.prototype.createEntry = function (fileName, path) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { @@ -44172,36 +44616,37 @@ var ts; scriptSnapshot: scriptSnapshot }; } - this.fileNameToEntry.set(fileName, entry); + this.fileNameToEntry.set(path, entry); return entry; }; - HostCache.prototype.getEntry = function (fileName) { - return this.fileNameToEntry.get(fileName); + HostCache.prototype.getEntry = function (path) { + return this.fileNameToEntry.get(path); }; - HostCache.prototype.contains = function (fileName) { - return this.fileNameToEntry.contains(fileName); + HostCache.prototype.contains = function (path) { + return this.fileNameToEntry.contains(path); }; HostCache.prototype.getOrCreateEntry = function (fileName) { - if (this.contains(fileName)) { - return this.getEntry(fileName); + var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); + if (this.contains(path)) { + return this.getEntry(path); } - return this.createEntry(fileName); + return this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; - this.fileNameToEntry.forEachValue(function (value) { + this.fileNameToEntry.forEachValue(function (path, value) { if (value) { fileNames.push(value.hostFileName); } }); return fileNames; }; - HostCache.prototype.getVersion = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getVersion = function (path) { + var file = this.getEntry(path); return file && file.version; }; - HostCache.prototype.getScriptSnapshot = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getScriptSnapshot = function (path) { + var file = this.getEntry(path); return file && file.scriptSnapshot; }; return HostCache; @@ -44383,7 +44828,8 @@ var ts; : (function (fileName) { return fileName.toLowerCase(); }); } ts.createGetCanonicalFileName = createGetCanonicalFileName; - function createDocumentRegistry(useCaseSensitiveFileNames) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; @@ -44395,7 +44841,7 @@ var ts; var key = getKeyFromCompilationSettings(settings); var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(getCanonicalFileName); + buckets[key] = bucket = ts.createFileMap(); } return bucket; } @@ -44403,14 +44849,13 @@ var ts; var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; - for (var i in entries) { - var entry = entries.get(i); + entries.forEachValue(function (key, entry) { sourceFiles.push({ - name: i, + name: key, refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); - } + }); sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, @@ -44427,7 +44872,8 @@ var ts; } function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. @@ -44437,7 +44883,7 @@ var ts; languageServiceRefCount: 0, owners: [] }; - bucket.set(fileName, entry); + bucket.set(path, entry); } else { // We have an entry for this file. However, it may be for a different version of @@ -44460,11 +44906,12 @@ var ts; function releaseDocument(fileName, compilationSettings) { var bucket = getBucketForCompilationSettings(compilationSettings, false); ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); if (entry.languageServiceRefCount === 0) { - bucket.remove(fileName); + bucket.remove(path); } } return { @@ -44871,7 +45318,7 @@ var ts; case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; case 247 /* EnumMember */: return ScriptElementKind.variableElement; - case 138 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138 /* Parameter */: return (node.flags & 56 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 221 /* ImportEqualsDeclaration */: case 226 /* ImportSpecifier */: case 223 /* ImportClause */: @@ -44897,13 +45344,14 @@ var ts; return CancellationTokenObject; })(); function createLanguageService(host, documentRegistry) { - if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var currentDirectory = host.getCurrentDirectory(); // Check if the localized messages json is set, otherwise query the host for it if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); @@ -44915,8 +45363,7 @@ var ts; } var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { - fileName = ts.normalizeSlashes(fileName); - var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { throw new Error("Could not find file: '" + fileName + "'."); } @@ -44968,7 +45415,7 @@ var ts; getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality ts.Debug.assert(!host.resolveModuleNames); @@ -44988,11 +45435,10 @@ var ts; // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { - var oldSourceFile = oldSourceFiles[_i]; - var fileName = oldSourceFile.fileName; - if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(fileName, oldSettings); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; + if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); } } } @@ -45048,7 +45494,8 @@ var ts; return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } function sourceFileUpToDate(sourceFile) { - return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); + return sourceFile && sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { // If we haven't create a program yet, then it is not up-to-date @@ -45061,8 +45508,8 @@ var ts; return false; } // If any file is not up-to-date, then the whole program is not up-to-date - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; + for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) { + var fileName = rootFileNames_2[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; } @@ -45237,8 +45684,8 @@ var ts; } function checkModifiers(modifiers) { if (modifiers) { - for (var _i = 0; _i < modifiers.length; _i++) { - var modifier = modifiers[_i]; + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; switch (modifier.kind) { case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: @@ -45940,8 +46387,8 @@ var ts; */ function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { var exisingImportsOrExports = {}; - for (var _i = 0; _i < namedImportsOrExports.length; _i++) { - var element = namedImportsOrExports[_i]; + for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { + var element = namedImportsOrExports_1[_i]; // If this is the current item we are editing right now, do not filter it out if (element.getStart() <= position && position <= element.getEnd()) { continue; @@ -45965,8 +46412,8 @@ var ts; return contextualMemberSymbols; } var existingMemberNames = {}; - for (var _i = 0; _i < existingMembers.length; _i++) { - var m = existingMembers[_i]; + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members if (m.kind !== 245 /* PropertyAssignment */ && m.kind !== 246 /* ShorthandPropertyAssignment */ && @@ -45999,8 +46446,8 @@ var ts; */ function filterJsxAttributes(symbols, attributes) { var seenNames = {}; - for (var _i = 0; _i < attributes.length; _i++) { - var attr = attributes[_i]; + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; // If this is the current item we are editing right now, do not filter it out if (attr.getStart() <= position && position <= attr.getEnd()) { continue; @@ -46101,8 +46548,8 @@ var ts; var entries = []; if (symbols) { var nameToSymbol = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -46844,8 +47291,8 @@ var ts; } var fileNameToDocumentHighlights = {}; var result = []; - for (var _i = 0; _i < referencedSymbols.length; _i++) { - var referencedSymbol = referencedSymbols[_i]; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { var referenceEntry = _b[_a]; var fileName_1 = referenceEntry.fileName; @@ -46989,7 +47436,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } /** * For lack of a better name, this function takes a throw statement and returns the @@ -47027,7 +47473,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } function ownsBreakOrContinueStatement(owner, statement) { var actualOwner = getBreakOrContinueOwner(statement); @@ -47096,7 +47541,7 @@ var ts; case 219 /* ModuleBlock */: case 248 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 256 /* Abstract */) { + if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); } else { @@ -47111,7 +47556,7 @@ var ts; nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. - if (modifierFlag & 112 /* AccessibilityModifier */) { + if (modifierFlag & 56 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { return member.kind === 144 /* Constructor */ && member; }); @@ -47119,7 +47564,7 @@ var ts; nodes = nodes.concat(constructor.parameters); } } - else if (modifierFlag & 256 /* Abstract */) { + else if (modifierFlag & 128 /* Abstract */) { nodes = nodes.concat(container); } break; @@ -47135,19 +47580,19 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112 /* PublicKeyword */: - return 16 /* Public */; + return 8 /* Public */; case 110 /* PrivateKeyword */: - return 32 /* Private */; + return 16 /* Private */; case 111 /* ProtectedKeyword */: - return 64 /* Protected */; + return 32 /* Protected */; case 113 /* StaticKeyword */: - return 128 /* Static */; + return 64 /* Static */; case 82 /* ExportKeyword */: - return 1 /* Export */; + return 2 /* Export */; case 122 /* DeclareKeyword */: - return 2 /* Ambient */; + return 4 /* Ambient */; case 115 /* AbstractKeyword */: - return 256 /* Abstract */; + return 128 /* Abstract */; default: ts.Debug.fail(); } @@ -47346,8 +47791,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0; _i < documentHighlights.length; _i++) { - var entry = documentHighlights[_i]; + for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { + var entry = documentHighlights_1[_i]; for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { var highlightSpan = _b[_a]; result.push({ @@ -47365,8 +47810,8 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0; _i < referenceSymbols.length; _i++) { - var referenceSymbol = referenceSymbols[_i]; + for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { + var referenceSymbol = referenceSymbols_1[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } return referenceEntries; @@ -47451,8 +47896,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var sourceFile = sourceFiles_2[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName)) { @@ -47512,7 +47957,7 @@ var ts; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16 /* Private */) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); } @@ -47530,8 +47975,8 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -47711,7 +48156,7 @@ var ts; return undefined; } // Whether 'super' occurs in a static context within a class. - var staticFlag = 128 /* Static */; + var staticFlag = 64 /* Static */; switch (searchSpaceNode.kind) { case 141 /* PropertyDeclaration */: case 140 /* PropertySignature */: @@ -47739,7 +48184,7 @@ var ts; // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. - if (container && (128 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (64 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -47749,7 +48194,7 @@ var ts; function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. - var staticFlag = 128 /* Static */; + var staticFlag = 64 /* Static */; switch (searchSpaceNode.kind) { case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: @@ -47827,7 +48272,7 @@ var ts; case 214 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; @@ -47998,8 +48443,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -48115,7 +48560,6 @@ var ts; return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { @@ -48694,8 +49138,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { - var current = childNodes[_i]; + for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { + var current = childNodes_1[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -49025,8 +49469,8 @@ var ts; // Disallow rename for elements that are defined in the standard TypeScript library. var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var current = declarations_10[_i]; var sourceFile_2 = current.getSourceFile(); var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -49609,7 +50053,7 @@ var ts; */ function spanInSourceFileAtLocation(sourceFile, position) { // Cannot set breakpoint in dts file - if (sourceFile.flags & 8192 /* DeclarationFile */) { + if (sourceFile.flags & 4096 /* DeclarationFile */) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); @@ -49827,7 +50271,7 @@ var ts; ? variableDeclaration.parent.parent.initializer.declarations : undefined; // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */)) { + if (variableDeclaration.initializer || (variableDeclaration.flags & 2 /* Export */)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { // First declaration - include let keyword @@ -49853,7 +50297,7 @@ var ts; function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16 /* Public */) || !!(parameter.flags & 32 /* Private */); + !!(parameter.flags & 8 /* Public */) || !!(parameter.flags & 16 /* Private */); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -49873,7 +50317,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1 /* Export */) || + return !!(functionDeclaration.flags & 2 /* Export */) || (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { @@ -49967,7 +50411,6 @@ var ts; // fall through. case 244 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - ; case 220 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; @@ -50008,8 +50451,6 @@ var ts; default: return spanInNode(node.parent); } - // Default to parent node - return spanInNode(node.parent); } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration @@ -50138,7 +50579,6 @@ var ts; // TODO: should this be '==='? if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - return null; } return JSON.parse(settingsJson); }; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index badaff1c3e2..d2758e6d5e9 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -17,19 +17,22 @@ declare namespace ts { interface Map { [index: string]: T; } + type Path = string & { + __pathBrand: any; + }; interface FileMap { - get(fileName: string): T; - set(fileName: string, value: T): void; - contains(fileName: string): boolean; - remove(fileName: string): void; - forEachValue(f: (v: T) => void): void; + get(fileName: Path): T; + set(fileName: Path, value: T): void; + contains(fileName: Path): boolean; + remove(fileName: Path): void; + forEachValue(f: (key: Path, v: T) => void): void; clear(): void; } interface TextRange { pos: number; end: number; } - const enum SyntaxKind { + enum SyntaxKind { Unknown = 0, EndOfFileToken = 1, SingleLineCommentTrivia = 2, @@ -327,31 +330,34 @@ declare namespace ts { LastBinaryOperator = 68, FirstNode = 135, } - const enum NodeFlags { + enum NodeFlags { None = 0, - Export = 1, - Ambient = 2, - Public = 16, - Private = 32, - Protected = 64, - Static = 128, - Abstract = 256, - Async = 512, - Default = 1024, - MultiLine = 2048, - Synthetic = 4096, - DeclarationFile = 8192, - Let = 16384, - Const = 32768, - OctalLiteral = 65536, - Namespace = 131072, - ExportContext = 262144, - ContainsThis = 524288, - Modifier = 2035, - AccessibilityModifier = 112, - BlockScoped = 49152, + Export = 2, + Ambient = 4, + Public = 8, + Private = 16, + Protected = 32, + Static = 64, + Abstract = 128, + Async = 256, + Default = 512, + MultiLine = 1024, + Synthetic = 2048, + DeclarationFile = 4096, + Let = 8192, + Const = 16384, + OctalLiteral = 32768, + Namespace = 65536, + ExportContext = 131072, + ContainsThis = 262144, + HasImplicitReturn = 524288, + HasExplicitReturn = 1048576, + Modifier = 1022, + AccessibilityModifier = 56, + BlockScoped = 24576, + ReachabilityCheckFlags = 1572864, } - const enum JsxFlags { + enum JsxFlags { None = 0, IntrinsicNamedElement = 1, IntrinsicIndexedElement = 2, @@ -931,6 +937,7 @@ declare namespace ts { statements: NodeArray; endOfFileToken: Node; fileName: string; + path: Path; text: string; amdDependencies: { path: string; @@ -1093,7 +1100,7 @@ declare namespace ts { trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; } - const enum TypeFormatFlags { + enum TypeFormatFlags { None = 0, WriteArrayAsGenericType = 1, UseTypeOfFunction = 2, @@ -1104,7 +1111,7 @@ declare namespace ts { InElementType = 64, UseFullyQualifiedType = 128, } - const enum SymbolFormatFlags { + enum SymbolFormatFlags { None = 0, WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, @@ -1114,7 +1121,7 @@ declare namespace ts { parameterIndex: number; type: Type; } - const enum SymbolFlags { + enum SymbolFlags { None = 0, FunctionScopedVariable = 1, BlockScopedVariable = 2, @@ -1191,7 +1198,7 @@ declare namespace ts { interface SymbolTable { [index: string]: Symbol; } - const enum TypeFlags { + enum TypeFlags { Any = 1, String = 2, Number = 4, @@ -1262,7 +1269,7 @@ declare namespace ts { interface TypeParameter extends Type { constraint: Type; } - const enum SignatureKind { + enum SignatureKind { Call = 0, Construct = 1, } @@ -1272,7 +1279,7 @@ declare namespace ts { parameters: Symbol[]; typePredicate?: TypePredicate; } - const enum IndexKind { + enum IndexKind { String = 0, Number = 1, } @@ -1307,7 +1314,7 @@ declare namespace ts { Error = 1, Message = 2, } - const enum ModuleResolutionKind { + enum ModuleResolutionKind { Classic = 1, NodeJs = 2, } @@ -1352,10 +1359,14 @@ declare namespace ts { experimentalDecorators?: boolean; emitDecoratorMetadata?: boolean; moduleResolution?: ModuleResolutionKind; + allowUnusedLabels?: boolean; + allowUnreachableCode?: boolean; + noImplicitReturns?: boolean; + noFallthroughCasesInSwitch?: boolean; forceConsistentCasingInFileNames?: boolean; [option: string]: string | number | boolean; } - const enum ModuleKind { + enum ModuleKind { None = 0, CommonJS = 1, AMD = 2, @@ -1364,12 +1375,12 @@ declare namespace ts { ES6 = 5, ES2015 = 5, } - const enum JsxEmit { + enum JsxEmit { None = 0, Preserve = 1, React = 2, } - const enum NewLineKind { + enum NewLineKind { CarriageReturnLineFeed = 0, LineFeed = 1, } @@ -1377,14 +1388,14 @@ declare namespace ts { line: number; character: number; } - const enum ScriptTarget { + enum ScriptTarget { ES3 = 0, ES5 = 1, ES6 = 2, ES2015 = 2, Latest = 2, } - const enum LanguageVariant { + enum LanguageVariant { Standard = 0, JSX = 1, } @@ -1938,7 +1949,7 @@ declare namespace ts { outputFiles: OutputFile[]; emitSkipped: boolean; } - const enum OutputFileType { + enum OutputFileType { JavaScript = 0, SourceMap = 1, Declaration = 2, @@ -1948,7 +1959,7 @@ declare namespace ts { writeByteOrderMark: boolean; text: string; } - const enum EndOfLineState { + enum EndOfLineState { None = 0, InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, @@ -2116,7 +2127,7 @@ declare namespace ts { static parameterName: string; static docCommentTagName: string; } - const enum ClassificationType { + enum ClassificationType { comment = 1, identifier = 2, keyword = 3, @@ -2159,7 +2170,7 @@ declare namespace ts { let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; function createClassifier(): Classifier; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 1e0c0edad05..8b0ef04f96e 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -350,27 +350,30 @@ var ts; var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { NodeFlags[NodeFlags["None"] = 0] = "None"; - NodeFlags[NodeFlags["Export"] = 1] = "Export"; - NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; - NodeFlags[NodeFlags["Public"] = 16] = "Public"; - NodeFlags[NodeFlags["Private"] = 32] = "Private"; - NodeFlags[NodeFlags["Protected"] = 64] = "Protected"; - NodeFlags[NodeFlags["Static"] = 128] = "Static"; - NodeFlags[NodeFlags["Abstract"] = 256] = "Abstract"; - NodeFlags[NodeFlags["Async"] = 512] = "Async"; - NodeFlags[NodeFlags["Default"] = 1024] = "Default"; - NodeFlags[NodeFlags["MultiLine"] = 2048] = "MultiLine"; - NodeFlags[NodeFlags["Synthetic"] = 4096] = "Synthetic"; - NodeFlags[NodeFlags["DeclarationFile"] = 8192] = "DeclarationFile"; - NodeFlags[NodeFlags["Let"] = 16384] = "Let"; - NodeFlags[NodeFlags["Const"] = 32768] = "Const"; - NodeFlags[NodeFlags["OctalLiteral"] = 65536] = "OctalLiteral"; - NodeFlags[NodeFlags["Namespace"] = 131072] = "Namespace"; - NodeFlags[NodeFlags["ExportContext"] = 262144] = "ExportContext"; - NodeFlags[NodeFlags["ContainsThis"] = 524288] = "ContainsThis"; - NodeFlags[NodeFlags["Modifier"] = 2035] = "Modifier"; - NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; - NodeFlags[NodeFlags["BlockScoped"] = 49152] = "BlockScoped"; + NodeFlags[NodeFlags["Export"] = 2] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 4] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 8] = "Public"; + NodeFlags[NodeFlags["Private"] = 16] = "Private"; + NodeFlags[NodeFlags["Protected"] = 32] = "Protected"; + NodeFlags[NodeFlags["Static"] = 64] = "Static"; + NodeFlags[NodeFlags["Abstract"] = 128] = "Abstract"; + NodeFlags[NodeFlags["Async"] = 256] = "Async"; + NodeFlags[NodeFlags["Default"] = 512] = "Default"; + NodeFlags[NodeFlags["MultiLine"] = 1024] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 2048] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 4096] = "DeclarationFile"; + NodeFlags[NodeFlags["Let"] = 8192] = "Let"; + NodeFlags[NodeFlags["Const"] = 16384] = "Const"; + NodeFlags[NodeFlags["OctalLiteral"] = 32768] = "OctalLiteral"; + NodeFlags[NodeFlags["Namespace"] = 65536] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 131072] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 262144] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 524288] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 1048576] = "HasExplicitReturn"; + NodeFlags[NodeFlags["Modifier"] = 1022] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 56] = "AccessibilityModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 24576] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 1572864] = "ReachabilityCheckFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); var NodeFlags = ts.NodeFlags; /* @internal */ @@ -690,6 +693,12 @@ var ts; })(ts.LanguageVariant || (ts.LanguageVariant = {})); var LanguageVariant = ts.LanguageVariant; /* @internal */ + (function (DiagnosticStyle) { + DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple"; + DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty"; + })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); + var DiagnosticStyle = ts.DiagnosticStyle; + /* @internal */ (function (CharacterCodes) { CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; @@ -838,40 +847,50 @@ var ts; Ternary[Ternary["True"] = -1] = "True"; })(ts.Ternary || (ts.Ternary = {})); var Ternary = ts.Ternary; - function createFileMap(getCanonicalFileName) { + function createFileMap(keyMapper) { var files = {}; return { get: get, set: set, contains: contains, remove: remove, - clear: clear, - forEachValue: forEachValueInMap + forEachValue: forEachValueInMap, + clear: clear }; - function set(fileName, value) { - files[normalizeKey(fileName)] = value; - } - function get(fileName) { - return files[normalizeKey(fileName)]; - } - function contains(fileName) { - return hasProperty(files, normalizeKey(fileName)); - } - function remove(fileName) { - var key = normalizeKey(fileName); - delete files[key]; - } function forEachValueInMap(f) { - forEachValue(files, f); + for (var key in files) { + f(key, files[key]); + } } - function normalizeKey(key) { - return getCanonicalFileName(normalizeSlashes(key)); + // path should already be well-formed so it does not need to be normalized + function get(path) { + return files[toKey(path)]; + } + function set(path, value) { + files[toKey(path)] = value; + } + function contains(path) { + return hasProperty(files, toKey(path)); + } + function remove(path) { + var key = toKey(path); + delete files[key]; } function clear() { files = {}; } + function toKey(path) { + return keyMapper ? keyMapper(path) : path; + } } ts.createFileMap = createFileMap; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) + ? normalizePath(fileName) + : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts.toPath = toPath; (function (Comparison) { Comparison[Comparison["LessThan"] = -1] = "LessThan"; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; @@ -897,8 +916,8 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; if (v === value) { return true; } @@ -921,8 +940,8 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; if (predicate(v)) { count++; } @@ -935,8 +954,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; if (f(item)) { result.push(item); } @@ -949,8 +968,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; result.push(f(v)); } } @@ -969,8 +988,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { - var item = array[_i]; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; if (!contains(result, item)) { result.push(item); } @@ -981,8 +1000,8 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { - var v = array[_i]; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; result += v[prop]; } return result; @@ -990,8 +1009,8 @@ var ts; ts.sum = sum; function addRange(to, from) { if (to && from) { - for (var _i = 0; _i < from.length; _i++) { - var v = from[_i]; + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; to.push(v); } } @@ -1341,8 +1360,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { - var part = parts[_i]; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); @@ -1521,8 +1540,8 @@ var ts; if (!fileName) { return false; } - for (var _i = 0; _i < ts.supportedExtensions.length; _i++) { - var extension = ts.supportedExtensions[_i]; + for (var _i = 0, supportedExtensions_1 = ts.supportedExtensions; _i < supportedExtensions_1.length; _i++) { + var extension = supportedExtensions_1[_i]; if (fileExtensionIs(fileName, extension)) { return true; } @@ -1532,8 +1551,8 @@ var ts; ts.isSupportedSourceFileName = isSupportedSourceFileName; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { - for (var _i = 0; _i < extensionsToRemove.length; _i++) { - var ext = extensionsToRemove[_i]; + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1614,8 +1633,8 @@ var ts; })(Debug = ts.Debug || (ts.Debug = {})); function copyListRemovingItem(item, list) { var copiedList = []; - for (var _i = 0; _i < list.length; _i++) { - var e = list[_i]; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var e = list_1[_i]; if (e !== item) { copiedList.push(e); } @@ -1709,16 +1728,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; var name_1 = ts.combinePaths(path, current); if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) { result.push(name_1); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _a = 0, subfolders_1 = subfolders; _a < subfolders_1.length; _a++) { + var current = subfolders_1[_a]; var name_2 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_2))) { visitDirectory(name_2); @@ -1769,6 +1788,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _tty = require("tty"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond function createWatchedFileSet(interval, chunkSize) { @@ -1906,8 +1926,8 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { - var current = files[_i]; + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var current = files_2[_i]; var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1921,8 +1941,8 @@ var ts; } } } - for (var _a = 0; _a < directories.length; _a++) { - var current = directories[_a]; + for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { + var current = directories_1[_a]; visitDirectory(current); } } @@ -1932,15 +1952,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, "utf8"); - var offset = 0; - var toWrite = buffer.length; - var written = 0; - // 1 is a standard descriptor for stdout - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } + process.stdout.write(s); }, readFile: readFile, writeFile: writeFile, @@ -2223,6 +2235,7 @@ var ts; await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, + The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2275,7 +2288,7 @@ var ts; Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_th_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "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: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, @@ -2296,7 +2309,7 @@ var ts; Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement_2378", message: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, @@ -2586,8 +2599,6 @@ var ts; NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, @@ -2595,7 +2606,14 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Disallow_inconsistently_cased_references_to_the_same_file: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6073", message: "Disallow inconsistently-cased references to the same file." }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, + Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, + Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, + Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, + Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, + Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -2613,6 +2631,10 @@ var ts; 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: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "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." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, + Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, + Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, + Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -4166,6 +4188,20 @@ var ts; ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; + var Reachability; + (function (Reachability) { + Reachability[Reachability["Unintialized"] = 1] = "Unintialized"; + Reachability[Reachability["Reachable"] = 2] = "Reachable"; + Reachability[Reachability["Unreachable"] = 4] = "Unreachable"; + Reachability[Reachability["ReportedUnreachable"] = 8] = "ReportedUnreachable"; + })(Reachability || (Reachability = {})); + function or(state1, state2) { + return (state1 | state2) & 2 /* Reachable */ + ? 2 /* Reachable */ + : (state1 & state2) & 8 /* ReportedUnreachable */ + ? 8 /* ReportedUnreachable */ + : 4 /* Unreachable */; + } function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations @@ -4175,7 +4211,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && !(node.flags & 2 /* Export */)) { return 0 /* NonInstantiated */; } else if (node.kind === 219 /* ModuleBlock */) { @@ -4226,31 +4262,56 @@ var ts; // Functions, Methods, Modules, Source-files. ContainerFlags[ContainerFlags["IsContainerWithLocals"] = 5] = "IsContainerWithLocals"; })(ContainerFlags || (ContainerFlags = {})); - function bindSourceFile(file) { + var binder = createBinder(); + function bindSourceFile(file, options) { var start = new Date().getTime(); - bindSourceFileWorker(file); + binder(file, options); ts.bindTime += new Date().getTime() - start; } ts.bindSourceFile = bindSourceFile; - function bindSourceFileWorker(file) { + function createBinder() { + var file; + var options; var parent; var container; var blockScopeContainer; var lastContainer; var seenThisKeyword; + // state used by reachability checks + var hasExplicitReturn; + var currentReachabilityState; + var labelStack; + var labelIndexMap; + var implicitLabels; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). - var inStrictMode = !!file.externalModuleIndicator; + var inStrictMode; var symbolCount = 0; - var Symbol = ts.objectAllocator.getSymbolConstructor(); - var classifiableNames = {}; - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; + var Symbol; + var classifiableNames; + function bindSourceFile(f, opts) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } - return; + return bindSourceFile; function createSymbol(flags, name) { symbolCount++; return new Symbol(flags, name); @@ -4303,7 +4364,7 @@ var ts; return node.isExportEquals ? "export=" : "default"; case 213 /* FunctionDeclaration */: case 214 /* ClassDeclaration */: - return node.flags & 1024 /* Default */ ? "default" : undefined; + return node.flags & 512 /* Default */ ? "default" : undefined; } } function getDisplayName(node) { @@ -4319,7 +4380,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 1024 /* Default */; + var isDefaultExport = node.flags & 512 /* Default */; // The exported symbol for an export default function/class node is always named "default" var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; @@ -4358,7 +4419,7 @@ var ts; ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 1024 /* Default */) { + if (declaration.flags & 512 /* Default */) { message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } }); @@ -4377,7 +4438,7 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; + var hasExportModifier = ts.getCombinedNodeFlags(node) & 2 /* Export */; if (symbolFlags & 8388608 /* Alias */) { if (node.kind === 230 /* ExportSpecifier */ || (node.kind === 221 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); @@ -4398,7 +4459,7 @@ var ts; // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & 262144 /* ExportContext */) { + if (hasExportModifier || container.flags & 131072 /* ExportContext */) { var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -4453,18 +4514,229 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - if (node.kind === 215 /* InterfaceDeclaration */) { + var savedReachabilityState; + var savedLabelStack; + var savedLabels; + var savedImplicitLabels; + var savedHasExplicitReturn; + var kind = node.kind; + var flags = node.flags; + // reset all reachability check related flags on node (for incremental scenarios) + flags &= ~1572864 /* ReachabilityCheckFlags */; + if (kind === 215 /* InterfaceDeclaration */) { seenThisKeyword = false; - ts.forEachChild(node, bind); - node.flags = seenThisKeyword ? node.flags | 524288 /* ContainsThis */ : node.flags & ~524288 /* ContainsThis */; } - else { - ts.forEachChild(node, bind); + var saveState = kind === 248 /* SourceFile */ || kind === 219 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + currentReachabilityState = 2 /* Reachable */; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + bindReachableStatement(node); + if (currentReachabilityState === 2 /* Reachable */ && ts.isFunctionLikeKind(kind) && ts.nodeIsPresent(node.body)) { + flags |= 524288 /* HasImplicitReturn */; + if (hasExplicitReturn) { + flags |= 1048576 /* HasExplicitReturn */; + } + } + if (kind === 215 /* InterfaceDeclaration */) { + flags = seenThisKeyword ? flags | 262144 /* ContainsThis */ : flags & ~262144 /* ContainsThis */; + } + node.flags = flags; + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } + /** + * Returns true if node and its subnodes were successfully traversed. + * Returning false means that node was not examined and caller needs to dive into the node himself. + */ + function bindReachableStatement(node) { + if (checkUnreachable(node)) { + ts.forEachChild(node, bind); + return; + } + switch (node.kind) { + case 198 /* WhileStatement */: + bindWhileStatement(node); + break; + case 197 /* DoStatement */: + bindDoStatement(node); + break; + case 199 /* ForStatement */: + bindForStatement(node); + break; + case 200 /* ForInStatement */: + case 201 /* ForOfStatement */: + bindForInOrForOfStatement(node); + break; + case 196 /* IfStatement */: + bindIfStatement(node); + break; + case 204 /* ReturnStatement */: + case 208 /* ThrowStatement */: + bindReturnOrThrow(node); + break; + case 203 /* BreakStatement */: + case 202 /* ContinueStatement */: + bindBreakOrContinueStatement(node); + break; + case 209 /* TryStatement */: + bindTryStatement(node); + break; + case 206 /* SwitchStatement */: + bindSwitchStatement(node); + break; + case 220 /* CaseBlock */: + bindCaseBlock(node); + break; + case 207 /* LabeledStatement */: + bindLabeledStatement(node); + break; + default: + ts.forEachChild(node, bind); + break; + } + } + function bindWhileStatement(n) { + var preWhileState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + var postWhileState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // bind expressions (don't affect reachability) + bind(n.expression); + currentReachabilityState = preWhileState; + var postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + function bindDoStatement(n) { + var preDoState = currentReachabilityState; + var postDoLabel = pushImplicitLabel(); + bind(n.statement); + var postDoState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : preDoState; + popImplicitLabel(postDoLabel, postDoState); + // bind expressions (don't affect reachability) + bind(n.expression); + } + function bindForStatement(n) { + var preForState = currentReachabilityState; + var postForLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + bind(n.statement); + // for statement is considered infinite when it condition is either omitted or is true keyword + // - for(..;;..) + // - for(..;true;..) + var isInfiniteLoop = (!n.condition || n.condition.kind === 99 /* TrueKeyword */); + var postForState = isInfiniteLoop ? 4 /* Unreachable */ : preForState; + popImplicitLabel(postForLabel, postForState); + } + function bindForInOrForOfStatement(n) { + var preStatementState = currentReachabilityState; + var postStatementLabel = pushImplicitLabel(); + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.expression); + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + function bindIfStatement(n) { + // denotes reachability state when entering 'thenStatement' part of the if statement: + // i.e. if condition is false then thenStatement is unreachable + var ifTrueState = n.expression.kind === 84 /* FalseKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + // denotes reachability state when entering 'elseStatement': + // i.e. if condition is true then elseStatement is unreachable + var ifFalseState = n.expression.kind === 99 /* TrueKeyword */ ? 4 /* Unreachable */ : currentReachabilityState; + currentReachabilityState = ifTrueState; + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.thenStatement); + if (n.elseStatement) { + var preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + function bindReturnOrThrow(n) { + // bind expression (don't affect reachability) + bind(n.expression); + if (n.kind === 204 /* ReturnStatement */) { + hasExplicitReturn = true; + } + currentReachabilityState = 4 /* Unreachable */; + } + function bindBreakOrContinueStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + // for continue case touch label so it will be marked a used + var isValidJump = jumpToLabel(n.label, n.kind === 203 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + if (isValidJump) { + currentReachabilityState = 4 /* Unreachable */; + } + } + function bindTryStatement(n) { + // catch\finally blocks has the same reachability as try block + var preTryState = currentReachabilityState; + bind(n.tryBlock); + var postTryState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.catchClause); + var postCatchState = currentReachabilityState; + currentReachabilityState = preTryState; + bind(n.finallyBlock); + // post catch/finally state is reachable if + // - post try state is reachable - control flow can fall out of try block + // - post catch state is reachable - control flow can fall out of catch block + currentReachabilityState = or(postTryState, postCatchState); + } + function bindSwitchStatement(n) { + var preSwitchState = currentReachabilityState; + var postSwitchLabel = pushImplicitLabel(); + // bind expression (don't affect reachability) + bind(n.expression); + bind(n.caseBlock); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 242 /* DefaultClause */; }); + // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case + var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; + popImplicitLabel(postSwitchLabel, postSwitchState); + } + function bindCaseBlock(n) { + var startState = currentReachabilityState; + for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); + } + } + } + function bindLabeledStatement(n) { + // call bind on label (don't affect reachability) + bind(n.label); + var ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } function getContainerFlags(node) { switch (node.kind) { case 186 /* ClassExpression */: @@ -4576,7 +4848,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 128 /* Static */ + return node.flags & 64 /* Static */ ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -4585,15 +4857,6 @@ var ts; ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } - function isAmbientContext(node) { - while (node) { - if (node.flags & 2 /* Ambient */) { - return true; - } - node = node.parent; - } - return false; - } function hasExportDeclarations(node) { var body = node.kind === 248 /* SourceFile */ ? node : node.body; if (body.kind === 248 /* SourceFile */ || body.kind === 219 /* ModuleBlock */) { @@ -4609,11 +4872,11 @@ var ts; function setExportContextFlag(node) { // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. - if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 262144 /* ExportContext */; + if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { + node.flags |= 131072 /* ExportContext */; } else { - node.flags &= ~262144 /* ExportContext */; + node.flags &= ~131072 /* ExportContext */; } } function bindModuleDeclaration(node) { @@ -4805,7 +5068,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.flags & 65536 /* OctalLiteral */) { + if (inStrictMode && node.flags & 32768 /* OctalLiteral */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -4829,10 +5092,10 @@ var ts; function checkStrictModeWithStatement(node) { // Grammar checking for withStatement if (inStrictMode) { - grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } - function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + function errorOnFirstToken(node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } @@ -4840,6 +5103,9 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { + if (!node) { + return; + } node.parent = parent; var savedInStrictMode = inStrictMode; if (!savedInStrictMode) { @@ -4882,8 +5148,8 @@ var ts; } } function updateStrictModeStatementList(statements) { - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -5105,7 +5371,7 @@ var ts; } // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (node.flags & 112 /* AccessibilityModifier */ && + if (node.flags & 56 /* AccessibilityModifier */ && node.parent.kind === 144 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; @@ -5117,6 +5383,112 @@ var ts; ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } + // reachability checks + function pushNamedLabel(name) { + initializeReachabilityStateIfNecessary(); + if (ts.hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(1 /* Unintialized */) - 1; + return true; + } + function pushImplicitLabel() { + initializeReachabilityStateIfNecessary(); + var index = labelStack.push(1 /* Unintialized */) - 1; + implicitLabels.push(index); + return index; + } + function popNamedLabel(label, outerState) { + var index = labelIndexMap[label.text]; + ts.Debug.assert(index !== undefined); + ts.Debug.assert(labelStack.length == index + 1); + labelIndexMap[label.text] = undefined; + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + function popImplicitLabel(implicitLabelIndex, outerState) { + if (labelStack.length !== implicitLabelIndex + 1) { + ts.Debug.assert(false, "Label stack: " + labelStack.length + ", index:" + implicitLabelIndex); + } + var i = implicitLabels.pop(); + if (implicitLabelIndex !== i) { + ts.Debug.assert(false, "i: " + i + ", index: " + implicitLabelIndex); + } + setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); + } + function setCurrentStateAtLabel(innerMergedState, outerState, label) { + if (innerMergedState === 1 /* Unintialized */) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(label, ts.Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + function jumpToLabel(label, outerState) { + initializeReachabilityStateIfNecessary(); + var index = label ? labelIndexMap[label.text] : ts.lastOrUndefined(implicitLabels); + if (index === undefined) { + // reference to unknown label or + // break/continue used outside of loops + return false; + } + var stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === 1 /* Unintialized */ ? outerState : or(stateAtLabel, outerState); + return true; + } + function checkUnreachable(node) { + switch (currentReachabilityState) { + case 4 /* Unreachable */: + var reportError = + // report error on all statements + ts.isStatement(node) || + // report error on class declarations + node.kind === 214 /* ClassDeclaration */ || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === 218 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === 217 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + if (reportError) { + currentReachabilityState = 8 /* ReportedUnreachable */; + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + var reportUnreachableCode = !options.allowUnreachableCode && + !ts.isInAmbientContext(node) && + (node.kind !== 193 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 24576 /* BlockScoped */ || + ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); + if (reportUnreachableCode) { + errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); + } + } + case 8 /* ReportedUnreachable */: + return true; + default: + return false; + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 /* Instantiated */ || (instanceState === 2 /* ConstEnumOnly */ && options.preserveConstEnums); + } + } + function initializeReachabilityStateIfNecessary() { + if (labelIndexMap) { + return; + } + currentReachabilityState = 2 /* Reachable */; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } } })(ts || (ts = {})); /// @@ -5127,8 +5499,8 @@ var ts; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; if (declaration.kind === kind) { return declaration; } @@ -5328,7 +5700,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 49152 /* BlockScoped */) !== 0 || + return (getCombinedNodeFlags(declaration) & 24576 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; @@ -5441,7 +5813,7 @@ var ts; } ts.isExternalModule = isExternalModule; function isDeclarationFile(file) { - return (file.flags & 8192 /* DeclarationFile */) !== 0; + return (file.flags & 4096 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { @@ -5478,11 +5850,11 @@ var ts; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 32768 /* Const */); + return !!(getCombinedNodeFlags(node) & 16384 /* Const */); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 16384 /* Let */); + return !!(getCombinedNodeFlags(node) & 8192 /* Let */); } ts.isLet = isLet; function isPrologueDirective(node) { @@ -5683,27 +6055,28 @@ var ts; } ts.isClassLike = isClassLike; function isFunctionLike(node) { - if (node) { - switch (node.kind) { - case 144 /* Constructor */: - case 173 /* FunctionExpression */: - case 213 /* FunctionDeclaration */: - case 174 /* ArrowFunction */: - case 143 /* MethodDeclaration */: - case 142 /* MethodSignature */: - case 145 /* GetAccessor */: - case 146 /* SetAccessor */: - case 147 /* CallSignature */: - case 148 /* ConstructSignature */: - case 149 /* IndexSignature */: - case 152 /* FunctionType */: - case 153 /* ConstructorType */: - return true; - } - } - return false; + return node && isFunctionLikeKind(node.kind); } ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 144 /* Constructor */: + case 173 /* FunctionExpression */: + case 213 /* FunctionDeclaration */: + case 174 /* ArrowFunction */: + case 143 /* MethodDeclaration */: + case 142 /* MethodSignature */: + case 145 /* GetAccessor */: + case 146 /* SetAccessor */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: + case 149 /* IndexSignature */: + case 152 /* FunctionType */: + case 153 /* ConstructorType */: + return true; + } + } + ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { case 143 /* MethodDeclaration */: @@ -6206,9 +6579,18 @@ var ts; return !!node && (node.kind === 162 /* ArrayBindingPattern */ || node.kind === 161 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 /* Ambient */ | 8192 /* DeclarationFile */)) { + if (node.flags & (4 /* Ambient */ | 4096 /* DeclarationFile */)) { return true; } node = node.parent; @@ -6266,7 +6648,7 @@ var ts; case 207 /* LabeledStatement */: case 204 /* ReturnStatement */: case 206 /* SwitchStatement */: - case 98 /* ThrowKeyword */: + case 208 /* ThrowStatement */: case 209 /* TryStatement */: case 193 /* VariableStatement */: case 198 /* WhileStatement */: @@ -6379,8 +6761,8 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { - var clause = clauses[_i]; + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; if (clause.token === kind) { return clause; } @@ -6392,7 +6774,6 @@ var ts; function tryResolveScriptReference(host, sourceFile, reference) { if (!host.getCompilerOptions().noResolve) { var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); - referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } } @@ -6450,7 +6831,7 @@ var ts; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { - return isFunctionLike(node) && (node.flags & 512 /* Async */) !== 0 && !isAccessor(node); + return isFunctionLike(node) && (node.flags & 256 /* Async */) !== 0 && !isAccessor(node); } ts.isAsyncFunctionLike = isAsyncFunctionLike; /** @@ -6837,7 +7218,7 @@ var ts; else { ts.forEach(declarations, function (member) { if ((member.kind === 145 /* GetAccessor */ || member.kind === 146 /* SetAccessor */) - && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + && (member.flags & 64 /* Static */) === (accessor.flags & 64 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -6894,6 +7275,66 @@ var ts; }); } ts.emitComments = emitComments; + /** + * Detached comment is a comment at the top of file or function body that is separated from + * the next statement by space. + */ + function emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + // There was a blank line between the last comment and this comment. This + // comment is not part of the copyright comments. Return what we have so + // far. + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + // All comments look like they could have been part of the copyright header. Make + // sure there is at least one blank line between it and the node. If not, it's not + // a copyright header. + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + // Valid detachedComments + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } + } + ts.emitDetachedComments = emitDetachedComments; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); @@ -6983,16 +7424,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 113 /* StaticKeyword */: return 128 /* Static */; - case 112 /* PublicKeyword */: return 16 /* Public */; - case 111 /* ProtectedKeyword */: return 64 /* Protected */; - case 110 /* PrivateKeyword */: return 32 /* Private */; - case 115 /* AbstractKeyword */: return 256 /* Abstract */; - case 82 /* ExportKeyword */: return 1 /* Export */; - case 122 /* DeclareKeyword */: return 2 /* Ambient */; - case 74 /* ConstKeyword */: return 32768 /* Const */; - case 77 /* DefaultKeyword */: return 1024 /* Default */; - case 118 /* AsyncKeyword */: return 512 /* Async */; + case 113 /* StaticKeyword */: return 64 /* Static */; + case 112 /* PublicKeyword */: return 8 /* Public */; + case 111 /* ProtectedKeyword */: return 32 /* Protected */; + case 110 /* PrivateKeyword */: return 16 /* Private */; + case 115 /* AbstractKeyword */: return 128 /* Abstract */; + case 82 /* ExportKeyword */: return 2 /* Export */; + case 122 /* DeclareKeyword */: return 4 /* Ambient */; + case 74 /* ConstKeyword */: return 16384 /* Const */; + case 77 /* DefaultKeyword */: return 512 /* Default */; + case 118 /* AsyncKeyword */: return 256 /* Async */; } return 0; } @@ -7073,7 +7514,7 @@ var ts; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isJavaScript(fileName) { @@ -7150,6 +7591,12 @@ var ts; return result; } ts.convertToBase64 = convertToBase64; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !ts.isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /* isAbsolutePathAnUrl */ false); + } + ts.convertToRelativePath = convertToRelativePath; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function getNewLineCharacter(options) { @@ -7414,8 +7861,8 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; var result = cbNode(node); if (result) { return result; @@ -7982,8 +8429,8 @@ var ts; function addJSDocComment(node) { var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); if (comments) { - for (var _i = 0; _i < comments.length; _i++) { - var comment = comments[_i]; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); if (jsDocComment) { node.jsDocComment = jsDocComment; @@ -8021,7 +8468,7 @@ var ts; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 8192 /* DeclarationFile */ : 0; + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 4096 /* DeclarationFile */ : 0; sourceFile.languageVariant = ts.isTsx(sourceFile.fileName) ? 1 /* JSX */ : 0 /* Standard */; return sourceFile; } @@ -9079,7 +9526,7 @@ var ts; if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 65536 /* OctalLiteral */; + node.flags |= 32768 /* OctalLiteral */; } return node; } @@ -9832,7 +10279,7 @@ var ts; // Didn't appear to actually be a parenthesized arrow function. Just bail out. return undefined; } - var isAsync = !!(arrowFunction.flags & 512 /* Async */); + var isAsync = !!(arrowFunction.flags & 256 /* Async */); // 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. var lastToken = token; @@ -9959,7 +10406,7 @@ var ts; function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNode(174 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -10802,7 +11249,7 @@ var ts; var node = createNode(164 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) - node.flags |= 2048 /* MultiLine */; + node.flags |= 1024 /* MultiLine */; node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); parseExpected(20 /* CloseBracketToken */); return finishNode(node); @@ -10863,7 +11310,7 @@ var ts; var node = createNode(165 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 2048 /* MultiLine */; + node.flags |= 1024 /* MultiLine */; } node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); parseExpected(16 /* CloseBraceToken */); @@ -10884,7 +11331,7 @@ var ts; parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : @@ -11476,10 +11923,10 @@ var ts; case 102 /* VarKeyword */: break; case 108 /* LetKeyword */: - node.flags |= 16384 /* Let */; + node.flags |= 8192 /* Let */; break; case 74 /* ConstKeyword */: - node.flags |= 32768 /* Const */; + node.flags |= 16384 /* Const */; break; default: ts.Debug.fail(); @@ -11522,9 +11969,9 @@ var ts; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); - node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); + node.name = node.flags & 512 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 512 /* Async */); + var isAsync = !!(node.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); @@ -11546,7 +11993,7 @@ var ts; method.name = name; method.questionToken = questionToken; var isGenerator = !!asteriskToken; - var isAsync = !!(method.flags & 512 /* Async */); + var isAsync = !!(method.flags & 256 /* Async */); fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); @@ -11567,7 +12014,7 @@ var ts; // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield]; // // The checker may still error in the static case to explicitly disallow the yield expression. - property.initializer = modifiers && modifiers.flags & 128 /* Static */ + property.initializer = modifiers && modifiers.flags & 64 /* Static */ ? allowInAnd(parseNonParameterInitializer) : doOutsideOfContext(2 /* Yield */ | 1 /* DisallowIn */, parseNonParameterInitializer); parseSemicolon(); @@ -11900,13 +12347,13 @@ var ts; var node = createNode(218 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. - var namespaceFlag = flags & 131072 /* Namespace */; + var namespaceFlag = flags & 65536 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 2 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -11921,7 +12368,7 @@ var ts; function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; if (parseOptional(126 /* NamespaceKeyword */)) { - flags |= 131072 /* Namespace */; + flags |= 65536 /* Namespace */; } else { parseExpected(125 /* ModuleKeyword */); @@ -12179,7 +12626,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 /* Export */ + return node.flags & 2 /* Export */ || node.kind === 221 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 232 /* ExternalModuleReference */ || node.kind === 222 /* ImportDeclaration */ || node.kind === 227 /* ExportAssignment */ @@ -12868,8 +13315,8 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var node = array_7[_i]; visitNode(node); } } @@ -13006,8 +13453,8 @@ var ts; array._children = undefined; // Adjust the pos or end (or both) of the intersecting array accordingly. adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { - var node = array[_i]; + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; visitNode(node); } return; @@ -13374,6 +13821,7 @@ var ts; var getInstantiatedGlobalPromiseLikeType; var getGlobalPromiseConstructorLikeType; var getGlobalThenableType; + var jsxElementClassType; var tupleTypes = {}; var unionTypes = {}; var intersectionTypes = {}; @@ -13643,7 +14091,7 @@ var ts; } var initializerOfNonStaticProperty = current.parent && current.parent.kind === 141 /* PropertyDeclaration */ && - (current.parent.flags & 128 /* Static */) === 0 && + (current.parent.flags & 64 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -13725,7 +14173,7 @@ var ts; // 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. - if (ts.isClassLike(location.parent) && !(location.flags & 128 /* Static */)) { + if (ts.isClassLike(location.parent) && !(location.flags & 64 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -13739,7 +14187,7 @@ var ts; case 186 /* ClassExpression */: case 215 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { - if (lastLocation && lastLocation.flags & 128 /* Static */) { + if (lastLocation && lastLocation.flags & 64 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // 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. @@ -14267,8 +14715,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { - var member = members[_i]; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; if (member.kind === 144 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } @@ -14515,7 +14963,7 @@ var ts; // because these kind of aliases can be used to name types in declaration file var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 1 /* Export */) && + !(anyImportSyntax.flags & 2 /* Export */) && isDeclarationVisible(anyImportSyntax.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { @@ -14669,8 +15117,8 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { - var accessibleSymbol = accessibleSymbolChain[_i]; + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } @@ -14860,7 +15308,7 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 64 /* Static */; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { @@ -14971,8 +15419,8 @@ var ts; var t = getTypeOfSymbol(p); if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); - for (var _f = 0; _f < signatures.length; _f++) { - var signature = signatures[_f]; + for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { + var signature = signatures_1[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { writePunctuation(writer, 53 /* QuestionToken */); @@ -15186,7 +15634,7 @@ var ts; case 221 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) - if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && + if (!(ts.getCombinedNodeFlags(node) & 2 /* Export */) && !(node.kind !== 221 /* ImportEqualsDeclaration */ && parent_4.kind !== 248 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } @@ -15198,7 +15646,7 @@ var ts; case 146 /* SetAccessor */: case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.flags & (32 /* Private */ | 64 /* Protected */)) { + if (node.flags & (16 /* Private */ | 32 /* Protected */)) { // Private/protected properties/methods are not visible return false; } @@ -15728,8 +16176,8 @@ var ts; // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set // in-place and returns the same array. function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -15934,13 +16382,13 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.kind === 215 /* InterfaceDeclaration */) { - if (declaration.flags & 524288 /* ContainsThis */) { + if (declaration.flags & 262144 /* ContainsThis */) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); if (baseTypeNodes) { - for (var _b = 0; _b < baseTypeNodes.length; _b++) { - var node = baseTypeNodes[_b]; + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; if (ts.isSupportedExpressionWithTypeArguments(node)) { var baseSymbol = resolveEntityName(node.expression, 793056 /* Type */, /*ignoreErrors*/ true); if (!baseSymbol || !(baseSymbol.flags & 64 /* Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { @@ -16130,8 +16578,8 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; result[symbol.name] = symbol; } return result; @@ -16140,15 +16588,15 @@ var ts; // we check symbols to see if we can quickly conclude they are free of "this" references, thus needing no instantiation. function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { - var s = baseSymbols[_i]; + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -16156,8 +16604,8 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { - var signature = baseSignatures[_i]; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var signature = baseSignatures_1[_i]; signatures.push(signature); } } @@ -16200,8 +16648,8 @@ var ts; members = createSymbolTable(source.declaredProperties); } var thisArgument = ts.lastOrUndefined(typeArguments); - for (var _i = 0; _i < baseTypes.length; _i++) { - var baseType = baseTypes[_i]; + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); @@ -16247,8 +16695,8 @@ var ts; var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); var typeArgCount = typeArguments ? typeArguments.length : 0; var result = []; - for (var _i = 0; _i < baseSignatures.length; _i++) { - var baseSig = baseSignatures[_i]; + for (var _i = 0, baseSignatures_2 = baseSignatures; _i < baseSignatures_2.length; _i++) { + var baseSig = baseSignatures_2[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); @@ -16277,8 +16725,8 @@ var ts; setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { - for (var _i = 0; _i < signatureList.length; _i++) { - var s = signatureList[_i]; + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } @@ -16342,8 +16790,8 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type = types_1[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; @@ -16522,12 +16970,12 @@ var ts; function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (32 /* Private */ | 64 /* Protected */))) { + if (prop && !(getDeclarationFlagsFromSymbol(prop) & (16 /* Private */ | 32 /* Protected */))) { if (!props) { props = [prop]; } @@ -16549,8 +16997,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var prop = props[_a]; + for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { + var prop = props_1[_a]; if (prop.declarations) { ts.addRange(declarations, prop.declarations); } @@ -16908,8 +17356,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type = types_3[_i]; result |= type.flags; } return result & 14680064 /* PropagatingFlags */; @@ -17059,8 +17507,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; switch (declaration.kind) { case 214 /* ClassDeclaration */: case 215 /* InterfaceDeclaration */: @@ -17170,8 +17618,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToSet(typeSet, types, typeSetKind) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; addTypeToSet(typeSet, type, typeSetKind); } } @@ -17193,8 +17641,8 @@ var ts; } } function containsTypeAny(types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (isTypeAny(type)) { return true; } @@ -17310,7 +17758,8 @@ var ts; var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; if (parent && (ts.isClassLike(parent) || parent.kind === 215 /* InterfaceDeclaration */)) { - if (!(container.flags & 128 /* Static */)) { + if (!(container.flags & 64 /* Static */) && + (container.kind !== 144 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -17377,8 +17826,8 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { - var v = items[_i]; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var v = items_1[_i]; result.push(instantiator(v, mapper)); } return result; @@ -17417,8 +17866,8 @@ var ts; case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { - var source = sources[_i]; + for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { + var source = sources_1[_i]; if (t === source) { return anyType; } @@ -17836,8 +18285,8 @@ var ts; function eachTypeRelatedToSomeType(source, target) { var result = -1 /* True */; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; var related = typeRelatedToSomeType(sourceType, target, false); if (!related) { return 0 /* False */; @@ -17859,8 +18308,8 @@ var ts; function typeRelatedToEachType(source, target, reportErrors) { var result = -1 /* True */; var targetTypes = target.types; - for (var _i = 0; _i < targetTypes.length; _i++) { - var targetType = targetTypes[_i]; + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var targetType = targetTypes_1[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0 /* False */; @@ -17882,8 +18331,8 @@ var ts; function eachTypeRelatedToType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { - var sourceType = sourceTypes[_i]; + for (var _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { + var sourceType = sourceTypes_2[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0 /* False */; @@ -18008,8 +18457,8 @@ var ts; var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 524288 /* ObjectLiteral */); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var targetProp = properties_1[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -18023,20 +18472,20 @@ var ts; else if (!(targetProp.flags & 134217728 /* Prototype */)) { var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourcePropFlags & 32 /* Private */ || targetPropFlags & 32 /* Private */) { + if (sourcePropFlags & 16 /* Private */ || targetPropFlags & 16 /* Private */) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourcePropFlags & 32 /* Private */ && targetPropFlags & 32 /* Private */) { + if (sourcePropFlags & 16 /* Private */ && targetPropFlags & 16 /* 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(sourcePropFlags & 32 /* Private */ ? source : target), typeToString(sourcePropFlags & 32 /* Private */ ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 16 /* Private */ ? source : target), typeToString(sourcePropFlags & 16 /* Private */ ? target : source)); } } return 0 /* False */; } } - else if (targetPropFlags & 64 /* Protected */) { + else if (targetPropFlags & 32 /* Protected */) { var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); @@ -18047,7 +18496,7 @@ var ts; return 0 /* False */; } } - else if (sourcePropFlags & 64 /* Protected */) { + else if (sourcePropFlags & 32 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -18089,8 +18538,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0 /* False */; @@ -18130,13 +18579,13 @@ var ts; return result; } } - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { - var t = targetSignatures[_i]; + outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; if (!t.hasStringLiterals || target.flags & 262144 /* FromSignature */) { var localErrors = reportErrors; var checkedAbstractAssignability = false; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { + var s = sourceSignatures_1[_a]; if (!s.hasStringLiterals || source.flags & 262144 /* FromSignature */) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -18167,8 +18616,8 @@ var ts; var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 128 /* Abstract */; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 128 /* Abstract */; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. if (reportErrors) { @@ -18284,7 +18733,7 @@ var ts; var targetType = getIndexTypeOfType(target, 0 /* String */); if (targetType) { if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg + // non-primitive assignment to any is always allowed, eg // `var x: { [index: string]: any } = { property: 12 };` return -1 /* True */; } @@ -18313,7 +18762,7 @@ var ts; var targetType = getIndexTypeOfType(target, 1 /* Number */); if (targetType) { if ((targetType.flags & 1 /* Any */) && !(originalSource.flags & 16777726 /* Primitive */)) { - // non-primitive assignment to any is always allowed, eg + // non-primitive assignment to any is always allowed, eg // `var x: { [index: number]: any } = { property: 12 };` return -1 /* True */; } @@ -18386,8 +18835,8 @@ var ts; if (sourceProp === targetProp) { return -1 /* True */; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (16 /* Private */ | 32 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (16 /* Private */ | 32 /* Protected */); if (sourcePropAccessibility !== targetPropAccessibility) { return 0 /* False */; } @@ -18455,8 +18904,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } @@ -18692,8 +19141,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { - var unused = typeParameters[_i]; + for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { + var unused = typeParameters_1[_i]; inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); @@ -18774,8 +19223,8 @@ var ts; var typeParameterCount = 0; var typeParameter; // First infer to each type in union or intersection that isn't a type parameter - for (var _i = 0; _i < targetTypes.length; _i++) { - var t = targetTypes[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var t = targetTypes_2[_i]; if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -18797,8 +19246,8 @@ var ts; else if (source.flags & 49152 /* UnionOrIntersection */) { // Source is a union or intersection type, infer from each consituent type var sourceTypes = source.types; - for (var _a = 0; _a < sourceTypes.length; _a++) { - var sourceType = sourceTypes[_a]; + for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) { + var sourceType = sourceTypes_3[_a]; inferFromTypes(sourceType, target); } } @@ -18832,8 +19281,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { - var targetProp = properties[_i]; + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var targetProp = properties_2[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -19324,9 +19773,9 @@ var ts; symbol.valueDeclaration.parent.kind === 244 /* CatchClause */) { return; } - // 1. walk from the use site up to the declaration and check + // 1. walk from the use site up to the declaration and check // if there is anything function like between declaration and use-site (is binding/class is captured in function). - // 2. walk from the declaration up to the boundary of lexical environment and check + // 2. walk from the declaration up to the boundary of lexical environment and check // if there is an iteration statement in between declaration and boundary (is binding/class declared inside iteration statement) var container; if (symbol.flags & 32 /* Class */) { @@ -19398,7 +19847,7 @@ var ts; break; case 141 /* PropertyDeclaration */: case 140 /* PropertySignature */: - if (container.flags & 128 /* Static */) { + if (container.flags & 64 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -19411,7 +19860,7 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return container.flags & 64 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } @@ -19441,7 +19890,7 @@ var ts; var nodeCheckFlag = 0; // always set NodeCheckFlags for 'super' expression node if (canUseSuperExpression) { - if ((container.flags & 128 /* Static */) || isCallExpression) { + if ((container.flags & 64 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } else { @@ -19497,7 +19946,7 @@ var ts; // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { - if (container.flags & 128 /* Static */) { + if (container.flags & 64 /* Static */) { return container.kind === 143 /* MethodDeclaration */ || container.kind === 142 /* MethodSignature */ || container.kind === 145 /* GetAccessor */ || @@ -19654,8 +20103,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var current = types_7[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -19845,8 +20294,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var current = types_8[_i]; var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { @@ -19926,8 +20375,8 @@ var ts; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); - for (var _i = 0; _i < elements.length; _i++) { - var e = elements[_i]; + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var e = elements_1[_i]; if (inDestructuringPattern && e.kind === 185 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; @@ -20259,8 +20708,8 @@ var ts; function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { var type = checkExpression(node.expression); var props = getPropertiesOfType(type); - for (var _i = 0; _i < props.length; _i++) { - var prop = props[_i]; + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; // Is there a corresponding property in the element attributes type? Skip checking of properties // that have already been assigned to, as these are not actually pushed into the resulting type if (!nameTable[prop.name]) { @@ -20479,7 +20928,6 @@ var ts; var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } - var jsxElementClassType = undefined; function getJsxGlobalElementClassType() { if (!jsxElementClassType) { jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); @@ -20558,7 +21006,7 @@ var ts; return s.valueDeclaration ? s.valueDeclaration.kind : 141 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 8 /* Public */ | 64 /* Static */ : 0; } /** * Check whether the requested property access is valid. @@ -20588,7 +21036,7 @@ var ts; error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -20598,7 +21046,7 @@ var ts; } } // Public properties are otherwise accessible. - if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + if (!(flags & (16 /* Private */ | 32 /* Protected */))) { return true; } // Property is known to be private or protected at this point @@ -20606,7 +21054,7 @@ var ts; var enclosingClassDeclaration = ts.getContainingClass(node); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; // Private property is accessible if declaring and enclosing class are the same - if (flags & 32 /* Private */) { + if (flags & 16 /* Private */) { if (declaringClass !== enclosingClass) { error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; @@ -20624,7 +21072,7 @@ var ts; return false; } // No further restrictions for static properties - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return true; } // An instance property must be accessed through an instance of the enclosing class @@ -20851,8 +21299,8 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { - var signature = signatures[_i]; + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { @@ -21494,8 +21942,8 @@ var ts; // declare function f(a: { xa: number; xb: number; }); // f({ | if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { - var candidate = candidates[_i]; + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; if (hasCorrectArity(node, args, candidate)) { if (candidate.typeParameters && typeArguments) { candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); @@ -21514,8 +21962,8 @@ var ts; diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); } function chooseOverload(candidates, relation) { - for (var _i = 0; _i < candidates.length; _i++) { - var originalCandidate = candidates[_i]; + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var originalCandidate = candidates_2[_i]; if (!hasCorrectArity(node, args, originalCandidate)) { continue; } @@ -21652,7 +22100,7 @@ var ts; // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && valueDecl.flags & 256 /* Abstract */) { + if (valueDecl && valueDecl.flags & 128 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); } @@ -22017,19 +22465,11 @@ var ts; }); return aggregatedTypes; } - function bodyContainsAReturnStatement(funcBody) { - return ts.forEachReturnStatement(funcBody, function (returnStatement) { - return true; - }); - } - function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 208 /* ThrowStatement */); - } // TypeScript Specification 1.0 (6.3) - July 2014 // 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. - function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (!produceDiagnostics) { return; } @@ -22038,22 +22478,19 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */) { + // also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192 /* Block */ || !(func.flags & 524288 /* HasImplicitReturn */)) { return; } - var bodyBlock = func.body; - // Ensure the body has at least one return expression. - if (bodyContainsAReturnStatement(bodyBlock)) { - return; + if (func.flags & 1048576 /* HasExplicitReturn */) { + if (compilerOptions.noImplicitReturns) { + error(func.type, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } - // If there are no return expressions, then we need to check if - // the function body consists solely of a throw statement; - // this is to make an exception for unimplemented functions. - if (bodyContainsSingleThrowStatement(bodyBlock)) { - return; + else { + // This function does not conform to the specification. + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } - // This function does not conform to the specification. - error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { ts.Debug.assert(node.kind !== 143 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); @@ -22120,7 +22557,7 @@ var ts; promisedType = checkAsyncFunctionReturnType(node); } if (returnType && !node.asteriskToken) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (node.body) { if (!node.type) { @@ -22205,7 +22642,7 @@ var ts; case 69 /* Identifier */: case 166 /* PropertyAccessExpression */: { var symbol = findSymbol(n); - return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; + return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 16384 /* Const */) !== 0; } case 167 /* ElementAccessExpression */: { var index = n.argumentExpression; @@ -22213,7 +22650,7 @@ var ts; if (symbol && index && index.kind === 9 /* StringLiteral */) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); - return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768 /* Const */) !== 0; + return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 16384 /* Const */) !== 0; } return false; } @@ -22298,8 +22735,8 @@ var ts; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var current = types_9[_i]; if (current.flags & kind) { return true; } @@ -22315,8 +22752,8 @@ var ts; } if (type.flags & 49152 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { - var current = types[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var current = types_10[_i]; if (!(current.flags & kind)) { return false; } @@ -22361,8 +22798,8 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { - var p = properties[_i]; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var p = properties_3[_i]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; @@ -22896,7 +23333,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 112 /* AccessibilityModifier */) { + if (node.flags & 56 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); if (!(func.kind === 144 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -23096,7 +23533,7 @@ var ts; checkFunctionLikeDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. - if (node.flags & 256 /* Abstract */ && node.body) { + if (node.flags & 128 /* Abstract */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -23147,7 +23584,7 @@ var ts; } function isInstancePropertyWithInitializer(n) { return n.kind === 141 /* PropertyDeclaration */ && - !(n.flags & 128 /* Static */) && + !(n.flags & 64 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 @@ -23168,14 +23605,14 @@ var ts; // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + ts.forEach(node.parameters, function (p) { return p.flags & (8 /* Public */ | 16 /* Private */ | 32 /* Protected */); }); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement; - for (var _i = 0; _i < statements.length; _i++) { - var statement = statements[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (statement.kind === 195 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; @@ -23203,8 +23640,15 @@ var ts; // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); if (node.kind === 145 /* GetAccessor */) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(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); + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 524288 /* HasImplicitReturn */)) { + if (node.flags & 1048576 /* HasExplicitReturn */) { + if (compilerOptions.noImplicitReturns) { + error(node.name, ts.Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); + } } } if (!ts.hasDynamicName(node)) { @@ -23213,7 +23657,7 @@ var ts; var otherKind = node.kind === 145 /* GetAccessor */ ? 146 /* SetAccessor */ : 145 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { + if (((node.flags & 56 /* AccessibilityModifier */) !== (otherAccessor.flags & 56 /* AccessibilityModifier */))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var currentAccessorType = getAnnotatedAccessorType(node); @@ -23284,7 +23728,7 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); + return (node.flags & 16 /* Private */) && ts.isInAmbientContext(node); } function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { if (!produceDiagnostics) { @@ -23316,8 +23760,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { - var otherSignature = signaturesToCheck[_i]; + for (var _i = 0, signaturesToCheck_1 = signaturesToCheck; _i < signaturesToCheck_1.length; _i++) { + var otherSignature = signaturesToCheck_1[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -23332,11 +23776,11 @@ var ts; n.parent.kind !== 214 /* ClassDeclaration */ && n.parent.kind !== 186 /* ClassExpression */ && ts.isInAmbientContext(n)) { - if (!(flags & 2 /* Ambient */)) { + if (!(flags & 4 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported - flags |= 1 /* Export */; + flags |= 2 /* Export */; } - flags |= 2 /* Ambient */; + flags |= 4 /* Ambient */; } return flags & flagsToCheck; } @@ -23361,16 +23805,16 @@ var ts; var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 1 /* Export */) { + if (deviation & 2 /* Export */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } - else if (deviation & 2 /* Ambient */) { + else if (deviation & 4 /* Ambient */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + else if (deviation & (16 /* Private */ | 32 /* Protected */)) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 256 /* Abstract */) { + else if (deviation & 128 /* Abstract */) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract); } }); @@ -23387,7 +23831,7 @@ var ts; }); } } - var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */ | 256 /* Abstract */; + var flagsToCheck = 2 /* Export */ | 4 /* Ambient */ | 16 /* Private */ | 32 /* Protected */ | 128 /* Abstract */; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -23418,8 +23862,8 @@ var ts; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - 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; + 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; error(errorNode_1, diagnostic); return; } @@ -23436,7 +23880,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -23449,8 +23893,8 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536 /* Module */; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 215 /* InterfaceDeclaration */ || node.parent.kind === 155 /* TypeLiteral */ || inAmbientContext; @@ -23507,7 +23951,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 256 /* Abstract */)) { + !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */)) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -23533,8 +23977,8 @@ var ts; // function g(x: string, y: string) { } // // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { + var signature = signatures_3[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -23571,9 +24015,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 1024 /* Default */); - if (effectiveDeclarationFlags & 1 /* Export */) { - if (effectiveDeclarationFlags & 1024 /* Default */) { + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 2 /* Export */ | 512 /* Default */); + if (effectiveDeclarationFlags & 2 /* Export */) { + if (effectiveDeclarationFlags & 512 /* Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -23826,9 +24270,12 @@ var ts; // type as a value. As such, we will just return unknownType; return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } // Validate the promise constructor type. @@ -24020,7 +24467,7 @@ var ts; if (isAsync) { promisedType = checkAsyncFunctionReturnType(node); } - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method @@ -24162,7 +24609,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -24177,7 +24624,7 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 24576 /* BlockScoped */) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212 /* VariableDeclarationList */); var container = varDeclList.parent.kind === 193 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent @@ -24330,6 +24777,9 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 194 /* EmptyStatement */) { + error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } checkSourceElement(node.elseStatement); } function checkDoStatement(node) { @@ -24688,7 +25138,7 @@ var ts; error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else if (func.kind === 144 /* Constructor */) { - if (!isTypeAssignableTo(exprType, returnType)) { + if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } @@ -24835,7 +25285,7 @@ var ts; // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!(member.flags & 128 /* Static */) && ts.hasDynamicName(member)) { + if (!(member.flags & 64 /* Static */) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); @@ -24921,7 +25371,7 @@ var ts; return getTypeOfSymbol(getSymbolOfNode(node)); } function checkClassDeclaration(node) { - if (!node.name && !(node.flags & 1024 /* Default */)) { + if (!node.name && !(node.flags & 512 /* Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -24975,8 +25425,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - for (var _b = 0; _b < implementedTypeNodes.length; _b++) { - var typeRefNode = implementedTypeNodes[_b]; + for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { + var typeRefNode = implementedTypeNodes_1[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -25024,8 +25474,8 @@ var ts; // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { - var baseProperty = baseProperties[_i]; + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728 /* Prototype */) { continue; @@ -25043,7 +25493,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { + if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 128 /* Abstract */))) { if (derivedClassDecl.kind === 186 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } @@ -25055,11 +25505,11 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { + if ((baseDeclarationFlags & 16 /* Private */) || (derivedDeclarationFlags & 16 /* Private */)) { // either base or derived property is private - not override, skip it continue; } - if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { + if ((baseDeclarationFlags & 64 /* Static */) !== (derivedDeclarationFlags & 64 /* Static */)) { // value of 'static' is not the same for properties - not override, skip it continue; } @@ -25130,11 +25580,11 @@ var ts; var seen = {}; ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var _i = 0; _i < baseTypes.length; _i++) { - var base = baseTypes[_i]; + for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { + var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0; _a < properties.length; _a++) { - var prop = properties[_a]; + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } @@ -25431,8 +25881,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; if ((declaration.kind === 214 /* ClassDeclaration */ || (declaration.kind === 213 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { @@ -25571,7 +26021,7 @@ var ts; // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -25599,7 +26049,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -25630,7 +26080,7 @@ var ts; // If we hit an export in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -25674,7 +26124,7 @@ var ts; return; } // Grammar checking - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1022 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 69 /* Identifier */) { @@ -26087,7 +26537,7 @@ var ts; // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. - if (!(memberFlags & 128 /* Static */)) { + if (!(memberFlags & 64 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; @@ -26388,7 +26838,7 @@ var ts; */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 128 /* Static */ + return node.flags & 64 /* Static */ ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -26709,7 +27159,7 @@ var ts; function initializeTypeChecker() { // Bind all source files and propagate errors ts.forEach(host.getSourceFiles(), function (file) { - ts.bindSourceFile(file); + ts.bindSourceFile(file, compilerOptions); }); // Initialize global symbol table ts.forEach(host.getSourceFiles(), function (file) { @@ -26863,19 +27313,19 @@ var ts; text = "private"; lastPrivate = modifier; } - if (flags & 112 /* AccessibilityModifier */) { + if (flags & 56 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 128 /* Static */) { + else if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { if (modifier.kind === 110 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -26886,10 +27336,10 @@ var ts; flags |= ts.modifierToFlag(modifier.kind); break; case 113 /* StaticKeyword */: - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === 219 /* ModuleBlock */ || node.parent.kind === 248 /* SourceFile */) { @@ -26898,23 +27348,23 @@ var ts; else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - flags |= 128 /* Static */; + flags |= 64 /* Static */; lastStatic = modifier; break; case 82 /* ExportKeyword */: - if (flags & 1 /* Export */) { + if (flags & 2 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 2 /* Ambient */) { + else if (flags & 4 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 256 /* Abstract */) { + else if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (node.parent.kind === 214 /* ClassDeclaration */) { @@ -26923,13 +27373,13 @@ var ts; else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 1 /* Export */; + flags |= 2 /* Export */; break; case 122 /* DeclareKeyword */: - if (flags & 2 /* Ambient */) { + if (flags & 4 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.parent.kind === 214 /* ClassDeclaration */) { @@ -26941,69 +27391,69 @@ var ts; else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 2 /* Ambient */; + flags |= 4 /* Ambient */; lastDeclare = modifier; break; case 115 /* AbstractKeyword */: - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } if (node.kind !== 214 /* ClassDeclaration */) { if (node.kind !== 143 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 214 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } - if (flags & 32 /* Private */) { + if (flags & 16 /* Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } } - flags |= 256 /* Abstract */; + flags |= 128 /* Abstract */; break; case 118 /* AsyncKeyword */: - if (flags & 512 /* Async */) { + if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } - else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { + else if (flags & 4 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (node.kind === 138 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - flags |= 512 /* Async */; + flags |= 256 /* Async */; lastAsync = modifier; break; } } if (node.kind === 144 /* Constructor */) { - if (flags & 128 /* Static */) { + if (flags & 64 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - if (flags & 256 /* Abstract */) { + if (flags & 128 /* Abstract */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); } - else if (flags & 64 /* Protected */) { + else if (flags & 32 /* Protected */) { return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (flags & 32 /* Private */) { + else if (flags & 16 /* Private */) { return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (flags & 512 /* Async */) { + else if (flags & 256 /* Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return; } - else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 222 /* ImportDeclaration */ || node.kind === 221 /* ImportEqualsDeclaration */) && flags & 4 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 138 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 /* Parameter */ && (flags & 56 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } - if (flags & 512 /* Async */) { + if (flags & 256 /* Async */) { return checkGrammarAsyncModifier(node, lastAsync); } } @@ -27104,7 +27554,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 2035 /* Modifier */) { + if (parameter.flags & 1022 /* Modifier */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -27124,7 +27574,7 @@ var ts; } } function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 2035 /* Modifier */) { + if (node.flags & 1022 /* Modifier */) { grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } } @@ -27147,8 +27597,8 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < args.length; _i++) { - var arg = args[_i]; + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; if (arg.kind === 187 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -27403,7 +27853,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 2035 /* Modifier */) { + else if (parameter.flags & 1022 /* Modifier */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } else if (parameter.questionToken) { @@ -27554,8 +28004,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { - var element = elements[_i]; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; if (element.kind !== 187 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -27691,8 +28141,8 @@ var ts; node.kind === 221 /* ImportEqualsDeclaration */ || node.kind === 228 /* ExportDeclaration */ || node.kind === 227 /* ExportAssignment */ || - (node.flags & 2 /* Ambient */) || - (node.flags & (1 /* Export */ | 1024 /* Default */))) { + (node.flags & 4 /* Ambient */) || + (node.flags & (2 /* Export */ | 512 /* Default */))) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -27739,7 +28189,7 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.flags & 65536 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { + if (node.flags & 32768 /* OctalLiteral */ && languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -27793,7 +28243,7 @@ var ts; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); // All the references that are not going to be part of same file - if (referencedFile && ((referencedFile.flags & 8192 /* DeclarationFile */) || + if (referencedFile && ((referencedFile.flags & 4096 /* DeclarationFile */) || ts.shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); @@ -27988,15 +28438,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { + var node = nodes_3[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -28142,6 +28592,7 @@ var ts; function emitSourceFile(node) { currentSourceFile = node; enclosingDeclaration = node; + ts.emitDetachedComments(currentSourceFile, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -28258,10 +28709,10 @@ var ts; // If the node is parented in the current source file we need to emit export declare or just export if (node.parent === currentSourceFile) { // If the node is exported - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } else if (node.kind !== 215 /* InterfaceDeclaration */) { @@ -28270,16 +28721,16 @@ var ts; } } function emitClassMemberDeclarationFlags(node) { - if (node.flags & 32 /* Private */) { + if (node.flags & 16 /* Private */) { write("private "); } - else if (node.flags & 64 /* Protected */) { + else if (node.flags & 32 /* Protected */) { write("protected "); } - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* Static */) { write("static "); } - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { write("abstract "); } } @@ -28287,7 +28738,7 @@ var ts; // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } write("import "); @@ -28322,12 +28773,12 @@ var ts; } } function writeImportDeclaration(node) { - if (!node.importClause && !(node.flags & 1 /* Export */)) { + if (!node.importClause && !(node.flags & 2 /* Export */)) { // do not write non-exported import declarations that don't have import clauses return; } emitJsDocComments(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { write("export "); } write("import "); @@ -28392,7 +28843,7 @@ var ts; function writeModuleDeclaration(node) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 131072 /* Namespace */) { + if (node.flags & 65536 /* Namespace */) { write("namespace "); } else { @@ -28464,7 +28915,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 143 /* MethodDeclaration */ && (node.parent.flags & 16 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -28508,7 +28959,7 @@ var ts; break; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { + if (node.parent.flags & 64 /* Static */) { diagnosticMessage = 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 === 214 /* ClassDeclaration */) { @@ -28574,7 +29025,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 56 /* AccessibilityModifier */) { emitPropertyDeclaration(param); } }); @@ -28582,7 +29033,7 @@ var ts; } emitJsDocComments(node); emitModuleElementDeclarationFlags(node); - if (node.flags & 256 /* Abstract */) { + if (node.flags & 128 /* Abstract */) { write("abstract "); } write("class "); @@ -28652,7 +29103,7 @@ var ts; if ((node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) && node.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 32 /* Private */)) { + else if (!(node.flags & 16 /* Private */)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } @@ -28667,7 +29118,7 @@ var ts; } else if (node.kind === 141 /* PropertyDeclaration */ || node.kind === 140 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* Static */) { return 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 : @@ -28771,7 +29222,7 @@ var ts; emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); - if (!(node.flags & 32 /* Private */)) { + if (!(node.flags & 16 /* Private */)) { accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { @@ -28800,7 +29251,7 @@ var ts; var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 146 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named - if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { + if (accessorWithTypeAnnotation.parent.flags & 64 /* 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; @@ -28818,7 +29269,7 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 128 /* Static */) { + if (accessorWithTypeAnnotation.flags & 64 /* 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 : @@ -28905,7 +29356,7 @@ var ts; emitType(node.type); } } - else if (node.kind !== 144 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 144 /* Constructor */ && !(node.flags & 16 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -28936,7 +29387,7 @@ var ts; break; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.flags & 128 /* Static */) { + if (node.flags & 64 /* 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 : @@ -28997,7 +29448,7 @@ var ts; node.parent.parent.kind === 155 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 32 /* Private */)) { + else if (!(node.parent.flags & 16 /* Private */)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { @@ -29028,7 +29479,7 @@ var ts; ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { + if (node.parent.flags & 64 /* Static */) { return 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 : @@ -29170,7 +29621,7 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 8192 /* DeclarationFile */ + var declFileName = referencedFile.flags & 4096 /* DeclarationFile */ ? referencedFile.fileName // Declaration file, use declaration file name : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file @@ -29216,6 +29667,12 @@ var ts; return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + var Jump; + (function (Jump) { + Jump[Jump["Break"] = 2] = "Break"; + Jump[Jump["Continue"] = 4] = "Continue"; + Jump[Jump["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); var entities = { "quot": 0x0022, "amp": 0x0026, @@ -29525,16 +29982,8 @@ var ts; diagnostics: diagnostics, sourceMaps: sourceMapDataList }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && ts.hasProperty(node.locals, name)) { // We conservatively include alias symbols to cover cases where they're emitted as locals if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { @@ -29544,12 +29993,6 @@ var ts; } return true; } - var Jump; - (function (Jump) { - Jump[Jump["Break"] = 2] = "Break"; - Jump[Jump["Continue"] = 4] = "Continue"; - Jump[Jump["Return"] = 8] = "Return"; - })(Jump || (Jump = {})); function setLabeledJump(state, isBreak, labelText, labelMarker) { if (isBreak) { if (!state.labeledNonLocalBreaks) { @@ -31026,7 +31469,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 1024 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -31045,7 +31488,7 @@ var ts; emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); } else { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; if (!multiLine) { write(" "); } @@ -31064,7 +31507,7 @@ var ts; write("}"); } function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; + var multiLine = (node.flags & 1024 /* MultiLine */) !== 0; var properties = node.properties; write("("); if (multiLine) { @@ -31693,7 +32136,7 @@ var ts; var current = node; while (current) { if (current.kind === 248 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + return !isExported || ((ts.getCombinedNodeFlags(node) & 2 /* Export */) !== 0); } else if (ts.isFunctionLike(current) || current.kind === 219 /* ModuleBlock */) { return false; @@ -31934,7 +32377,7 @@ var ts; // variables in variable declaration list were already hoisted return false; } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 49152 /* BlockScoped */) === 0) { + if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 24576 /* BlockScoped */) === 0) { // we are inside a converted loop - this can only happen in downlevel scenarios // record names for all variable declarations for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { @@ -32019,7 +32462,7 @@ var ts; break; } var loopParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 49152 /* BlockScoped */)) { + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 24576 /* BlockScoped */)) { // if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters loopParameters = []; for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { @@ -32334,10 +32777,12 @@ var ts; // // for (let v of arr) { } // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 69 /* Identifier */; + // we can't reuse 'arr' because it might be modified within the body of the loop. var counter = createTempVariable(268435456 /* _i */); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); + var rhsReference = ts.createSynthesizedNode(69 /* Identifier */); + rhsReference.text = node.expression.kind === 69 /* Identifier */ ? + makeUniqueName(node.expression.text) : + makeTempVariableName(0 /* Auto */); // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. emitStart(node.expression); @@ -32346,15 +32791,13 @@ var ts; emitNodeWithoutSourceMap(counter); write(" = 0"); emitEnd(node.expression); - if (!rhsIsIdentifier) { - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } + // , _a = expr + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); write("; "); // _i < _a.length; emitStart(node.initializer); @@ -32609,7 +33052,7 @@ var ts; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { + if (ts.getCombinedNodeFlags(node) & 2 /* Export */) { var container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); @@ -32631,7 +33074,7 @@ var ts; } function emitEs6ExportDefaultCompat(node) { if (node.parent.kind === 248 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 227 /* ExportAssignment */); + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 227 /* ExportAssignment */); // only allow export default at a source file level if (modulekind === 1 /* CommonJS */ || modulekind === 2 /* AMD */ || modulekind === 3 /* UMD */) { if (!currentSourceFile.symbol.exports["___esModule"]) { @@ -32649,7 +33092,7 @@ var ts; } } function emitExportMemberAssignment(node) { - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { writeLine(); emitStart(node); // emit call to exporter only for top level nodes @@ -32657,7 +33100,7 @@ var ts; // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default"); } else { @@ -32668,7 +33111,7 @@ var ts; write(")"); } else { - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { write("exports[\"default\"]"); @@ -32772,7 +33215,7 @@ var ts; // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; if (root.kind === 211 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isExported = ts.getCombinedNodeFlags(root) & 2 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } @@ -32854,8 +33297,8 @@ var ts; // to ensure value is evaluated exactly once. value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; + for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { + var p = properties_5[_a]; if (p.kind === 245 /* PropertyAssignment */ || p.kind === 246 /* ShorthandPropertyAssignment */) { var propName = p.name; var target_1 = p.kind === 246 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; @@ -32990,7 +33433,7 @@ var ts; // this is necessary to preserve ES6 semantic in scenarios like // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations var isLetDefinedInLoop = (resolver.getNodeCheckFlags(node) & 16384 /* BlockScopedBindingInLoop */) && - (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); + (getCombinedFlagsForIdentifier(node.name) & 8192 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isLetDefinedInLoop && node.parent.parent.kind !== 200 /* ForInStatement */ && @@ -33030,13 +33473,13 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function isES6ExportedDeclaration(node) { - return !!(node.flags & 1 /* Export */) && + return !!(node.flags & 2 /* Export */) && modulekind === 5 /* ES6 */ && node.parent.kind === 248 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; - if (node.flags & 1 /* Export */) { + if (node.flags & 2 /* Export */) { if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); @@ -33063,7 +33506,7 @@ var ts; function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { // If we're not exporting the variables, there's nothing special here. // Always emit comments for these nodes. - if (!(node.flags & 1 /* Export */)) { + if (!(node.flags & 2 /* Export */)) { return true; } // If we are exporting, but it's a top-level ES6 module exports, @@ -33246,7 +33689,7 @@ var ts; if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } } @@ -33466,7 +33909,7 @@ var ts; emitRestParameter(node); } function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 /* ES6 */ || node.flags & 512 /* Async */) { + if (languageVersion < 2 /* ES6 */ || node.flags & 256 /* Async */) { emitDownLevelExpressionFunctionBody(node, body); return; } @@ -33487,7 +33930,7 @@ var ts; scopeEmitStart(node); increaseIndent(); var outPos = writer.getTextPos(); - emitDetachedComments(node.body); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); @@ -33525,7 +33968,7 @@ var ts; scopeEmitStart(node); var initialTextPos = writer.getTextPos(); increaseIndent(); - emitDetachedComments(body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); @@ -33569,7 +34012,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 56 /* AccessibilityModifier */) { writeLine(); emitStart(param); emitStart(param.name); @@ -33604,15 +34047,15 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 141 /* PropertyDeclaration */ && isStatic === ((member.flags & 64 /* Static */) !== 0) && member.initializer) { properties.push(member); } } return properties; } function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var property = properties_6[_a]; emitPropertyDeclaration(node, property); } } @@ -33625,7 +34068,7 @@ var ts; emit(receiver); } else { - if (property.flags & 128 /* Static */) { + if (property.flags & 64 /* Static */) { emitDeclarationName(node); } else { @@ -33724,7 +34167,7 @@ var ts; writeLine(); emitLeadingComments(member); emitStart(member); - if (member.flags & 128 /* Static */) { + if (member.flags & 64 /* Static */) { write("static "); } if (member.kind === 145 /* GetAccessor */) { @@ -33774,7 +34217,7 @@ var ts; emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 141 /* PropertyDeclaration */ && member.initializer && (member.flags & 64 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -33821,7 +34264,7 @@ var ts; // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedComments(ctor.body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); var superCall; @@ -33941,7 +34384,7 @@ var ts; // _default = __decorate([dec], _default); // export default _default; // - if (isES6ExportedDeclaration(node) && !(node.flags & 1024 /* Default */)) { + if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } write("let "); @@ -33950,7 +34393,7 @@ var ts; } else if (isES6ExportedDeclaration(node)) { write("export "); - if (node.flags & 1024 /* Default */) { + if (node.flags & 512 /* Default */) { write("default "); } } @@ -33980,7 +34423,7 @@ var ts; // emit name if // - node has a name // - this is default export with static initializers - if ((node.name || (node.flags & 1024 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { + if ((node.name || (node.flags & 512 /* Default */ && staticProperties.length > 0)) && !thisNodeIsDecorated) { write(" "); emitDeclarationName(node); } @@ -34016,8 +34459,8 @@ var ts; // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; + for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { + var property = staticProperties_1[_a]; write(","); writeLine(); emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); @@ -34035,7 +34478,7 @@ var ts; } // If this is an exported class, but not on the top level (i.e. on an internal // module), export it - if (!isES6ExportedDeclaration(node) && (node.flags & 1 /* Export */)) { + if (!isES6ExportedDeclaration(node) && (node.flags & 2 /* Export */)) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -34044,7 +34487,7 @@ var ts; emitEnd(node); write(";"); } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024 /* Default */) && thisNodeIsDecorated) { + else if (isES6ExportedDeclaration(node) && (node.flags & 512 /* Default */) && thisNodeIsDecorated) { // if this is a top level default export of decorated class, write the export after the declaration. writeLine(); write("export default "); @@ -34126,13 +34569,13 @@ var ts; } function emitClassMemberPrefix(node, member) { emitDeclarationName(node); - if (!(member.flags & 128 /* Static */)) { + if (!(member.flags & 64 /* Static */)) { write(".prototype"); } } function emitDecoratorsOfClass(node) { emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 128 /* Static */); + emitDecoratorsOfMembers(node, 64 /* Static */); emitDecoratorsOfConstructor(node); } function emitDecoratorsOfConstructor(node) { @@ -34179,7 +34622,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; // only emit members in the correct group - if ((member.flags & 128 /* Static */) !== staticFlag) { + if ((member.flags & 64 /* Static */) !== staticFlag) { continue; } // skip members that cannot be decorated (such as the constructor) @@ -34580,7 +35023,7 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + if (!(node.flags & 2 /* Export */) || isES6ExportedDeclaration(node)) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -34611,7 +35054,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + if (!isES6ExportedDeclaration(node) && node.flags & 2 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted writeLine(); emitStart(node); @@ -34623,7 +35066,7 @@ var ts; write(";"); } if (modulekind !== 5 /* ES6 */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { // write the call to exporter for enum writeLine(); write(exportFunctionForFile + "(\""); @@ -34728,7 +35171,7 @@ var ts; } write(")("); // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { + if ((node.flags & 2 /* Export */) && !isES6ExportedDeclaration(node)) { emit(node.name); write(" = "); } @@ -34738,7 +35181,7 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { - if (modulekind === 4 /* System */ && (node.flags & 1 /* Export */)) { + if (modulekind === 4 /* System */ && (node.flags & 2 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); emitDeclarationName(node); @@ -34841,7 +35284,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 221 /* ImportEqualsDeclaration */ && (node.flags & 2 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (modulekind !== 2 /* AMD */) { emitLeadingComments(node); @@ -34923,7 +35366,7 @@ var ts; write("export "); write("var "); } - else if (!(node.flags & 1 /* Export */)) { + else if (!(node.flags & 2 /* Export */)) { write("var "); } } @@ -35014,8 +35457,8 @@ var ts; function emitExportOrImportSpecifierList(specifiers, shouldEmit) { ts.Debug.assert(modulekind === 5 /* ES6 */); var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; + for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { + var specifier = specifiers_1[_a]; if (shouldEmit(specifier)) { if (needsComma) { write(", "); @@ -35158,8 +35601,8 @@ var ts; } writeLine(); var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; + for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { + var importNode = externalImports_1[_a]; // do not create variable declaration for exports and imports that lack import clause var skipNode = importNode.kind === 228 /* ExportDeclaration */ || (importNode.kind === 222 /* ImportDeclaration */ && !importNode.importClause); @@ -35193,8 +35636,8 @@ var ts; // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; + for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { + var externalImport = externalImports_2[_a]; if (externalImport.kind === 228 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; @@ -35225,8 +35668,8 @@ var ts; } } } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; + for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { + var externalImport = externalImports_3[_d]; if (externalImport.kind !== 228 /* ExportDeclaration */) { continue; } @@ -35275,7 +35718,7 @@ var ts; function writeExportedName(node) { // do not record default exports // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 69 /* Identifier */ && node.flags & 1024 /* Default */) { + if (node.kind !== 69 /* Identifier */ && node.flags & 512 /* Default */) { return; } if (started) { @@ -35338,7 +35781,7 @@ var ts; emit(local); } var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); - if (flags & 1 /* Export */) { + if (flags & 2 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -35348,11 +35791,11 @@ var ts; write(";"); } if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; + for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { + var f = hoistedFunctionDeclarations_1[_a]; writeLine(); emit(f); - if (f.flags & 1 /* Export */) { + if (f.flags & 2 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; } @@ -35362,7 +35805,7 @@ var ts; } return exportedDeclarations; function visit(node) { - if (node.flags & 2 /* Ambient */) { + if (node.flags & 4 /* Ambient */) { return; } if (node.kind === 213 /* FunctionDeclaration */) { @@ -35437,7 +35880,7 @@ var ts; // - it is top level block scoped // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || + return (ts.getCombinedNodeFlags(node) & 24576 /* BlockScoped */) === 0 || ts.getEnclosingBlockScopeContainer(node).kind === 248 /* SourceFile */; } function isCurrentFileSystemExternalModule() { @@ -35509,8 +35952,8 @@ var ts; var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; + for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { + var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { case 222 /* ImportDeclaration */: @@ -35679,8 +36122,8 @@ var ts; unaliasedModuleNames.push("\"" + amdDependency.path + "\""); } } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; + for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { + var importNode = externalImports_4[_c]; // Find the name of the external module var externalModuleName = getExternalModuleNameText(importNode); // Find the name of the module alias, if there is one @@ -35959,7 +36402,7 @@ var ts; // Start new file on new line writeLine(); emitShebang(); - emitDetachedComments(node); + emitDetachedCommentsAndUpdateCommentsInfo(node); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1 /* CommonJS */]; emitModule(node); @@ -35983,7 +36426,7 @@ var ts; } function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { - if (node.flags & 2 /* Ambient */) { + if (node.flags & 4 /* Ambient */) { return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -36232,10 +36675,6 @@ var ts; } return leadingComments; } - function isPinnedComments(comment) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } /** * Determine if the given comment is a triple-slash * @@ -36350,57 +36789,14 @@ var ts; // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitDetachedComments(node) { - var leadingComments; - if (compilerOptions.removeComments) { - // removeComments is true, only reserve pinned comment at the top of file - // For example: - // /*! Pinned Comment */ - // - // var x = 10; - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + function emitDetachedCommentsAndUpdateCommentsInfo(node) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); } - } - else { - // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - // Valid detachedComments - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -36716,7 +37112,7 @@ var ts; var resolveModuleNamesWorker = host.resolveModuleNames ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); - var filesByName = ts.createFileMap(getCanonicalFileName); + var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; @@ -36774,8 +37170,8 @@ var ts; // Initialize a checker so that all our files are bound. getTypeChecker(); classifiableNames = {}; - for (var _i = 0; _i < files.length; _i++) { - var sourceFile = files[_i]; + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var sourceFile = files_3[_i]; ts.copyMap(sourceFile.classifiableNames, classifiableNames); } } @@ -36793,7 +37189,7 @@ var ts; } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; - var normalizedAbsoluteFileNames = []; + var filePaths = []; var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; @@ -36801,8 +37197,8 @@ var ts; if (!newSourceFile) { return false; } - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - normalizedAbsoluteFileNames.push(normalizedAbsolutePath); + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); if (oldSourceFile !== newSourceFile) { if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { // value of no-default-lib has changed @@ -36822,7 +37218,7 @@ var ts; } if (resolveModuleNamesWorker) { var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); - var resolutions = resolveModuleNamesWorker(moduleNames, normalizedAbsolutePath); + var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); // ensure that module resolution results are still correct for (var i = 0; i < moduleNames.length; ++i) { var newResolution = resolutions[i]; @@ -36850,12 +37246,12 @@ var ts; } // update fileName -> file mapping for (var i = 0, len = newSourceFiles.length; i < len; ++i) { - filesByName.set(normalizedAbsoluteFileNames[i], newSourceFiles[i]); + filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _b = 0; _b < modifiedSourceFiles.length; _b++) { - var modifiedFile = modifiedSourceFiles[_b]; + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } oldProgram.structureIsReused = true; @@ -36905,7 +37301,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(ts.getNormalizedAbsolutePath(fileName, currentDirectory)); + return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -37024,7 +37420,7 @@ var ts; } break; case 218 /* ModuleDeclaration */: - if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 4 /* Ambient */ || ts.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. @@ -37049,7 +37445,7 @@ var ts; diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -37059,13 +37455,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.getNormalizedAbsolutePath(fileName, currentDirectory), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.getNormalizedAbsolutePath(fileName + extension, currentDirectory), isDefaultLib, refFile, refPos, refEnd); })) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -37111,6 +37507,7 @@ var ts; }); filesByName.set(normalizedAbsolutePath, file); if (file) { + file.path = normalizedAbsolutePath; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case var existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath); @@ -37157,13 +37554,7 @@ var ts; var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - var absoluteImportPath = ts.isRootedDiskPath(resolution.resolvedFileName) - ? resolution.resolvedFileName - : ts.getNormalizedAbsolutePath(resolution.resolvedFileName, currentDirectory); - // convert an absolute import path to path that is relative to current directory - // this was host still can locate it but files names in user output will be shorter (and thus look nicer). - var relativePath = ts.getRelativePathToDirectoryOrUrl(currentDirectory, absoluteImportPath, currentDirectory, getCanonicalFileName, false); - var importedFile = findSourceFile(relativePath, absoluteImportPath, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /* isDefaultLib */ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); @@ -37219,8 +37610,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -37344,6 +37735,7 @@ var ts; /// /// /// +/// /// var ts; (function (ts) { @@ -37493,6 +37885,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "pretty", + paramType: ts.Diagnostics.KIND, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, { name: "project", shortName: "p", @@ -37591,11 +37989,31 @@ var ts; description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic }, + { + name: "allowUnusedLabels", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, { name: "forceConsistentCasingInFileNames", type: "boolean", description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, + } ]; var optionNameMapCache; /* @internal */ @@ -37734,13 +38152,38 @@ var ts; */ function parseConfigFileTextToJson(fileName, jsonText) { try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + var jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + /** + * Remove the comments from a json like text. + * Comments can be single line comments (starting with # or //) or multiline comments using / * * / + * + * This method replace comment content by whitespace rather than completely remove them to keep positions in json parsing error reporting accurate. + */ + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1 /* ES5 */, /* skipTrivia */ false, 0 /* Standard */, jsonText); + var token; + while ((token = scanner.scan()) !== 1 /* EndOfFileToken */) { + switch (token) { + case 2 /* SingleLineCommentTrivia */: + case 3 /* MultiLineCommentTrivia */: + // replace comments with whitespace to preserve original character positions + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -37871,8 +38314,8 @@ var ts; var lastSingleLineCommentEnd = -1; var isFirstSingleLineComment = true; var singleLineCommentCount = 0; - for (var _i = 0; _i < comments.length; _i++) { - var currentComment = comments[_i]; + for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { + var currentComment = comments_2[_i]; // For single line comments, combine consecutive ones (2 or more) into // a single span from the start of the first till the end of the last if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { @@ -38004,6 +38447,8 @@ var ts; function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; + // This means "compare in a case insensitive manner." + var baseSensitivity = { sensitivity: "base" }; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); @@ -38017,8 +38462,8 @@ var ts; if (!matches) { continue; } - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { @@ -38047,8 +38492,8 @@ var ts; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; if (!match.isCaseSensitive) { return false; } @@ -38123,8 +38568,8 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { + var match = matches_2[_i]; var kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; @@ -38132,8 +38577,6 @@ var ts; } return bestMatchKind; } - // This means "compare in a case insensitive manner." - var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. // Right now we just sort by kind first, and then by name of the item. @@ -38296,8 +38739,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; switch (node.kind) { case 214 /* ClassDeclaration */: case 217 /* EnumDeclaration */: @@ -38340,8 +38783,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var child = nodes_5[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -38389,7 +38832,7 @@ var ts; if (ts.isBindingPattern(node.name)) { break; } - if ((node.flags & 2035 /* Modifier */) === 0) { + if ((node.flags & 1022 /* Modifier */) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); @@ -38693,8 +39136,8 @@ var ts; // word part. That way we don't match something like 'Class' when the user types 'a'. // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { - var span = wordSpans[_i]; + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); @@ -38800,8 +39243,8 @@ var ts; // Only if all words have some sort of match is the pattern considered matched. var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { - var subWordTextChunk = subWordTextChunks[_i]; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; // Try to match the candidate with this word var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { @@ -39386,8 +39829,8 @@ var ts; var nameToDeclarations = sourceFile_1.getNamedDeclarations(); var declarations = ts.getProperty(nameToDeclarations, name.text); if (declarations) { - for (var _b = 0; _b < declarations.length; _b++) { - var declaration = declarations[_b]; + for (var _b = 0, declarations_7 = declarations; _b < declarations_7.length; _b++) { + var declaration = declarations_7[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -39503,8 +39946,8 @@ var ts; // arg index. var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { - var child = listChildren[_i]; + for (var _i = 0, listChildren_1 = listChildren; _i < listChildren_1.length; _i++) { + var child = listChildren_1[_i]; if (child === node) { break; } @@ -40049,8 +40492,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { - var child = children[_i]; + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -40212,17 +40655,17 @@ var ts; function getNodeModifiers(node) { var flags = ts.getCombinedNodeFlags(node); var result = []; - if (flags & 32 /* Private */) + if (flags & 16 /* Private */) result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 64 /* Protected */) + if (flags & 32 /* Protected */) result.push(ts.ScriptElementKindModifier.protectedMemberModifier); - if (flags & 16 /* Public */) + if (flags & 8 /* Public */) result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 128 /* Static */) + if (flags & 64 /* Static */) result.push(ts.ScriptElementKindModifier.staticModifier); - if (flags & 256 /* Abstract */) + if (flags & 128 /* Abstract */) result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 1 /* Export */) + if (flags & 2 /* Export */) result.push(ts.ScriptElementKindModifier.exportedModifier); if (ts.isInAmbientContext(node)) result.push(ts.ScriptElementKindModifier.ambientModifier); @@ -42366,8 +42809,8 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0; _i < nodes.length; _i++) { - var child = nodes[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { @@ -42458,8 +42901,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { - var triviaItem = trivia[_i]; + for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { + var triviaItem = trivia_1[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -43056,7 +43499,6 @@ var ts; return node; } } - return node; } } function deriveActualIndentationFromList(list, index, sourceFile, options) { @@ -43307,17 +43749,17 @@ var ts; while (pos < end) { var token = scanner.scan(); var textPos = scanner.getTextPos(); - nodes.push(createNode(token, pos, textPos, 4096 /* Synthetic */, this)); + nodes.push(createNode(token, pos, textPos, 2048 /* Synthetic */, this)); pos = textPos; } return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(271 /* SyntaxList */, nodes.pos, nodes.end, 2048 /* Synthetic */, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { - var node = nodes[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -43872,7 +44314,7 @@ var ts; break; case 138 /* Parameter */: // Only consider properties defined as constructor parameters - if (!(node.flags & 112 /* AccessibilityModifier */)) { + if (!(node.flags & 56 /* AccessibilityModifier */)) { break; } // fall through @@ -44148,13 +44590,15 @@ var ts; var HostCache = (function () { function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index - this.fileNameToEntry = ts.createFileMap(getCanonicalFileName); + this.currentDirectory = host.getCurrentDirectory(); + this.fileNameToEntry = ts.createFileMap(); // Initialize the list with the root file names var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; - this.createEntry(fileName); + for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { + var fileName = rootFileNames_1[_i]; + this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName)); } // store the compilation settings this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); @@ -44162,7 +44606,7 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; - HostCache.prototype.createEntry = function (fileName) { + HostCache.prototype.createEntry = function (fileName, path) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { @@ -44172,36 +44616,37 @@ var ts; scriptSnapshot: scriptSnapshot }; } - this.fileNameToEntry.set(fileName, entry); + this.fileNameToEntry.set(path, entry); return entry; }; - HostCache.prototype.getEntry = function (fileName) { - return this.fileNameToEntry.get(fileName); + HostCache.prototype.getEntry = function (path) { + return this.fileNameToEntry.get(path); }; - HostCache.prototype.contains = function (fileName) { - return this.fileNameToEntry.contains(fileName); + HostCache.prototype.contains = function (path) { + return this.fileNameToEntry.contains(path); }; HostCache.prototype.getOrCreateEntry = function (fileName) { - if (this.contains(fileName)) { - return this.getEntry(fileName); + var path = ts.toPath(fileName, this.currentDirectory, this.getCanonicalFileName); + if (this.contains(path)) { + return this.getEntry(path); } - return this.createEntry(fileName); + return this.createEntry(fileName, path); }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; - this.fileNameToEntry.forEachValue(function (value) { + this.fileNameToEntry.forEachValue(function (path, value) { if (value) { fileNames.push(value.hostFileName); } }); return fileNames; }; - HostCache.prototype.getVersion = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getVersion = function (path) { + var file = this.getEntry(path); return file && file.version; }; - HostCache.prototype.getScriptSnapshot = function (fileName) { - var file = this.getEntry(fileName); + HostCache.prototype.getScriptSnapshot = function (path) { + var file = this.getEntry(path); return file && file.scriptSnapshot; }; return HostCache; @@ -44383,7 +44828,8 @@ var ts; : (function (fileName) { return fileName.toLowerCase(); }); } ts.createGetCanonicalFileName = createGetCanonicalFileName; - function createDocumentRegistry(useCaseSensitiveFileNames) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; @@ -44395,7 +44841,7 @@ var ts; var key = getKeyFromCompilationSettings(settings); var bucket = ts.lookUp(buckets, key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(getCanonicalFileName); + buckets[key] = bucket = ts.createFileMap(); } return bucket; } @@ -44403,14 +44849,13 @@ var ts; var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; - for (var i in entries) { - var entry = entries.get(i); + entries.forEachValue(function (key, entry) { sourceFiles.push({ - name: i, + name: key, refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); - } + }); sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, @@ -44427,7 +44872,8 @@ var ts; } function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. @@ -44437,7 +44883,7 @@ var ts; languageServiceRefCount: 0, owners: [] }; - bucket.set(fileName, entry); + bucket.set(path, entry); } else { // We have an entry for this file. However, it may be for a different version of @@ -44460,11 +44906,12 @@ var ts; function releaseDocument(fileName, compilationSettings) { var bucket = getBucketForCompilationSettings(compilationSettings, false); ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(fileName); + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var entry = bucket.get(path); entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); if (entry.languageServiceRefCount === 0) { - bucket.remove(fileName); + bucket.remove(path); } } return { @@ -44871,7 +45318,7 @@ var ts; case 144 /* Constructor */: return ScriptElementKind.constructorImplementationElement; case 137 /* TypeParameter */: return ScriptElementKind.typeParameterElement; case 247 /* EnumMember */: return ScriptElementKind.variableElement; - case 138 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138 /* Parameter */: return (node.flags & 56 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 221 /* ImportEqualsDeclaration */: case 226 /* ImportSpecifier */: case 223 /* ImportClause */: @@ -44897,13 +45344,14 @@ var ts; return CancellationTokenObject; })(); function createLanguageService(host, documentRegistry) { - if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var currentDirectory = host.getCurrentDirectory(); // Check if the localized messages json is set, otherwise query the host for it if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); @@ -44915,8 +45363,7 @@ var ts; } var getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames); function getValidSourceFile(fileName) { - fileName = ts.normalizeSlashes(fileName); - var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + var sourceFile = program.getSourceFile(fileName); if (!sourceFile) { throw new Error("Could not find file: '" + fileName + "'."); } @@ -44968,7 +45415,7 @@ var ts; getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality ts.Debug.assert(!host.resolveModuleNames); @@ -44988,11 +45435,10 @@ var ts; // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { - var oldSourceFile = oldSourceFiles[_i]; - var fileName = oldSourceFile.fileName; - if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(fileName, oldSettings); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; + if (!newProgram.getSourceFile(oldSourceFile.fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(oldSourceFile.fileName, oldSettings); } } } @@ -45048,7 +45494,8 @@ var ts; return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } function sourceFileUpToDate(sourceFile) { - return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName); + return sourceFile && sourceFile.version === hostCache.getVersion(path); } function programUpToDate() { // If we haven't create a program yet, then it is not up-to-date @@ -45061,8 +45508,8 @@ var ts; return false; } // If any file is not up-to-date, then the whole program is not up-to-date - for (var _i = 0; _i < rootFileNames.length; _i++) { - var fileName = rootFileNames[_i]; + for (var _i = 0, rootFileNames_2 = rootFileNames; _i < rootFileNames_2.length; _i++) { + var fileName = rootFileNames_2[_i]; if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; } @@ -45237,8 +45684,8 @@ var ts; } function checkModifiers(modifiers) { if (modifiers) { - for (var _i = 0; _i < modifiers.length; _i++) { - var modifier = modifiers[_i]; + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; switch (modifier.kind) { case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: @@ -45940,8 +46387,8 @@ var ts; */ function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { var exisingImportsOrExports = {}; - for (var _i = 0; _i < namedImportsOrExports.length; _i++) { - var element = namedImportsOrExports[_i]; + for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { + var element = namedImportsOrExports_1[_i]; // If this is the current item we are editing right now, do not filter it out if (element.getStart() <= position && position <= element.getEnd()) { continue; @@ -45965,8 +46412,8 @@ var ts; return contextualMemberSymbols; } var existingMemberNames = {}; - for (var _i = 0; _i < existingMembers.length; _i++) { - var m = existingMembers[_i]; + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members if (m.kind !== 245 /* PropertyAssignment */ && m.kind !== 246 /* ShorthandPropertyAssignment */ && @@ -45999,8 +46446,8 @@ var ts; */ function filterJsxAttributes(symbols, attributes) { var seenNames = {}; - for (var _i = 0; _i < attributes.length; _i++) { - var attr = attributes[_i]; + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; // If this is the current item we are editing right now, do not filter it out if (attr.getStart() <= position && position <= attr.getEnd()) { continue; @@ -46101,8 +46548,8 @@ var ts; var entries = []; if (symbols) { var nameToSymbol = {}; - for (var _i = 0; _i < symbols.length; _i++) { - var symbol = symbols[_i]; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; var entry = createCompletionEntry(symbol, location); if (entry) { var id = ts.escapeIdentifier(entry.name); @@ -46844,8 +47291,8 @@ var ts; } var fileNameToDocumentHighlights = {}; var result = []; - for (var _i = 0; _i < referencedSymbols.length; _i++) { - var referencedSymbol = referencedSymbols[_i]; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { var referenceEntry = _b[_a]; var fileName_1 = referenceEntry.fileName; @@ -46989,7 +47436,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } /** * For lack of a better name, this function takes a throw statement and returns the @@ -47027,7 +47473,6 @@ var ts; ts.forEachChild(node, aggregate); } } - ; } function ownsBreakOrContinueStatement(owner, statement) { var actualOwner = getBreakOrContinueOwner(statement); @@ -47096,7 +47541,7 @@ var ts; case 219 /* ModuleBlock */: case 248 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 256 /* Abstract */) { + if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); } else { @@ -47111,7 +47556,7 @@ var ts; nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. - if (modifierFlag & 112 /* AccessibilityModifier */) { + if (modifierFlag & 56 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { return member.kind === 144 /* Constructor */ && member; }); @@ -47119,7 +47564,7 @@ var ts; nodes = nodes.concat(constructor.parameters); } } - else if (modifierFlag & 256 /* Abstract */) { + else if (modifierFlag & 128 /* Abstract */) { nodes = nodes.concat(container); } break; @@ -47135,19 +47580,19 @@ var ts; function getFlagFromModifier(modifier) { switch (modifier) { case 112 /* PublicKeyword */: - return 16 /* Public */; + return 8 /* Public */; case 110 /* PrivateKeyword */: - return 32 /* Private */; + return 16 /* Private */; case 111 /* ProtectedKeyword */: - return 64 /* Protected */; + return 32 /* Protected */; case 113 /* StaticKeyword */: - return 128 /* Static */; + return 64 /* Static */; case 82 /* ExportKeyword */: - return 1 /* Export */; + return 2 /* Export */; case 122 /* DeclareKeyword */: - return 2 /* Ambient */; + return 4 /* Ambient */; case 115 /* AbstractKeyword */: - return 256 /* Abstract */; + return 128 /* Abstract */; default: ts.Debug.fail(); } @@ -47346,8 +47791,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0; _i < documentHighlights.length; _i++) { - var entry = documentHighlights[_i]; + for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { + var entry = documentHighlights_1[_i]; for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { var highlightSpan = _b[_a]; result.push({ @@ -47365,8 +47810,8 @@ var ts; return undefined; } var referenceEntries = []; - for (var _i = 0; _i < referenceSymbols.length; _i++) { - var referenceSymbol = referenceSymbols[_i]; + for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { + var referenceSymbol = referenceSymbols_1[_i]; ts.addRange(referenceEntries, referenceSymbol.references); } return referenceEntries; @@ -47451,8 +47896,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0; _i < sourceFiles.length; _i++) { - var sourceFile = sourceFiles[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var sourceFile = sourceFiles_2[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName)) { @@ -47512,7 +47957,7 @@ var ts; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 16 /* Private */) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 214 /* ClassDeclaration */); } @@ -47530,8 +47975,8 @@ var ts; var scope = undefined; var declarations = symbol.getDeclarations(); if (declarations) { - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; var container = getContainerNode(declaration); if (!container) { return undefined; @@ -47711,7 +48156,7 @@ var ts; return undefined; } // Whether 'super' occurs in a static context within a class. - var staticFlag = 128 /* Static */; + var staticFlag = 64 /* Static */; switch (searchSpaceNode.kind) { case 141 /* PropertyDeclaration */: case 140 /* PropertySignature */: @@ -47739,7 +48184,7 @@ var ts; // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. - if (container && (128 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + if (container && (64 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { references.push(getReferenceEntryFromNode(node)); } }); @@ -47749,7 +48194,7 @@ var ts; function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. - var staticFlag = 128 /* Static */; + var staticFlag = 64 /* Static */; switch (searchSpaceNode.kind) { case 143 /* MethodDeclaration */: case 142 /* MethodSignature */: @@ -47827,7 +48272,7 @@ var ts; case 214 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 64 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; @@ -47998,8 +48443,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { - var declaration = declarations[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -48115,7 +48560,6 @@ var ts; return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - ts.Debug.fail("Unknown declaration type"); } function isTypeReference(node) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { @@ -48694,8 +49138,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { - var current = childNodes[_i]; + for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { + var current = childNodes_1[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -49025,8 +49469,8 @@ var ts; // Disallow rename for elements that are defined in the standard TypeScript library. var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { - var current = declarations[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var current = declarations_10[_i]; var sourceFile_2 = current.getSourceFile(); var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); if (sourceFile_2 && getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { @@ -49609,7 +50053,7 @@ var ts; */ function spanInSourceFileAtLocation(sourceFile, position) { // Cannot set breakpoint in dts file - if (sourceFile.flags & 8192 /* DeclarationFile */) { + if (sourceFile.flags & 4096 /* DeclarationFile */) { return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); @@ -49827,7 +50271,7 @@ var ts; ? variableDeclaration.parent.parent.initializer.declarations : undefined; // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */)) { + if (variableDeclaration.initializer || (variableDeclaration.flags & 2 /* Export */)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { // First declaration - include let keyword @@ -49853,7 +50297,7 @@ var ts; function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16 /* Public */) || !!(parameter.flags & 32 /* Private */); + !!(parameter.flags & 8 /* Public */) || !!(parameter.flags & 16 /* Private */); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -49873,7 +50317,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1 /* Export */) || + return !!(functionDeclaration.flags & 2 /* Export */) || (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { @@ -49967,7 +50411,6 @@ var ts; // fall through. case 244 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - ; case 220 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; @@ -50008,8 +50451,6 @@ var ts; default: return spanInNode(node.parent); } - // Default to parent node - return spanInNode(node.parent); } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration @@ -50138,7 +50579,6 @@ var ts; // TODO: should this be '==='? if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - return null; } return JSON.parse(settingsJson); }; diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c12a9afad62..3d7d980706b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -10,6 +10,21 @@ namespace ts { ConstEnumOnly = 2 } + const enum Reachability { + Unintialized = 1 << 0, + Reachable = 1 << 1, + Unreachable = 1 << 2, + ReportedUnreachable = 1 << 3 + } + + function or(state1: Reachability, state2: Reachability): Reachability { + return (state1 | state2) & Reachability.Reachable + ? Reachability.Reachable + : (state1 & state2) & Reachability.ReportedUnreachable + ? Reachability.ReportedUnreachable + : Reachability.Unreachable; + } + export function getModuleInstanceState(node: Node): ModuleInstanceState { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations @@ -77,35 +92,64 @@ namespace ts { IsContainerWithLocals = IsContainer | HasLocals } - export function bindSourceFile(file: SourceFile) { + const binder = createBinder(); + + export function bindSourceFile(file: SourceFile, options: CompilerOptions) { let start = new Date().getTime(); - bindSourceFileWorker(file); + binder(file, options); bindTime += new Date().getTime() - start; } - function bindSourceFileWorker(file: SourceFile) { + function createBinder(): (file: SourceFile, options: CompilerOptions) => void { + let file: SourceFile; + let options: CompilerOptions; let parent: Node; let container: Node; let blockScopeContainer: Node; let lastContainer: Node; let seenThisKeyword: boolean; + // state used by reachability checks + let hasExplicitReturn: boolean; + let currentReachabilityState: Reachability; + let labelStack: Reachability[]; + let labelIndexMap: Map; + let implicitLabels: number[]; + // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). - let inStrictMode = !!file.externalModuleIndicator; + let inStrictMode: boolean; let symbolCount = 0; - let Symbol = objectAllocator.getSymbolConstructor(); - let classifiableNames: Map = {}; + let Symbol: { new (flags: SymbolFlags, name: string): Symbol }; + let classifiableNames: Map; - if (!file.locals) { - bind(file); - file.symbolCount = symbolCount; - file.classifiableNames = classifiableNames; + function bindSourceFile(f: SourceFile, opts: CompilerOptions) { + file = f; + options = opts; + inStrictMode = !!file.externalModuleIndicator; + classifiableNames = {}; + Symbol = objectAllocator.getSymbolConstructor(); + + if (!file.locals) { + bind(file); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + } + + parent = undefined; + container = undefined; + blockScopeContainer = undefined; + lastContainer = undefined; + seenThisKeyword = false; + hasExplicitReturn = false; + labelStack = undefined; + labelIndexMap = undefined; + implicitLabels = undefined; } - return; + return bindSourceFile; function createSymbol(flags: SymbolFlags, name: string): Symbol { symbolCount++; @@ -338,13 +382,56 @@ namespace ts { blockScopeContainer.locals = undefined; } - if (node.kind === SyntaxKind.InterfaceDeclaration) { + let savedReachabilityState: Reachability; + let savedLabelStack: Reachability[]; + let savedLabels: Map; + let savedImplicitLabels: number[]; + let savedHasExplicitReturn: boolean; + + const kind = node.kind; + let flags = node.flags; + + // reset all reachability check related flags on node (for incremental scenarios) + flags &= ~NodeFlags.ReachabilityCheckFlags; + + if (kind === SyntaxKind.InterfaceDeclaration) { seenThisKeyword = false; - forEachChild(node, bind); - node.flags = seenThisKeyword ? node.flags | NodeFlags.ContainsThis : node.flags & ~NodeFlags.ContainsThis; } - else { - forEachChild(node, bind); + + let saveState = kind === SyntaxKind.SourceFile || kind === SyntaxKind.ModuleBlock || isFunctionLikeKind(kind); + if (saveState) { + savedReachabilityState = currentReachabilityState; + savedLabelStack = labelStack; + savedLabels = labelIndexMap; + savedImplicitLabels = implicitLabels; + savedHasExplicitReturn = hasExplicitReturn; + + currentReachabilityState = Reachability.Reachable; + hasExplicitReturn = false; + labelStack = labelIndexMap = implicitLabels = undefined; + } + + bindReachableStatement(node); + + if (currentReachabilityState === Reachability.Reachable && isFunctionLikeKind(kind) && nodeIsPresent((node).body)) { + flags |= NodeFlags.HasImplicitReturn; + if (hasExplicitReturn) { + flags |= NodeFlags.HasExplicitReturn; + } + } + + if (kind === SyntaxKind.InterfaceDeclaration) { + flags = seenThisKeyword ? flags | NodeFlags.ContainsThis : flags & ~NodeFlags.ContainsThis; + } + + node.flags = flags; + + if (saveState) { + hasExplicitReturn = savedHasExplicitReturn; + currentReachabilityState = savedReachabilityState; + labelStack = savedLabelStack; + labelIndexMap = savedLabels; + implicitLabels = savedImplicitLabels; } container = saveContainer; @@ -352,6 +439,220 @@ namespace ts { blockScopeContainer = savedBlockScopeContainer; } + /** + * Returns true if node and its subnodes were successfully traversed. + * Returning false means that node was not examined and caller needs to dive into the node himself. + */ + function bindReachableStatement(node: Node): void { + if (checkUnreachable(node)) { + forEachChild(node, bind); + return; + } + + switch (node.kind) { + case SyntaxKind.WhileStatement: + bindWhileStatement(node); + break; + case SyntaxKind.DoStatement: + bindDoStatement(node); + break; + case SyntaxKind.ForStatement: + bindForStatement(node); + break; + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + bindForInOrForOfStatement(node); + break; + case SyntaxKind.IfStatement: + bindIfStatement(node); + break; + case SyntaxKind.ReturnStatement: + case SyntaxKind.ThrowStatement: + bindReturnOrThrow(node); + break; + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + bindBreakOrContinueStatement(node); + break; + case SyntaxKind.TryStatement: + bindTryStatement(node); + break; + case SyntaxKind.SwitchStatement: + bindSwitchStatement(node); + break; + case SyntaxKind.CaseBlock: + bindCaseBlock(node); + break; + case SyntaxKind.LabeledStatement: + bindLabeledStatement(node); + break; + default: + forEachChild(node, bind); + break; + } + } + + function bindWhileStatement(n: WhileStatement): void { + const preWhileState = + n.expression.kind === SyntaxKind.FalseKeyword ? Reachability.Unreachable : currentReachabilityState; + const postWhileState = + n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : currentReachabilityState; + + // bind expressions (don't affect reachability) + bind(n.expression); + + currentReachabilityState = preWhileState; + const postWhileLabel = pushImplicitLabel(); + bind(n.statement); + popImplicitLabel(postWhileLabel, postWhileState); + } + + function bindDoStatement(n: DoStatement): void { + const preDoState = currentReachabilityState; + + const postDoLabel = pushImplicitLabel(); + bind(n.statement); + const postDoState = n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : preDoState; + popImplicitLabel(postDoLabel, postDoState); + + // bind expressions (don't affect reachability) + bind(n.expression); + } + + function bindForStatement(n: ForStatement): void { + const preForState = currentReachabilityState; + const postForLabel = pushImplicitLabel(); + + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.condition); + bind(n.incrementor); + + bind(n.statement); + + // for statement is considered infinite when it condition is either omitted or is true keyword + // - for(..;;..) + // - for(..;true;..) + const isInfiniteLoop = (!n.condition || n.condition.kind === SyntaxKind.TrueKeyword); + const postForState = isInfiniteLoop ? Reachability.Unreachable : preForState; + popImplicitLabel(postForLabel, postForState); + } + + function bindForInOrForOfStatement(n: ForInStatement | ForOfStatement): void { + const preStatementState = currentReachabilityState; + const postStatementLabel = pushImplicitLabel(); + + // bind expressions (don't affect reachability) + bind(n.initializer); + bind(n.expression); + + bind(n.statement); + popImplicitLabel(postStatementLabel, preStatementState); + } + + function bindIfStatement(n: IfStatement): void { + // denotes reachability state when entering 'thenStatement' part of the if statement: + // i.e. if condition is false then thenStatement is unreachable + const ifTrueState = n.expression.kind === SyntaxKind.FalseKeyword ? Reachability.Unreachable : currentReachabilityState; + // denotes reachability state when entering 'elseStatement': + // i.e. if condition is true then elseStatement is unreachable + const ifFalseState = n.expression.kind === SyntaxKind.TrueKeyword ? Reachability.Unreachable : currentReachabilityState; + + currentReachabilityState = ifTrueState; + + // bind expression (don't affect reachability) + bind(n.expression); + + bind(n.thenStatement); + if (n.elseStatement) { + const preElseState = currentReachabilityState; + currentReachabilityState = ifFalseState; + bind(n.elseStatement); + currentReachabilityState = or(currentReachabilityState, preElseState); + } + else { + currentReachabilityState = or(currentReachabilityState, ifFalseState); + } + } + + function bindReturnOrThrow(n: ReturnStatement | ThrowStatement): void { + // bind expression (don't affect reachability) + bind(n.expression); + if (n.kind === SyntaxKind.ReturnStatement) { + hasExplicitReturn = true; + } + currentReachabilityState = Reachability.Unreachable; + } + + function bindBreakOrContinueStatement(n: BreakOrContinueStatement): void { + // call bind on label (don't affect reachability) + bind(n.label); + // for continue case touch label so it will be marked a used + const isValidJump = jumpToLabel(n.label, n.kind === SyntaxKind.BreakStatement ? currentReachabilityState : Reachability.Unreachable); + if (isValidJump) { + currentReachabilityState = Reachability.Unreachable; + } + } + + function bindTryStatement(n: TryStatement): void { + // catch\finally blocks has the same reachability as try block + const preTryState = currentReachabilityState; + bind(n.tryBlock); + const postTryState = currentReachabilityState; + + currentReachabilityState = preTryState; + bind(n.catchClause); + const postCatchState = currentReachabilityState; + + currentReachabilityState = preTryState; + bind(n.finallyBlock); + + // post catch/finally state is reachable if + // - post try state is reachable - control flow can fall out of try block + // - post catch state is reachable - control flow can fall out of catch block + currentReachabilityState = or(postTryState, postCatchState); + } + + function bindSwitchStatement(n: SwitchStatement): void { + const preSwitchState = currentReachabilityState; + const postSwitchLabel = pushImplicitLabel(); + + // bind expression (don't affect reachability) + bind(n.expression); + + bind(n.caseBlock); + + const hasDefault = forEach(n.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause); + + // post switch state is unreachable if switch is exaustive (has a default case ) and does not have fallthrough from the last case + const postSwitchState = hasDefault && currentReachabilityState !== Reachability.Reachable ? Reachability.Unreachable : preSwitchState; + + popImplicitLabel(postSwitchLabel, postSwitchState); + } + + function bindCaseBlock(n: CaseBlock): void { + const startState = currentReachabilityState; + + for (let clause of n.clauses) { + currentReachabilityState = startState; + bind(clause); + if (clause.statements.length && currentReachabilityState === Reachability.Reachable && options.noFallthroughCasesInSwitch) { + errorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch); + } + } + } + + function bindLabeledStatement(n: LabeledStatement): void { + // call bind on label (don't affect reachability) + bind(n.label); + + const ok = pushNamedLabel(n.label); + bind(n.statement); + if (ok) { + popNamedLabel(n.label, currentReachabilityState); + } + } + function getContainerFlags(node: Node): ContainerFlags { switch (node.kind) { case SyntaxKind.ClassExpression: @@ -488,17 +789,6 @@ namespace ts { : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } - function isAmbientContext(node: Node): boolean { - while (node) { - if (node.flags & NodeFlags.Ambient) { - return true; - } - - node = node.parent; - } - return false; - } - function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean { let body = node.kind === SyntaxKind.SourceFile ? node : (node).body; if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) { @@ -514,7 +804,7 @@ namespace ts { function setExportContextFlag(node: ModuleDeclaration | SourceFile) { // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. - if (isAmbientContext(node) && !hasExportDeclarations(node)) { + if (isInAmbientContext(node) && !hasExportDeclarations(node)) { node.flags |= NodeFlags.ExportContext; } else { @@ -766,11 +1056,11 @@ namespace ts { function checkStrictModeWithStatement(node: WithStatement) { // Grammar checking for withStatement if (inStrictMode) { - grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); + errorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } - function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) { + function errorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) { let span = getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } @@ -780,6 +1070,10 @@ namespace ts { } function bind(node: Node) { + if (!node) { + return; + } + node.parent = parent; let savedInStrictMode = inStrictMode; @@ -1084,5 +1378,135 @@ namespace ts { ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } + + // reachability checks + + function pushNamedLabel(name: Identifier): boolean { + initializeReachabilityStateIfNecessary(); + + if (hasProperty(labelIndexMap, name.text)) { + return false; + } + labelIndexMap[name.text] = labelStack.push(Reachability.Unintialized) - 1; + return true; + } + + function pushImplicitLabel(): number { + initializeReachabilityStateIfNecessary(); + + let index = labelStack.push(Reachability.Unintialized) - 1; + implicitLabels.push(index); + return index; + } + + function popNamedLabel(label: Identifier, outerState: Reachability): void { + let index = labelIndexMap[label.text]; + Debug.assert(index !== undefined); + Debug.assert(labelStack.length == index + 1); + + labelIndexMap[label.text] = undefined; + + setCurrentStateAtLabel(labelStack.pop(), outerState, label); + } + + function popImplicitLabel(implicitLabelIndex: number, outerState: Reachability): void { + if (labelStack.length !== implicitLabelIndex + 1) { + Debug.assert(false, `Label stack: ${labelStack.length}, index:${implicitLabelIndex}`); + } + + let i = implicitLabels.pop(); + + if (implicitLabelIndex !== i) { + Debug.assert(false, `i: ${i}, index: ${implicitLabelIndex}`); + } + + setCurrentStateAtLabel(labelStack.pop(), outerState, /*name*/ undefined); + } + + function setCurrentStateAtLabel(innerMergedState: Reachability, outerState: Reachability, label: Identifier): void { + if (innerMergedState === Reachability.Unintialized) { + if (label && !options.allowUnusedLabels) { + file.bindDiagnostics.push(createDiagnosticForNode(label, Diagnostics.Unused_label)); + } + currentReachabilityState = outerState; + } + else { + currentReachabilityState = or(innerMergedState, outerState); + } + } + + function jumpToLabel(label: Identifier, outerState: Reachability): boolean { + initializeReachabilityStateIfNecessary(); + + const index = label ? labelIndexMap[label.text] : lastOrUndefined(implicitLabels); + if (index === undefined) { + // reference to unknown label or + // break/continue used outside of loops + return false; + } + const stateAtLabel = labelStack[index]; + labelStack[index] = stateAtLabel === Reachability.Unintialized ? outerState : or(stateAtLabel, outerState); + return true; + } + + function checkUnreachable(node: Node): boolean { + switch (currentReachabilityState) { + case Reachability.Unreachable: + const reportError = + // report error on all statements + isStatement(node) || + // report error on class declarations + node.kind === SyntaxKind.ClassDeclaration || + // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + (node.kind === SyntaxKind.ModuleDeclaration && shouldReportErrorOnModuleDeclaration(node)) || + // report error on regular enums and const enums if preserveConstEnums is set + (node.kind === SyntaxKind.EnumDeclaration && (!isConstEnumDeclaration(node) || options.preserveConstEnums)); + + if (reportError) { + currentReachabilityState = Reachability.ReportedUnreachable; + + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + const reportUnreachableCode = + !options.allowUnreachableCode && + !isInAmbientContext(node) && + ( + node.kind !== SyntaxKind.VariableStatement || + getCombinedNodeFlags((node).declarationList) & NodeFlags.BlockScoped || + forEach((node).declarationList.declarations, d => d.initializer) + ); + + if (reportUnreachableCode) { + errorOnFirstToken(node, Diagnostics.Unreachable_code_detected); + } + } + case Reachability.ReportedUnreachable: + return true; + default: + return false; + } + + function shouldReportErrorOnModuleDeclaration(node: ModuleDeclaration): boolean { + const instanceState = getModuleInstanceState(node); + return instanceState === ModuleInstanceState.Instantiated || (instanceState === ModuleInstanceState.ConstEnumOnly && options.preserveConstEnums); + } + } + + function initializeReachabilityStateIfNecessary(): void { + if (labelIndexMap) { + return; + } + currentReachabilityState = Reachability.Reachable; + labelIndexMap = {}; + labelStack = []; + implicitLabels = []; + } } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f5d35e6ae78..0bb87337466 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -160,6 +160,8 @@ namespace ts { let getGlobalPromiseConstructorLikeType: () => ObjectType; let getGlobalThenableType: () => ObjectType; + let jsxElementClassType: Type; + let tupleTypes: Map = {}; let unionTypes: Map = {}; let intersectionTypes: Map = {}; @@ -4420,7 +4422,8 @@ namespace ts { let container = getThisContainer(node, /*includeArrowFunctions*/ false); let parent = container && container.parent; if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) { - if (!(container.flags & NodeFlags.Static)) { + if (!(container.flags & NodeFlags.Static) && + (container.kind !== SyntaxKind.Constructor || isNodeDescendentOf(node, (container).body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -7873,7 +7876,6 @@ namespace ts { return prop || unknownSymbol; } - let jsxElementClassType: Type = undefined; function getJsxGlobalElementClassType(): Type { if (!jsxElementClassType) { jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); @@ -9619,21 +9621,11 @@ namespace ts { return aggregatedTypes; } - function bodyContainsAReturnStatement(funcBody: Block) { - return forEachReturnStatement(funcBody, returnStatement => { - return true; - }); - } - - function bodyContainsSingleThrowStatement(body: Block) { - return (body.statements.length === 1) && (body.statements[0].kind === SyntaxKind.ThrowStatement); - } - // TypeScript Specification 1.0 (6.3) - July 2014 // 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. - function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func: FunctionLikeDeclaration, returnType: Type): void { + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func: FunctionLikeDeclaration, returnType: Type): void { if (!produceDiagnostics) { return; } @@ -9644,26 +9636,20 @@ namespace ts { } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (nodeIsMissing(func.body) || func.body.kind !== SyntaxKind.Block) { + // also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw + if (nodeIsMissing(func.body) || func.body.kind !== SyntaxKind.Block || !(func.flags & NodeFlags.HasImplicitReturn)) { return; } - let bodyBlock = func.body; - - // Ensure the body has at least one return expression. - if (bodyContainsAReturnStatement(bodyBlock)) { - return; + if (func.flags & NodeFlags.HasExplicitReturn) { + if (compilerOptions.noImplicitReturns) { + error(func.type, Diagnostics.Not_all_code_paths_return_a_value); + } } - - // If there are no return expressions, then we need to check if - // the function body consists solely of a throw statement; - // this is to make an exception for unimplemented functions. - if (bodyContainsSingleThrowStatement(bodyBlock)) { - return; + else { + // This function does not conform to the specification. + error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } - - // This function does not conform to the specification. - error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, contextualMapper?: TypeMapper): Type { @@ -9743,7 +9729,7 @@ namespace ts { } if (returnType && !node.asteriskToken) { - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (node.body) { @@ -10944,8 +10930,15 @@ namespace ts { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); if (node.kind === SyntaxKind.GetAccessor) { - if (!isInAmbientContext(node) && nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { - error(node.name, Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); + if (!isInAmbientContext(node) && nodeIsPresent(node.body) && (node.flags & NodeFlags.HasImplicitReturn)) { + if (node.flags & NodeFlags.HasExplicitReturn) { + if (compilerOptions.noImplicitReturns) { + error(node.name, Diagnostics.Not_all_code_paths_return_a_value); + } + } + else { + error(node.name, Diagnostics.A_get_accessor_must_return_a_value); + } } } @@ -11876,7 +11869,7 @@ namespace ts { promisedType = checkAsyncFunctionReturnType(node); } - checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, isAsync ? promisedType : returnType); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType); } if (produceDiagnostics && !node.type) { @@ -14928,7 +14921,7 @@ namespace ts { function initializeTypeChecker() { // Bind all source files and propagate errors forEach(host.getSourceFiles(), file => { - bindSourceFile(file); + bindSourceFile(file, compilerOptions); }); // Initialize global symbol table diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 84496fdbeb3..f4de5c430ac 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,6 +1,7 @@ /// /// /// +/// /// namespace ts { @@ -150,6 +151,12 @@ namespace ts { type: "boolean", description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "pretty", + paramType: Diagnostics.KIND, + description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, + type: "boolean" + }, { name: "project", shortName: "p", @@ -248,11 +255,31 @@ namespace ts { description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic, }, + { + name: "allowUnusedLabels", + type: "boolean", + description: Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "noImplicitReturns", + type: "boolean", + description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "allowUnreachableCode", + type: "boolean", + description: Diagnostics.Do_not_report_errors_on_unreachable_code + }, { name: "forceConsistentCasingInFileNames", type: "boolean", description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, + } ]; /* @internal */ @@ -405,13 +432,41 @@ namespace ts { */ export function parseConfigFileTextToJson(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } { try { - return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + let jsonTextWithoutComments = removeComments(jsonText); + return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; } catch (e) { return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } + + /** + * Remove the comments from a json like text. + * Comments can be single line comments (starting with # or //) or multiline comments using / * * / + * + * This method replace comment content by whitespace rather than completely remove them to keep positions in json parsing error reporting accurate. + */ + function removeComments(jsonText: string): string { + let output = ""; + let scanner = createScanner(ScriptTarget.ES5, /* skipTrivia */ false, LanguageVariant.Standard, jsonText); + let token: SyntaxKind; + while ((token = scanner.scan()) !== SyntaxKind.EndOfFileToken) { + switch (token) { + case SyntaxKind.SingleLineCommentTrivia: + case SyntaxKind.MultiLineCommentTrivia: + // replace comments with whitespace to preserve original character positions + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; + } + } + return output; + } + + /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 9d34da29897..8ecf818a613 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -503,6 +503,7 @@ namespace ts { function emitSourceFile(node: SourceFile) { currentSourceFile = node; enclosingDeclaration = node; + emitDetachedComments(currentSourceFile, writer, writeCommentRange, node, newLine, true /* remove comments */); emitLines(node.statements); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 08c8cdec091..ad71d646b7b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1012,7 +1012,7 @@ "category": "Error", "code": 2354 }, - "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.": { + "A function whose declared type is neither 'void' nor 'any' must return a value.": { "category": "Error", "code": 2355 }, @@ -1096,7 +1096,7 @@ "category": "Error", "code": 2377 }, - "A 'get' accessor must return a value or consist of a single 'throw' statement.": { + "A 'get' accessor must return a value.": { "category": "Error", "code": 2378 }, @@ -2286,10 +2286,30 @@ "category": "Message", "code": 6072 }, - "Disallow inconsistently-cased references to the same file.": { + "Stylize errors and messages using color and context. (experimental)": { "category": "Message", "code": 6073 }, + "Do not report errors on unused labels.": { + "category": "Message", + "code": 6074 + }, + "Report error when not all code paths in function return a value.": { + "category": "Message", + "code": 6075 + }, + "Report errors for fallthrough cases in switch statement.": { + "category": "Message", + "code": 6076 + }, + "Do not report errors on unreachable code.": { + "category": "Message", + "code": 6077 + }, + "Disallow inconsistently-cased references to the same file.": { + "category": "Message", + "code": 6078 + }, "Specify JSX code generation: 'preserve' or 'react'": { "category": "Message", "code": 6080 @@ -2370,8 +2390,22 @@ "category": "Error", "code": 7026 }, - - + "Unreachable code detected.": { + "category": "Error", + "code": 7027 + }, + "Unused label.": { + "category": "Error", + "code": 7028 + }, + "Fallthrough case in switch.": { + "category": "Error", + "code": 7029 + }, + "Not all code paths return a value.": { + "category": "Error", + "code": 7030 + }, "You cannot rename this element.": { "category": "Error", "code": 8000 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4baf62668ad..5953b63442b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -21,6 +21,12 @@ namespace ts { type DependencyGroup = Array; + const enum Jump { + Break = 1 << 1, + Continue = 1 << 2, + Return = 1 << 3 + } + let entities: Map = { "quot": 0x0022, "amp": 0x0026, @@ -373,14 +379,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi sourceMaps: sourceMapDataList }; - function isNodeDescendentOf(node: Node, ancestor: Node): boolean { - while (node) { - if (node === ancestor) return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name: string, container: Node): boolean { for (let node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && hasProperty(node.locals, name)) { @@ -393,12 +391,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return true; } - const enum Jump { - Break = 1 << 1, - Continue = 1 << 2, - Return = 1 << 3 - } - interface ConvertedLoopState { /* * set of labels that occured inside the converted loop @@ -3639,10 +3631,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // // for (let v of arr) { } // - // we don't want to emit a temporary variable for the RHS, just use it directly. - let rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; + // we can't reuse 'arr' because it might be modified within the body of the loop. let counter = createTempVariable(TempFlags._i); - let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(TempFlags.Auto); + let rhsReference = createSynthesizedNode(SyntaxKind.Identifier) as Identifier; + rhsReference.text = node.expression.kind === SyntaxKind.Identifier ? + makeUniqueName((node.expression).text) : + makeTempVariableName(TempFlags.Auto); // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. @@ -3654,15 +3648,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(" = 0"); emitEnd(node.expression); - if (!rhsIsIdentifier) { - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } + // , _a = expr + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); write("; "); @@ -4932,7 +4924,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi increaseIndent(); let outPos = writer.getTextPos(); - emitDetachedComments(node.body); + emitDetachedCommentsAndUpdateCommentsInfo(node.body); emitFunctionBodyPreamble(node); let preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); @@ -4977,7 +4969,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let initialTextPos = writer.getTextPos(); increaseIndent(); - emitDetachedComments(body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). @@ -5299,7 +5291,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedComments(ctor.body.statements); + emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); let superCall: ExpressionStatement; @@ -7693,7 +7685,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Start new file on new line writeLine(); emitShebang(); - emitDetachedComments(node); + emitDetachedCommentsAndUpdateCommentsInfo(node); if (isExternalModule(node) || compilerOptions.isolatedModules) { if (root || (!isExternalModule(node) && compilerOptions.isolatedModules)) { @@ -7994,11 +7986,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return leadingComments; } - function isPinnedComments(comment: CommentRange) { - return currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && - currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; - } - /** * Determine if the given comment is a triple-slash * @@ -8132,62 +8119,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitDetachedComments(node: TextRange) { - let leadingComments: CommentRange[]; - if (compilerOptions.removeComments) { - // removeComments is true, only reserve pinned comment at the top of file - // For example: - // /*! Pinned Comment */ - // - // var x = 10; - if (node.pos === 0) { - leadingComments = filter(getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + function emitDetachedCommentsAndUpdateCommentsInfo(node: TextRange) { + let currentDetachedCommentInfo = emitDetachedComments(currentSourceFile, writer, writeComment, node, newLine, compilerOptions.removeComments); + + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); } - } - else { - // removeComments is false, just get detached as normal and bypass the process to filter comment - leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); - } - - if (leadingComments) { - let detachedComments: CommentRange[] = []; - let lastComment: CommentRange; - - forEach(leadingComments, comment => { - if (lastComment) { - let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - let commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); - - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - - detachedComments.push(comment); - lastComment = comment; - }); - - if (detachedComments.length) { - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastOrUndefined(detachedComments).end); - let nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - // Valid detachedComments - emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - let currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 3eeb126c065..6263f7237f6 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -198,6 +198,7 @@ namespace ts { const _fs = require("fs"); const _path = require("path"); const _os = require("os"); + const _tty = require("tty"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond @@ -375,15 +376,7 @@ namespace ts { newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write(s: string): void { - const buffer = new Buffer(s, "utf8"); - let offset = 0; - let toWrite: number = buffer.length; - let written = 0; - // 1 is a standard descriptor for stdout - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } + process.stdout.write(s); }, readFile, writeFile, diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 232360116f3..083df70be0f 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -6,6 +6,14 @@ namespace ts { fileWatcher?: FileWatcher; } + let reportDiagnostic = reportDiagnosticSimply; + + function reportDiagnostics(diagnostics: Diagnostic[], host: CompilerHost): void { + for (let diagnostic of diagnostics) { + reportDiagnostic(diagnostic, host); + } + } + /** * Checks to see if the locale is in the appropriate format, * and if it is, attempts to set the appropriate language. @@ -81,16 +89,16 @@ namespace ts { return diagnostic.messageText; } - function reportDiagnostic(diagnostic: Diagnostic, host: CompilerHost) { + function reportDiagnosticSimply(diagnostic: Diagnostic, host: CompilerHost): void { let output = ""; if (diagnostic.file) { - let loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); + const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); const relativeFileName = host ? convertToRelativePath(diagnostic.file.fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName)) : diagnostic.file.fileName; - output += `${ relativeFileName }(${ loc.line + 1 },${ loc.character + 1 }): `; + output += `${ diagnostic.file.fileName }(${ line + 1 },${ character + 1 }): `; } let category = DiagnosticCategory[diagnostic.category].toLowerCase(); @@ -99,10 +107,91 @@ namespace ts { sys.write(output); } - function reportDiagnostics(diagnostics: Diagnostic[], host: CompilerHost) { - for (let i = 0; i < diagnostics.length; i++) { - reportDiagnostic(diagnostics[i], host); + + const redForegroundEscapeSequence = "\u001b[91m"; + const yellowForegroundEscapeSequence = "\u001b[93m"; + const blueForegroundEscapeSequence = "\u001b[93m"; + const gutterStyleSequence = "\u001b[100;30m"; + const gutterSeparator = " "; + const resetEscapeSequence = "\u001b[0m"; + const elipsis = "..."; + const categoryFormatMap: Map = { + [DiagnosticCategory.Warning]: yellowForegroundEscapeSequence, + [DiagnosticCategory.Error]: redForegroundEscapeSequence, + [DiagnosticCategory.Message]: blueForegroundEscapeSequence, + }; + + function formatAndReset(text: string, formatStyle: string) { + return formatStyle + text + resetEscapeSequence; + } + + function reportDiagnosticWithColorAndContext(diagnostic: Diagnostic, host: CompilerHost): void { + let output = ""; + + if (diagnostic.file) { + let { start, length, file } = diagnostic; + let { line: firstLine, character: firstLineChar } = getLineAndCharacterOfPosition(file, start); + let { line: lastLine, character: lastLineChar } = getLineAndCharacterOfPosition(file, start + length); + const lastLineInFile = getLineAndCharacterOfPosition(file, file.text.length).line; + + let hasMoreThanFiveLines = (lastLine - firstLine) >= 4; + let gutterWidth = (lastLine + 1 + "").length; + if (hasMoreThanFiveLines) { + gutterWidth = Math.max(elipsis.length, gutterWidth); + } + + output += sys.newLine; + for (let i = firstLine; i <= lastLine; i++) { + // If the error spans over 5 lines, we'll only show the first 2 and last 2 lines, + // so we'll skip ahead to the second-to-last line. + if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) { + output += formatAndReset(padLeft(elipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + sys.newLine; + i = lastLine - 1; + } + + let lineStart = getPositionOfLineAndCharacter(file, i, 0); + let lineEnd = i < lastLineInFile ? getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length; + let lineContent = file.text.slice(lineStart, lineEnd); + lineContent = lineContent.replace(/\s+$/g, ""); // trim from end + lineContent = lineContent.replace("\t", " "); // convert tabs to single spaces + + // Output the gutter and the actual contents of the line. + output += formatAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator; + output += lineContent + sys.newLine; + + // Output the gutter and the error span for the line using tildes. + output += formatAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator; + output += redForegroundEscapeSequence; + if (i === firstLine) { + // If we're on the last line, then limit it to the last character of the last line. + // Otherwise, we'll just squiggle the rest of the line, giving 'slice' no end position. + const lastCharForLine = i === lastLine ? lastLineChar : undefined; + + output += lineContent.slice(0, firstLineChar).replace(/\S/g, " "); + output += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~"); + } + else if (i === lastLine) { + output += lineContent.slice(0, lastLineChar).replace(/./g, "~"); + } + else { + // Squiggle the entire line. + output += lineContent.replace(/./g, "~"); + } + output += resetEscapeSequence; + + output += sys.newLine; + } + + output += sys.newLine; + output += `${ file.fileName }(${ firstLine + 1 },${ firstLineChar + 1 }): `; } + + const categoryColor = categoryFormatMap[diagnostic.category]; + const category = DiagnosticCategory[diagnostic.category].toLowerCase(); + output += `${ formatAndReset(category, categoryColor) } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }`; + output += sys.newLine + sys.newLine; + + sys.write(output); } function reportWatchDiagnostic(diagnostic: Diagnostic) { @@ -288,6 +377,10 @@ namespace ts { compilerHost.fileExists = cachedFileExists; } + if (compilerOptions.pretty) { + reportDiagnostic = reportDiagnosticWithColorAndContext; + } + // reset the cache of existing files cachedExistingFiles = {}; diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index fd541a8ca80..ca297c087cf 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -11,6 +11,7 @@ "core.ts", "sys.ts", "types.ts", + "diagnosticInformationMap.generated.ts", "scanner.ts", "parser.ts", "utilities.ts", @@ -19,7 +20,6 @@ "emitter.ts", "program.ts", "commandLineParser.ts", - "tsc.ts", - "diagnosticInformationMap.generated.ts" + "tsc.ts" ] } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bc88356193d..19e4211533d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -367,28 +367,31 @@ namespace ts { export const enum NodeFlags { None = 0, - Export = 0x00000001, // Declarations - Ambient = 0x00000002, // Declarations - Public = 0x00000010, // Property/Method - Private = 0x00000020, // Property/Method - Protected = 0x00000040, // Property/Method - Static = 0x00000080, // Property/Method - Abstract = 0x00000100, // Class/Method/ConstructSignature - Async = 0x00000200, // Property/Method/Function - Default = 0x00000400, // Function/Class (export default declaration) - MultiLine = 0x00000800, // Multi-line array or object literal - Synthetic = 0x00001000, // Synthetic node (for full fidelity) - DeclarationFile = 0x00002000, // Node is a .d.ts file - Let = 0x00004000, // Variable declaration - Const = 0x00008000, // Variable declaration - OctalLiteral = 0x00010000, // Octal numeric literal - Namespace = 0x00020000, // Namespace declaration - ExportContext = 0x00040000, // Export context (initialized by binding) - ContainsThis = 0x00080000, // Interface contains references to "this" - + Export = 1 << 1, // Declarations + Ambient = 1 << 2, // Declarations + Public = 1 << 3, // Property/Method + Private = 1 << 4, // Property/Method + Protected = 1 << 5, // Property/Method + Static = 1 << 6, // Property/Method + Abstract = 1 << 7, // Class/Method/ConstructSignature + Async = 1 << 8, // Property/Method/Function + Default = 1 << 9, // Function/Class (export default declaration) + MultiLine = 1 << 10, // Multi-line array or object literal + Synthetic = 1 << 11, // Synthetic node (for full fidelity) + DeclarationFile = 1 << 12, // Node is a .d.ts file + Let = 1 << 13, // Variable declaration + Const = 1 << 14, // Variable declaration + OctalLiteral = 1 << 15, // Octal numeric literal + Namespace = 1 << 16, // Namespace declaration + ExportContext = 1 << 17, // Export context (initialized by binding) + ContainsThis = 1 << 18, // Interface contains references to "this" + HasImplicitReturn = 1 << 19, // If function implicitly returns on one of codepaths (initialized by binding) + HasExplicitReturn = 1 << 20, // If function has explicit reachable return on one of codepaths (initialized by binding) Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async, AccessibilityModifier = Public | Private | Protected, - BlockScoped = Let | Const + BlockScoped = Let | Const, + + ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn } /* @internal */ @@ -2085,6 +2088,7 @@ namespace ts { outFile?: string; outDir?: string; preserveConstEnums?: boolean; + /* @internal */ pretty?: DiagnosticStyle; project?: string; removeComments?: boolean; rootDir?: string; @@ -2099,6 +2103,10 @@ namespace ts { experimentalDecorators?: boolean; emitDecoratorMetadata?: boolean; moduleResolution?: ModuleResolutionKind; + allowUnusedLabels?: boolean; + allowUnreachableCode?: boolean; + noImplicitReturns?: boolean; + noFallthroughCasesInSwitch?: boolean; forceConsistentCasingInFileNames?: boolean; /* @internal */ stripInternal?: boolean; @@ -2150,6 +2158,12 @@ namespace ts { JSX, } + /* @internal */ + export const enum DiagnosticStyle { + Simple, + Pretty, + } + export interface ParsedCommandLine { options: CompilerOptions; fileNames: string[]; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9638b618629..297969025ca 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -622,25 +622,26 @@ namespace ts { } export function isFunctionLike(node: Node): node is FunctionLikeDeclaration { - if (node) { - switch (node.kind) { - case SyntaxKind.Constructor: - case SyntaxKind.FunctionExpression: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ArrowFunction: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.CallSignature: - case SyntaxKind.ConstructSignature: - case SyntaxKind.IndexSignature: - case SyntaxKind.FunctionType: - case SyntaxKind.ConstructorType: - return true; - } + return node && isFunctionLikeKind(node.kind); + } + + export function isFunctionLikeKind(kind: SyntaxKind): boolean { + switch (kind) { + case SyntaxKind.Constructor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ArrowFunction: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + case SyntaxKind.IndexSignature: + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructorType: + return true; } - return false; } export function introducesArgumentsExoticObject(node: Node) { @@ -1167,6 +1168,14 @@ namespace ts { return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern); } + export function isNodeDescendentOf(node: Node, ancestor: Node): boolean { + while (node) { + if (node === ancestor) return true; + node = node.parent; + } + return false; + } + export function isInAmbientContext(node: Node): boolean { while (node) { if (node.flags & (NodeFlags.Ambient | NodeFlags.DeclarationFile)) { @@ -1228,7 +1237,7 @@ namespace ts { case SyntaxKind.LabeledStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.SwitchStatement: - case SyntaxKind.ThrowKeyword: + case SyntaxKind.ThrowStatement: case SyntaxKind.TryStatement: case SyntaxKind.VariableStatement: case SyntaxKind.WhileStatement: @@ -1914,6 +1923,74 @@ namespace ts { }); } + /** + * Detached comment is a comment at the top of file or function body that is separated from + * the next statement by space. + */ + export function emitDetachedComments(currentSourceFile: SourceFile, writer: EmitTextWriter, + writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void, + node: TextRange, newLine: string, removeComments: boolean) { + let leadingComments: CommentRange[]; + let currentDetachedCommentInfo: {nodePos: number, detachedCommentEndPos: number}; + if (removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = filter(getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComment); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + + if (leadingComments) { + let detachedComments: CommentRange[] = []; + let lastComment: CommentRange; + + for (let comment of leadingComments) { + if (lastComment) { + let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + let commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + + if (commentLine >= lastCommentLine + 2) { + // There was a blank line between the last comment and this comment. This + // comment is not part of the copyright comments. Return what we have so + // far. + break; + } + } + + detachedComments.push(comment); + lastComment = comment; + } + + if (detachedComments.length) { + // All comments look like they could have been part of the copyright header. Make + // sure there is at least one blank line between it and the node. If not, it's not + // a copyright header. + let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastOrUndefined(detachedComments).end); + let nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + // Valid detachedComments + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: lastOrUndefined(detachedComments).end }; + } + } + } + + return currentDetachedCommentInfo; + + function isPinnedComment(comment: CommentRange) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && + currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; + } + } + export function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { let firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 227ba6a7970..e307b21979e 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -446,7 +446,7 @@ namespace ts.BreakpointResolver { // fall through. case SyntaxKind.CatchClause: - return spanInNode(lastOrUndefined((node.parent).statements));; + return spanInNode(lastOrUndefined((node.parent).statements)); case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause @@ -493,9 +493,6 @@ namespace ts.BreakpointResolver { default: return spanInNode(node.parent); } - - // Default to parent node - return spanInNode(node.parent); } function spanInColonToken(node: Node): TextSpan { diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3b68cd0ebb2..de1d1b19cf2 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -360,7 +360,6 @@ namespace ts.formatting { return node; } } - return node; } } diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index bc506bc22f9..2a0abba8695 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -6,6 +6,9 @@ namespace ts.NavigateTo { let patternMatcher = createPatternMatcher(searchValue); let rawItems: RawNavigateToItem[] = []; + // This means "compare in a case insensitive manner." + let baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); @@ -162,8 +165,6 @@ namespace ts.NavigateTo { return bestMatchKind; } - // This means "compare in a case insensitive manner." - let baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. // Right now we just sort by kind first, and then by name of the item. diff --git a/src/services/services.ts b/src/services/services.ts index 6b7aa0ecbff..1672e4ad4ff 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4937,7 +4937,7 @@ namespace ts { else if (!isFunctionLike(node)) { forEachChild(node, aggregate); } - }; + } } /** @@ -4984,7 +4984,7 @@ namespace ts { else if (!isFunctionLike(node)) { forEachChild(node, aggregate); } - }; + } } function ownsBreakOrContinueStatement(owner: Node, statement: BreakOrContinueStatement): boolean { @@ -6293,8 +6293,6 @@ namespace ts { } return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; - - Debug.fail("Unknown declaration type"); } function isTypeReference(node: Node): boolean { diff --git a/src/services/shims.ts b/src/services/shims.ts index e919625395d..8482cb50975 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -323,7 +323,6 @@ namespace ts { // TODO: should this be '==='? if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - return null; } return JSON.parse(settingsJson); } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.js b/tests/baselines/reference/ES3For-ofTypeCheck4.js index 7386a1967eb..a628a81c517 100644 --- a/tests/baselines/reference/ES3For-ofTypeCheck4.js +++ b/tests/baselines/reference/ES3For-ofTypeCheck4.js @@ -4,6 +4,6 @@ for (const v of union) { } //// [ES3For-ofTypeCheck4.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.js b/tests/baselines/reference/ES3For-ofTypeCheck6.js index ddc11808b18..8b4a917eb85 100644 --- a/tests/baselines/reference/ES3For-ofTypeCheck6.js +++ b/tests/baselines/reference/ES3For-ofTypeCheck6.js @@ -4,6 +4,6 @@ for (var v of union) { } //// [ES3For-ofTypeCheck6.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-of24.js b/tests/baselines/reference/ES5For-of24.js index cdc0876692f..ce4376ad648 100644 --- a/tests/baselines/reference/ES5For-of24.js +++ b/tests/baselines/reference/ES5For-of24.js @@ -6,7 +6,7 @@ for (var v of a) { //// [ES5For-of24.js] var a = [1, 2, 3]; -for (var _i = 0; _i < a.length; _i++) { - var v = a[_i]; - var a_1 = 0; +for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + var v = a_1[_i]; + var a_2 = 0; } diff --git a/tests/baselines/reference/ES5For-of25.js b/tests/baselines/reference/ES5For-of25.js index 756c14fbe81..440c0b55efb 100644 --- a/tests/baselines/reference/ES5For-of25.js +++ b/tests/baselines/reference/ES5For-of25.js @@ -7,8 +7,8 @@ for (var v of a) { //// [ES5For-of25.js] var a = [1, 2, 3]; -for (var _i = 0; _i < a.length; _i++) { - var v = a[_i]; +for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + var v = a_1[_i]; v; a; } diff --git a/tests/baselines/reference/ES5For-of25.js.map b/tests/baselines/reference/ES5For-of25.js.map index cc31767128b..1c4d8c2101f 100644 --- a/tests/baselines/reference/ES5For-of25.js.map +++ b/tests/baselines/reference/ES5For-of25.js.map @@ -1,2 +1,2 @@ //// [ES5For-of25.js.map] -{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAV,eAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.sourcemap.txt b/tests/baselines/reference/ES5For-of25.sourcemap.txt index 623627fde20..453eef4ee46 100644 --- a/tests/baselines/reference/ES5For-of25.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of25.sourcemap.txt @@ -21,7 +21,7 @@ sourceFile:ES5For-of25.ts 10> ^ 11> ^ 12> ^ -13> ^^^^^^^^^^^^^^^^^^^^^^-> +13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > a @@ -47,17 +47,19 @@ sourceFile:ES5For-of25.ts 11>Emitted(1, 18) Source(1, 18) + SourceIndex(0) 12>Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>>for (var _i = 0; _i < a.length; _i++) { +>>>for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { 1-> 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^^^^^^^^ -8 > ^^ -9 > ^^^^ -10> ^ +7 > ^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^ +12> ^ 1-> > 2 >for @@ -65,40 +67,38 @@ sourceFile:ES5For-of25.ts 4 > (var v of 5 > a 6 > -7 > var v -8 > -9 > var v of a -10> ) +7 > a +8 > +9 > var v +10> +11> var v of a +12> ) 1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) 2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0) 3 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) 4 >Emitted(2, 6) Source(2, 15) + SourceIndex(0) 5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) -6 >Emitted(2, 18) Source(2, 6) + SourceIndex(0) -7 >Emitted(2, 31) Source(2, 11) + SourceIndex(0) -8 >Emitted(2, 33) Source(2, 6) + SourceIndex(0) -9 >Emitted(2, 37) Source(2, 16) + SourceIndex(0) -10>Emitted(2, 38) Source(2, 17) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 15) + SourceIndex(0) +7 >Emitted(2, 25) Source(2, 16) + SourceIndex(0) +8 >Emitted(2, 27) Source(2, 6) + SourceIndex(0) +9 >Emitted(2, 42) Source(2, 11) + SourceIndex(0) +10>Emitted(2, 44) Source(2, 6) + SourceIndex(0) +11>Emitted(2, 48) Source(2, 16) + SourceIndex(0) +12>Emitted(2, 49) Source(2, 17) + SourceIndex(0) --- ->>> var v = a[_i]; +>>> var v = a_1[_i]; 1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^ +4 > ^^^^^^^^^^ 1 > 2 > var 3 > v -4 > of -5 > a -6 > +4 > 1 >Emitted(3, 5) Source(2, 6) + SourceIndex(0) 2 >Emitted(3, 9) Source(2, 10) + SourceIndex(0) 3 >Emitted(3, 10) Source(2, 11) + SourceIndex(0) -4 >Emitted(3, 13) Source(2, 15) + SourceIndex(0) -5 >Emitted(3, 14) Source(2, 16) + SourceIndex(0) -6 >Emitted(3, 18) Source(2, 11) + SourceIndex(0) +4 >Emitted(3, 20) Source(2, 11) + SourceIndex(0) --- >>> v; 1 >^^^^ diff --git a/tests/baselines/reference/ES5For-of30.js b/tests/baselines/reference/ES5For-of30.js index 2a1dc5a3399..fead25e7cf0 100644 --- a/tests/baselines/reference/ES5For-of30.js +++ b/tests/baselines/reference/ES5For-of30.js @@ -9,8 +9,8 @@ for ([a = 1, b = ""] of tuple) { //// [ES5For-of30.js] var a, b; var tuple = [2, "3"]; -for (var _i = 0; _i < tuple.length; _i++) { - _a = tuple[_i], _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], b = _c === void 0 ? "" : _c; +for (var _i = 0, tuple_1 = tuple; _i < tuple_1.length; _i++) { + _a = tuple_1[_i], _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], b = _c === void 0 ? "" : _c; a; b; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.js b/tests/baselines/reference/ES5For-ofTypeCheck11.js index c0e46a45452..ce439427755 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck11.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck11.js @@ -6,6 +6,6 @@ for (v of union) { } //// [ES5For-ofTypeCheck11.js] var union; var v; -for (var _i = 0; _i < union.length; _i++) { - v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.js b/tests/baselines/reference/ES5For-ofTypeCheck3.js index 76d8237997b..61a60727cba 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck3.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck3.js @@ -4,6 +4,6 @@ for (var v of tuple) { } //// [ES5For-ofTypeCheck3.js] var tuple = ["", 0]; -for (var _i = 0; _i < tuple.length; _i++) { - var v = tuple[_i]; +for (var _i = 0, tuple_1 = tuple; _i < tuple_1.length; _i++) { + var v = tuple_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.js b/tests/baselines/reference/ES5For-ofTypeCheck4.js index 630bc869c58..6240b6a799a 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck4.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck4.js @@ -4,6 +4,6 @@ for (const v of union) { } //// [ES5For-ofTypeCheck4.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.js b/tests/baselines/reference/ES5For-ofTypeCheck5.js index 2e6b47f779d..0d285d67d8b 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck5.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck5.js @@ -4,6 +4,6 @@ for (var v of union) { } //// [ES5For-ofTypeCheck5.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.js b/tests/baselines/reference/ES5For-ofTypeCheck6.js index 9249020b9d4..c99fd415b23 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck6.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck6.js @@ -4,6 +4,6 @@ for (var v of union) { } //// [ES5For-ofTypeCheck6.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.js b/tests/baselines/reference/ES5For-ofTypeCheck7.js index d5b74a24728..1bd360e5132 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck7.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck7.js @@ -4,6 +4,6 @@ for (var v of union) { } //// [ES5For-ofTypeCheck7.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.js b/tests/baselines/reference/ES5For-ofTypeCheck8.js index d73aea1cb7b..ae4a823a18c 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck8.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck8.js @@ -6,6 +6,6 @@ for (v of union) { } //// [ES5For-ofTypeCheck8.js] var union; var v; -for (var _i = 0; _i < union.length; _i++) { - v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.js b/tests/baselines/reference/ES5For-ofTypeCheck9.js index 6c7465d10ec..3e18c2da31f 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck9.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck9.js @@ -4,6 +4,6 @@ for (let v of union) { } //// [ES5For-ofTypeCheck9.js] var union; -for (var _i = 0; _i < union.length; _i++) { - var v = union[_i]; +for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { + var v = union_1[_i]; } diff --git a/tests/baselines/reference/ES5for-of32.js b/tests/baselines/reference/ES5for-of32.js new file mode 100644 index 00000000000..7af7cc3874a --- /dev/null +++ b/tests/baselines/reference/ES5for-of32.js @@ -0,0 +1,23 @@ +//// [ES5for-of32.ts] + +var array = [1,2,3]; +var sum = 0; + +for (let num of array) { + if (sum === 0) { + array = [4,5,6] + } + + sum += num; +} + +//// [ES5for-of32.js] +var array = [1, 2, 3]; +var sum = 0; +for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var num = array_1[_i]; + if (sum === 0) { + array = [4, 5, 6]; + } + sum += num; +} diff --git a/tests/baselines/reference/ES5for-of32.symbols b/tests/baselines/reference/ES5for-of32.symbols new file mode 100644 index 00000000000..5672ad01109 --- /dev/null +++ b/tests/baselines/reference/ES5for-of32.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts === + +var array = [1,2,3]; +>array : Symbol(array, Decl(ES5for-of32.ts, 1, 3)) + +var sum = 0; +>sum : Symbol(sum, Decl(ES5for-of32.ts, 2, 3)) + +for (let num of array) { +>num : Symbol(num, Decl(ES5for-of32.ts, 4, 8)) +>array : Symbol(array, Decl(ES5for-of32.ts, 1, 3)) + + if (sum === 0) { +>sum : Symbol(sum, Decl(ES5for-of32.ts, 2, 3)) + + array = [4,5,6] +>array : Symbol(array, Decl(ES5for-of32.ts, 1, 3)) + } + + sum += num; +>sum : Symbol(sum, Decl(ES5for-of32.ts, 2, 3)) +>num : Symbol(num, Decl(ES5for-of32.ts, 4, 8)) +} diff --git a/tests/baselines/reference/ES5for-of32.types b/tests/baselines/reference/ES5for-of32.types new file mode 100644 index 00000000000..6fe5ba2008b --- /dev/null +++ b/tests/baselines/reference/ES5for-of32.types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts === + +var array = [1,2,3]; +>array : number[] +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +var sum = 0; +>sum : number +>0 : number + +for (let num of array) { +>num : number +>array : number[] + + if (sum === 0) { +>sum === 0 : boolean +>sum : number +>0 : number + + array = [4,5,6] +>array = [4,5,6] : number[] +>array : number[] +>[4,5,6] : number[] +>4 : number +>5 : number +>6 : number + } + + sum += num; +>sum += num : number +>sum : number +>num : number +} diff --git a/tests/baselines/reference/ParameterList5.errors.txt b/tests/baselines/reference/ParameterList5.errors.txt index 02b86633b95..618ce740915 100644 --- a/tests/baselines/reference/ParameterList5.errors.txt +++ b/tests/baselines/reference/ParameterList5.errors.txt @@ -1,4 +1,4 @@ -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,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. 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'. @@ -6,7 +6,7 @@ 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 { ~~~~~~~~~~~~~~~ -!!! error TS2355: 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. ~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. ~ diff --git a/tests/baselines/reference/YieldExpression17_es6.errors.txt b/tests/baselines/reference/YieldExpression17_es6.errors.txt index bc262212526..f987517371f 100644 --- a/tests/baselines/reference/YieldExpression17_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression17_es6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator body. @@ -8,6 +8,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~~~~~ !!! error TS1163: A 'yield' expression is only allowed in a generator body. \ No newline at end of file diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5.js b/tests/baselines/reference/argumentsObjectIterator01_ES5.js index bc51d6f5582..8378528dbf4 100644 --- a/tests/baselines/reference/argumentsObjectIterator01_ES5.js +++ b/tests/baselines/reference/argumentsObjectIterator01_ES5.js @@ -11,8 +11,8 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe //// [argumentsObjectIterator01_ES5.js] function doubleAndReturnAsArray(x, y, z) { var result = []; - for (var _i = 0; _i < arguments.length; _i++) { - var arg = arguments[_i]; + for (var _i = 0, arguments_1 = arguments; _i < arguments_1.length; _i++) { + var arg = arguments_1[_i]; result.push(arg + arg); } return result; diff --git a/tests/baselines/reference/assignmentLHSIsValue.errors.txt b/tests/baselines/reference/assignmentLHSIsValue.errors.txt index cf747b44b3e..bf253df5e70 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/assignmentLHSIsValue.errors.txt @@ -13,6 +13,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2 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(35,3): error TS7028: Unused label. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: Invalid left-hand side of assignment expression. @@ -38,7 +39,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6 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 (38 errors) ==== +==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ==== // expected error for all the LHS of assignments var value; @@ -104,6 +105,8 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7 // object literals { a: 0} = value; + ~ +!!! error TS7028: Unused label. ~ !!! error TS1128: Declaration or statement expected. diff --git a/tests/baselines/reference/asyncArrowFunction10_es6.errors.txt b/tests/baselines/reference/asyncArrowFunction10_es6.errors.txt index 2476eaec6e3..08e59e69b9f 100644 --- a/tests/baselines/reference/asyncArrowFunction10_es6.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction10_es6.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,17): error TS1005: ',' expected. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,20): error TS1005: '=' expected. -tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,24): 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/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,24): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(4,11): error TS2304: Cannot find name 'await'. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts ~ !!! error TS1005: '=' expected. ~~~~~~~~~~~~~ -!!! error TS2355: 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. // Legal to use 'await' in a type context. var v: await; ~~~~~ diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es6.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration12_es6.errors.txt index 978492f0744..43df8e21659 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es6.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es6.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,24): error TS1005: '(' expected. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,29): error TS1005: '=' expected. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,33): 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/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,33): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,47): error TS1005: '=>' expected. @@ -11,6 +11,6 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 ~ !!! error TS1005: '=' expected. ~~~~~~~~~~~~~ -!!! error TS2355: 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. ~ !!! error TS1005: '=>' expected. \ No newline at end of file diff --git a/tests/baselines/reference/asyncGetter_es6.errors.txt b/tests/baselines/reference/asyncGetter_es6.errors.txt index 5f5a9f6b1d7..f6deea16d06 100644 --- a/tests/baselines/reference/asyncGetter_es6.errors.txt +++ b/tests/baselines/reference/asyncGetter_es6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here. -tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,13): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,13): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/async/es6/asyncGetter_es6.ts (2 errors) ==== @@ -8,6 +8,6 @@ tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,13): error TS2378: A 'get ~~~~~ !!! error TS1042: 'async' modifier cannot be used here. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } } \ No newline at end of file diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.js b/tests/baselines/reference/bestCommonTypeReturnStatement.js index f4ab98ed1c6..6d6f73bc0cf 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.js +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.js @@ -1,4 +1,5 @@ //// [bestCommonTypeReturnStatement.ts] + interface IPromise { then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise; } diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.symbols b/tests/baselines/reference/bestCommonTypeReturnStatement.symbols index 43e04ef037d..14e770ae255 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.symbols +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.symbols @@ -1,34 +1,35 @@ === tests/cases/compiler/bestCommonTypeReturnStatement.ts === + interface IPromise { >IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0)) ->T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 0, 19)) +>T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 1, 19)) then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise; ->then : Symbol(then, Decl(bestCommonTypeReturnStatement.ts, 0, 23)) ->successCallback : Symbol(successCallback, Decl(bestCommonTypeReturnStatement.ts, 1, 9)) ->promiseValue : Symbol(promiseValue, Decl(bestCommonTypeReturnStatement.ts, 1, 27)) ->T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 0, 19)) ->errorCallback : Symbol(errorCallback, Decl(bestCommonTypeReturnStatement.ts, 1, 51)) ->reason : Symbol(reason, Decl(bestCommonTypeReturnStatement.ts, 1, 69)) +>then : Symbol(then, Decl(bestCommonTypeReturnStatement.ts, 1, 23)) +>successCallback : Symbol(successCallback, Decl(bestCommonTypeReturnStatement.ts, 2, 9)) +>promiseValue : Symbol(promiseValue, Decl(bestCommonTypeReturnStatement.ts, 2, 27)) +>T : Symbol(T, Decl(bestCommonTypeReturnStatement.ts, 1, 19)) +>errorCallback : Symbol(errorCallback, Decl(bestCommonTypeReturnStatement.ts, 2, 51)) +>reason : Symbol(reason, Decl(bestCommonTypeReturnStatement.ts, 2, 69)) >IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0)) } function f() { ->f : Symbol(f, Decl(bestCommonTypeReturnStatement.ts, 2, 1)) +>f : Symbol(f, Decl(bestCommonTypeReturnStatement.ts, 3, 1)) if (true) return b(); ->b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 7, 1)) +>b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 8, 1)) return d(); ->d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 10, 45)) +>d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 11, 45)) } function b(): IPromise { return null; } ->b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 7, 1)) +>b : Symbol(b, Decl(bestCommonTypeReturnStatement.ts, 8, 1)) >IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0)) function d(): IPromise { return null; } ->d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 10, 45)) +>d : Symbol(d, Decl(bestCommonTypeReturnStatement.ts, 11, 45)) >IPromise : Symbol(IPromise, Decl(bestCommonTypeReturnStatement.ts, 0, 0)) diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.types b/tests/baselines/reference/bestCommonTypeReturnStatement.types index 28974f064a5..31f72ab93b4 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.types +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.types @@ -1,4 +1,5 @@ === tests/cases/compiler/bestCommonTypeReturnStatement.ts === + interface IPromise { >IPromise : IPromise >T : T diff --git a/tests/baselines/reference/breakTarget3.js b/tests/baselines/reference/breakTarget3.js index 0fa6cd2d298..b36eeb3902b 100644 --- a/tests/baselines/reference/breakTarget3.js +++ b/tests/baselines/reference/breakTarget3.js @@ -1,4 +1,5 @@ //// [breakTarget3.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/breakTarget3.symbols b/tests/baselines/reference/breakTarget3.symbols index 580706bbd4a..a0b17435504 100644 --- a/tests/baselines/reference/breakTarget3.symbols +++ b/tests/baselines/reference/breakTarget3.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/breakTarget3.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. break target1; diff --git a/tests/baselines/reference/breakTarget3.types b/tests/baselines/reference/breakTarget3.types index 785bf00ef6e..e4b5f8a1c61 100644 --- a/tests/baselines/reference/breakTarget3.types +++ b/tests/baselines/reference/breakTarget3.types @@ -1,4 +1,5 @@ === tests/cases/compiler/breakTarget3.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/breakTarget4.js b/tests/baselines/reference/breakTarget4.js index 4586301d71b..0c91e44ecbd 100644 --- a/tests/baselines/reference/breakTarget4.js +++ b/tests/baselines/reference/breakTarget4.js @@ -1,4 +1,5 @@ //// [breakTarget4.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/breakTarget4.symbols b/tests/baselines/reference/breakTarget4.symbols index aba35ddcfdf..d4edcb17e1a 100644 --- a/tests/baselines/reference/breakTarget4.symbols +++ b/tests/baselines/reference/breakTarget4.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/breakTarget4.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. break target2; diff --git a/tests/baselines/reference/breakTarget4.types b/tests/baselines/reference/breakTarget4.types index eb4c14f6386..8b6ccf600ad 100644 --- a/tests/baselines/reference/breakTarget4.types +++ b/tests/baselines/reference/breakTarget4.types @@ -1,4 +1,5 @@ === tests/cases/compiler/breakTarget4.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/breakTarget5.errors.txt b/tests/baselines/reference/breakTarget5.errors.txt index a54a415b990..d92f29d67ee 100644 --- a/tests/baselines/reference/breakTarget5.errors.txt +++ b/tests/baselines/reference/breakTarget5.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/breakTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. +tests/cases/compiler/breakTarget5.ts(6,7): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/compiler/breakTarget5.ts (1 errors) ==== + target: while (true) { function f() { diff --git a/tests/baselines/reference/breakTarget5.js b/tests/baselines/reference/breakTarget5.js index 197e4e147bd..9f6b063a8c4 100644 --- a/tests/baselines/reference/breakTarget5.js +++ b/tests/baselines/reference/breakTarget5.js @@ -1,4 +1,5 @@ //// [breakTarget5.ts] + target: while (true) { function f() { diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index 0e78aac2b1b..73270c240cb 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -1,4 +1,5 @@ //// [callSignatureWithoutReturnTypeAnnotationInference.ts] + // Call signatures without a return type should infer one from the function body (if present) // Simple types diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols index 1c5a6786ab7..faba4e427ec 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.symbols @@ -1,55 +1,56 @@ === tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts === + // Call signatures without a return type should infer one from the function body (if present) // Simple types function foo(x) { >foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 3, 13)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 4, 13)) return 1; } var r = foo(1); ->r : Symbol(r, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 3)) +>r : Symbol(r, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 7, 3)) >foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0)) function foo2(x) { ->foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 15)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 8, 14)) +>foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 7, 15)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 9, 14)) return foo(x); >foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 0, 0)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 8, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 9, 14)) } var r2 = foo2(1); ->r2 : Symbol(r2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 3)) ->foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 6, 15)) +>r2 : Symbol(r2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 12, 3)) +>foo2 : Symbol(foo2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 7, 15)) function foo3() { ->foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17)) +>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 12, 17)) return foo3(); ->foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17)) +>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 12, 17)) } var r3 = foo3(); ->r3 : Symbol(r3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 3)) ->foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 11, 17)) +>r3 : Symbol(r3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 17, 3)) +>foo3 : Symbol(foo3, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 12, 17)) function foo4(x: T) { ->foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 16)) ->T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 14)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 17)) ->T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 14)) +>foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 17, 16)) +>T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 19, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 19, 17)) +>T : Symbol(T, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 19, 14)) return x; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 18, 17)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 19, 17)) } var r4 = foo4(1); ->r4 : Symbol(r4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 3)) ->foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 16, 16)) +>r4 : Symbol(r4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 22, 3)) +>foo4 : Symbol(foo4, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 17, 16)) function foo5(x) { ->foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 17)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 23, 14)) +>foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 22, 17)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 24, 14)) if (true) { return 1; @@ -58,17 +59,17 @@ function foo5(x) { } } var r5 = foo5(1); ->r5 : Symbol(r5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 3)) ->foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 21, 17)) +>r5 : Symbol(r5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 31, 3)) +>foo5 : Symbol(foo5, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 22, 17)) function foo6(x) { ->foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 17)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 32, 14)) +>foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 31, 17)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 33, 14)) try { } catch (e) { ->e : Symbol(e, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 35, 11)) +>e : Symbol(e, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 36, 11)) return []; } @@ -77,179 +78,179 @@ function foo6(x) { } } var r6 = foo6(1); ->r6 : Symbol(r6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 3)) ->foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 30, 17)) +>r6 : Symbol(r6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 43, 3)) +>foo6 : Symbol(foo6, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 31, 17)) function foo7(x) { ->foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 17)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 44, 14)) +>foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 43, 17)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 45, 14)) return typeof x; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 44, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 45, 14)) } var r7 = foo7(1); ->r7 : Symbol(r7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 3)) ->foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 42, 17)) +>r7 : Symbol(r7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 48, 3)) +>foo7 : Symbol(foo7, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 43, 17)) // object types function foo8(x: number) { ->foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 17)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 50, 14)) +>foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 48, 17)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 51, 14)) return { x: x }; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 51, 12)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 50, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 52, 12)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 51, 14)) } var r8 = foo8(1); ->r8 : Symbol(r8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 3)) ->foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 47, 17)) +>r8 : Symbol(r8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 54, 3)) +>foo8 : Symbol(foo8, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 48, 17)) interface I { ->I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 17)) +>I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 54, 17)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 55, 13)) +>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 56, 13)) } function foo9(x: number) { ->foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 57, 1)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 58, 14)) +>foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 58, 1)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 59, 14)) var i: I; ->i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 59, 7)) ->I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 53, 17)) +>i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 60, 7)) +>I : Symbol(I, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 54, 17)) return i; ->i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 59, 7)) +>i : Symbol(i, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 60, 7)) } var r9 = foo9(1); ->r9 : Symbol(r9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 3)) ->foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 57, 1)) +>r9 : Symbol(r9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 63, 3)) +>foo9 : Symbol(foo9, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 58, 1)) class C { ->C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 17)) +>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 63, 17)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 64, 9)) +>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 65, 9)) } function foo10(x: number) { ->foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 66, 1)) ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 67, 15)) +>foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 67, 1)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 68, 15)) var c: C; ->c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 68, 7)) ->C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 62, 17)) +>c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 69, 7)) +>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 63, 17)) return c; ->c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 68, 7)) +>c : Symbol(c, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 69, 7)) } var r10 = foo10(1); ->r10 : Symbol(r10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 3)) ->foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 66, 1)) +>r10 : Symbol(r10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 72, 3)) +>foo10 : Symbol(foo10, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 67, 1)) module M { ->M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 19)) +>M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 72, 19)) export var x = 1; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 74, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 75, 14)) export class C { foo: string } ->C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 74, 21)) ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 75, 20)) +>C : Symbol(C, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 75, 21)) +>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 20)) } function foo11() { ->foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 1)) +>foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 77, 1)) return M; ->M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 71, 19)) +>M : Symbol(M, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 72, 19)) } var r11 = foo11(); ->r11 : Symbol(r11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 3)) ->foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 76, 1)) +>r11 : Symbol(r11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 3)) +>foo11 : Symbol(foo11, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 77, 1)) // merged declarations interface I2 { ->I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1)) +>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 1)) x: number; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 83, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 84, 14)) } interface I2 { ->I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1)) +>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 1)) y: number; ->y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 14)) +>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 87, 14)) } function foo12() { ->foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 88, 1)) +>foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 89, 1)) var i2: I2; ->i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 90, 7)) ->I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 80, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 85, 1)) +>i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 91, 7)) +>I2 : Symbol(I2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 81, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 86, 1)) return i2; ->i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 90, 7)) +>i2 : Symbol(i2, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 91, 7)) } var r12 = foo12(); ->r12 : Symbol(r12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 3)) ->foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 88, 1)) +>r12 : Symbol(r12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 94, 3)) +>foo12 : Symbol(foo12, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 89, 1)) function m1() { return 1; } ->m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27)) +>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 94, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 27)) module m1 { export var y = 2; } ->m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27)) ->y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 22)) +>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 94, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 27)) +>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 97, 22)) function foo13() { ->foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 31)) +>foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 97, 31)) return m1; ->m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 93, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 95, 27)) +>m1 : Symbol(m1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 94, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 27)) } var r13 = foo13(); ->r13 : Symbol(r13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 3)) ->foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 96, 31)) +>r13 : Symbol(r13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 101, 3)) +>foo13 : Symbol(foo13, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 97, 31)) class c1 { ->c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1)) +>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 101, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 106, 1)) foo: string; ->foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 102, 10)) +>foo : Symbol(foo, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 103, 10)) constructor(x) { } ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 104, 16)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 16)) } module c1 { ->c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1)) +>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 101, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 106, 1)) export var x = 1; ->x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 107, 14)) +>x : Symbol(x, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 108, 14)) } function foo14() { ->foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 108, 1)) +>foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 109, 1)) return c1; ->c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 100, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 105, 1)) +>c1 : Symbol(c1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 101, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 106, 1)) } var r14 = foo14(); ->r14 : Symbol(r14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 3)) ->foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 108, 1)) +>r14 : Symbol(r14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 113, 3)) +>foo14 : Symbol(foo14, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 109, 1)) enum e1 { A } ->e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13)) ->A : Symbol(e1.A, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 9)) +>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 113, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 13)) +>A : Symbol(e1.A, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 9)) module e1 { export var y = 1; } ->e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13)) ->y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 22)) +>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 113, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 13)) +>y : Symbol(y, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 116, 22)) function foo15() { ->foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 31)) +>foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 116, 31)) return e1; ->e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 112, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 114, 13)) +>e1 : Symbol(e1, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 113, 18), Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 13)) } var r15 = foo15(); ->r15 : Symbol(r15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 119, 3)) ->foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 115, 31)) +>r15 : Symbol(r15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 120, 3)) +>foo15 : Symbol(foo15, Decl(callSignatureWithoutReturnTypeAnnotationInference.ts, 116, 31)) diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types index 760451eb9c1..689ac62c35b 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types @@ -1,4 +1,5 @@ === tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts === + // Call signatures without a return type should infer one from the function body (if present) // Simple types diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index ecdf54d6fd1..93aef628f8a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -75,9 +75,8 @@ function foo() { break l0; } - return 100; - () => b + return 100; } @@ -207,8 +206,8 @@ function foo() { if (b === 2) { return "break-l0"; } - return { value: 100 }; (function () { return b; }); + return { value: 100 }; }; for (var _d = 0, _e = []; _d < _e.length; _d++) { var b = _e[_d]; diff --git a/tests/baselines/reference/capturedLetConstInLoop9.symbols b/tests/baselines/reference/capturedLetConstInLoop9.symbols index 5ccc1c399f3..37d1764b41b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop9.symbols @@ -142,10 +142,10 @@ function foo() { break l0; } - return 100; - () => b >b : Symbol(b, Decl(capturedLetConstInLoop9.ts, 66, 16)) + + return 100; } @@ -171,25 +171,25 @@ function foo() { } function foo2() { ->foo2 : Symbol(foo2, Decl(capturedLetConstInLoop9.ts, 89, 1)) +>foo2 : Symbol(foo2, Decl(capturedLetConstInLoop9.ts, 88, 1)) for (let x of []) { ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 92, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 91, 12)) if (x === 1) { ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 92, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 91, 12)) break; } else if (x === 2) { ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 92, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 91, 12)) continue; } while (1 === 1) { if (x) { ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 92, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 91, 12)) break; } @@ -199,17 +199,17 @@ function foo2() { } switch(x) { ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 92, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 91, 12)) case 1: break; case 2: continue; } for (let y of []) { ->y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 114, 16)) +>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 113, 16)) switch(y) { ->y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 114, 16)) +>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 113, 16)) case 1: break; case 2: continue; @@ -219,50 +219,50 @@ function foo2() { } class C { ->C : Symbol(C, Decl(capturedLetConstInLoop9.ts, 121, 1)) +>C : Symbol(C, Decl(capturedLetConstInLoop9.ts, 120, 1)) constructor(private N: number) { } ->N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 124, 16)) +>N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop9.ts, 124, 38)) +>foo : Symbol(foo, Decl(capturedLetConstInLoop9.ts, 123, 38)) for (let i = 0; i < 100; i++) { ->i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 126, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 126, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 126, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) let f = () => this.N * i; ->f : Symbol(f, Decl(capturedLetConstInLoop9.ts, 127, 15)) ->this.N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 124, 16)) ->this : Symbol(C, Decl(capturedLetConstInLoop9.ts, 121, 1)) ->N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 124, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 126, 16)) +>f : Symbol(f, Decl(capturedLetConstInLoop9.ts, 126, 15)) +>this.N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) +>this : Symbol(C, Decl(capturedLetConstInLoop9.ts, 120, 1)) +>N : Symbol(N, Decl(capturedLetConstInLoop9.ts, 123, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9.ts, 125, 16)) } } } function foo3 () { ->foo3 : Symbol(foo3, Decl(capturedLetConstInLoop9.ts, 130, 1)) +>foo3 : Symbol(foo3, Decl(capturedLetConstInLoop9.ts, 129, 1)) let x = arguments.length; ->x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 133, 7)) +>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 132, 7)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) for (let y of []) { ->y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 134, 12)) +>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 133, 12)) let z = arguments.length; ->z : Symbol(z, Decl(capturedLetConstInLoop9.ts, 135, 11)) +>z : Symbol(z, Decl(capturedLetConstInLoop9.ts, 134, 11)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) (function() { return y + z + arguments.length; }); ->y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 134, 12)) ->z : Symbol(z, Decl(capturedLetConstInLoop9.ts, 135, 11)) +>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 133, 12)) +>z : Symbol(z, Decl(capturedLetConstInLoop9.ts, 134, 11)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/capturedLetConstInLoop9.types b/tests/baselines/reference/capturedLetConstInLoop9.types index 5a19361b02e..7f793ab6601 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.types +++ b/tests/baselines/reference/capturedLetConstInLoop9.types @@ -197,12 +197,12 @@ function foo() { >l0 : any } - return 100; ->100 : number - () => b >() => b : () => any >b : any + + return 100; +>100 : number } diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.js b/tests/baselines/reference/capturedLetConstInLoop9_ES6.js index 4605cada8a3..0c9d8ea6a68 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.js @@ -75,10 +75,8 @@ function foo() { if (b === 2) { break l0; } - - return 100; - () => b + return 100; } @@ -198,8 +196,8 @@ function foo() { if (b === 2) { break l0; } - return 100; (() => b); + return 100; } (() => a); } diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols index d1d124b85f7..d71a20afe47 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols @@ -142,11 +142,10 @@ function foo() { break l0; } - - return 100; - () => b >b : Symbol(b, Decl(capturedLetConstInLoop9_ES6.ts, 67, 16)) + + return 100; } @@ -172,25 +171,25 @@ function foo() { } function foo2() { ->foo2 : Symbol(foo2, Decl(capturedLetConstInLoop9_ES6.ts, 90, 1)) +>foo2 : Symbol(foo2, Decl(capturedLetConstInLoop9_ES6.ts, 88, 1)) for (let x of []) { ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 93, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 91, 12)) if (x === 1) { ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 93, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 91, 12)) break; } else if (x === 2) { ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 93, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 91, 12)) continue; } while (1 === 1) { if (x) { ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 93, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 91, 12)) break; } @@ -200,17 +199,17 @@ function foo2() { } switch(x) { ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 93, 12)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 91, 12)) case 1: break; case 2: continue; } for (let y of []) { ->y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 115, 16)) +>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 113, 16)) switch(y) { ->y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 115, 16)) +>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 113, 16)) case 1: break; case 2: continue; @@ -220,50 +219,50 @@ function foo2() { } class C { ->C : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 122, 1)) +>C : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 120, 1)) constructor(private N: number) { } ->N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) +>N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) foo() { ->foo : Symbol(foo, Decl(capturedLetConstInLoop9_ES6.ts, 125, 38)) +>foo : Symbol(foo, Decl(capturedLetConstInLoop9_ES6.ts, 123, 38)) for (let i = 0; i < 100; i++) { ->i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 127, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 127, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 127, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) let f = () => this.N * i; ->f : Symbol(f, Decl(capturedLetConstInLoop9_ES6.ts, 128, 15)) ->this.N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) ->this : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 122, 1)) ->N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) ->i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 127, 16)) +>f : Symbol(f, Decl(capturedLetConstInLoop9_ES6.ts, 126, 15)) +>this.N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) +>this : Symbol(C, Decl(capturedLetConstInLoop9_ES6.ts, 120, 1)) +>N : Symbol(N, Decl(capturedLetConstInLoop9_ES6.ts, 123, 16)) +>i : Symbol(i, Decl(capturedLetConstInLoop9_ES6.ts, 125, 16)) } } } function foo3 () { ->foo3 : Symbol(foo3, Decl(capturedLetConstInLoop9_ES6.ts, 131, 1)) +>foo3 : Symbol(foo3, Decl(capturedLetConstInLoop9_ES6.ts, 129, 1)) let x = arguments.length; ->x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 134, 7)) +>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 132, 7)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) for (let y of []) { ->y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 135, 12)) +>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) let z = arguments.length; ->z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 136, 11)) +>z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) (function() { return y + z + arguments.length; }); ->y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 135, 12)) ->z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 136, 11)) +>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) +>z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) >arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) >arguments : Symbol(arguments) >length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.types b/tests/baselines/reference/capturedLetConstInLoop9_ES6.types index e5afe21a29f..dfbfa387ed4 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.types +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.types @@ -197,13 +197,12 @@ function foo() { break l0; >l0 : any } - - return 100; ->100 : number - () => b >() => b : () => any >b : any + + return 100; +>100 : number } diff --git a/tests/baselines/reference/cf.errors.txt b/tests/baselines/reference/cf.errors.txt new file mode 100644 index 00000000000..75b285c37c6 --- /dev/null +++ b/tests/baselines/reference/cf.errors.txt @@ -0,0 +1,72 @@ +tests/cases/compiler/cf.ts(9,13): error TS7027: Unreachable code detected. +tests/cases/compiler/cf.ts(21,17): error TS7027: Unreachable code detected. +tests/cases/compiler/cf.ts(32,13): error TS7027: Unreachable code detected. +tests/cases/compiler/cf.ts(36,13): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/cf.ts (4 errors) ==== + function f() { + var z; + var x=10; + var y=3; + + L1: for (var i=0;i<19;i++) { + if (y==7) { + continue L1; + x=11; + ~ +!!! error TS7027: Unreachable code detected. + } + if (y==3) { + y++; + } + else { + y--; + } + do { + y+=2; + if (y==20) { + break; + x=12; + ~ +!!! error TS7027: Unreachable code detected. + } + } while (y<41); + y++; + } + while (y>2) { + y=y>>1; + } + L2: try { + L3: if (xf : Symbol(f, Decl(cf.ts, 0, 0)) - - var z; ->z : Symbol(z, Decl(cf.ts, 1, 7)) - - var x=10; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - - var y=3; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - L1: for (var i=0;i<19;i++) { ->i : Symbol(i, Decl(cf.ts, 5, 16)) ->i : Symbol(i, Decl(cf.ts, 5, 16)) ->i : Symbol(i, Decl(cf.ts, 5, 16)) - - if (y==7) { ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - continue L1; - x=11; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - if (y==3) { ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - y++; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - } - else { - y--; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - } - do { - y+=2; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - if (y==20) { ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - break; - x=12; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - } while (y<41); ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - y++; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - } - while (y>2) { ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - y=y>>1; ->y : Symbol(y, Decl(cf.ts, 3, 7)) ->y : Symbol(y, Decl(cf.ts, 3, 7)) - } - L2: try { - L3: if (xx : Symbol(x, Decl(cf.ts, 2, 7)) ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - break L2; - x=13; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - else { - break L3; - x=14; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - } - catch (e) { ->e : Symbol(e, Decl(cf.ts, 38, 11)) - - x++; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - finally { - x+=3; ->x : Symbol(x, Decl(cf.ts, 2, 7)) - } - y++; ->y : Symbol(y, Decl(cf.ts, 3, 7)) - - for (var k=0;k<10;k++) { ->k : Symbol(k, Decl(cf.ts, 45, 12)) ->k : Symbol(k, Decl(cf.ts, 45, 12)) ->k : Symbol(k, Decl(cf.ts, 45, 12)) - - z; ->z : Symbol(z, Decl(cf.ts, 1, 7)) - - break; - } - for (k=0;k<10;k++) { ->k : Symbol(k, Decl(cf.ts, 45, 12)) ->k : Symbol(k, Decl(cf.ts, 45, 12)) ->k : Symbol(k, Decl(cf.ts, 45, 12)) - - if (k==6) { ->k : Symbol(k, Decl(cf.ts, 45, 12)) - - continue; - } - break; - } -} - diff --git a/tests/baselines/reference/cf.types b/tests/baselines/reference/cf.types deleted file mode 100644 index 397e3469ece..00000000000 --- a/tests/baselines/reference/cf.types +++ /dev/null @@ -1,169 +0,0 @@ -=== tests/cases/compiler/cf.ts === -function f() { ->f : () => void - - var z; ->z : any - - var x=10; ->x : number ->10 : number - - var y=3; ->y : number ->3 : number - - L1: for (var i=0;i<19;i++) { ->L1 : any ->i : number ->0 : number ->i<19 : boolean ->i : number ->19 : number ->i++ : number ->i : number - - if (y==7) { ->y==7 : boolean ->y : number ->7 : number - - continue L1; ->L1 : any - - x=11; ->x=11 : number ->x : number ->11 : number - } - if (y==3) { ->y==3 : boolean ->y : number ->3 : number - - y++; ->y++ : number ->y : number - } - else { - y--; ->y-- : number ->y : number - } - do { - y+=2; ->y+=2 : number ->y : number ->2 : number - - if (y==20) { ->y==20 : boolean ->y : number ->20 : number - - break; - x=12; ->x=12 : number ->x : number ->12 : number - } - } while (y<41); ->y<41 : boolean ->y : number ->41 : number - - y++; ->y++ : number ->y : number - } - while (y>2) { ->y>2 : boolean ->y : number ->2 : number - - y=y>>1; ->y=y>>1 : number ->y : number ->y>>1 : number ->y : number ->1 : number - } - L2: try { ->L2 : any - - L3: if (xL3 : any ->xx : number ->y : number - - break L2; ->L2 : any - - x=13; ->x=13 : number ->x : number ->13 : number - } - else { - break L3; ->L3 : any - - x=14; ->x=14 : number ->x : number ->14 : number - } - } - catch (e) { ->e : any - - x++; ->x++ : number ->x : number - } - finally { - x+=3; ->x+=3 : number ->x : number ->3 : number - } - y++; ->y++ : number ->y : number - - for (var k=0;k<10;k++) { ->k : number ->0 : number ->k<10 : boolean ->k : number ->10 : number ->k++ : number ->k : number - - z; ->z : any - - break; - } - for (k=0;k<10;k++) { ->k=0 : number ->k : number ->0 : number ->k<10 : boolean ->k : number ->10 : number ->k++ : number ->k : number - - if (k==6) { ->k==6 : boolean ->k : number ->6 : number - - continue; - } - break; - } -} - diff --git a/tests/baselines/reference/commentEmitAtEndOfFile1.js b/tests/baselines/reference/commentEmitAtEndOfFile1.js index 1be031fa84a..cada7754002 100644 --- a/tests/baselines/reference/commentEmitAtEndOfFile1.js +++ b/tests/baselines/reference/commentEmitAtEndOfFile1.js @@ -1,4 +1,5 @@ //// [commentEmitAtEndOfFile1.ts] + // test var f = '' // test #2 diff --git a/tests/baselines/reference/commentEmitAtEndOfFile1.symbols b/tests/baselines/reference/commentEmitAtEndOfFile1.symbols index 1fc0ad09553..cb06d088307 100644 --- a/tests/baselines/reference/commentEmitAtEndOfFile1.symbols +++ b/tests/baselines/reference/commentEmitAtEndOfFile1.symbols @@ -1,17 +1,18 @@ === tests/cases/compiler/commentEmitAtEndOfFile1.ts === + // test var f = '' ->f : Symbol(f, Decl(commentEmitAtEndOfFile1.ts, 1, 3)) +>f : Symbol(f, Decl(commentEmitAtEndOfFile1.ts, 2, 3)) // test #2 module foo { ->foo : Symbol(foo, Decl(commentEmitAtEndOfFile1.ts, 1, 10)) +>foo : Symbol(foo, Decl(commentEmitAtEndOfFile1.ts, 2, 10)) function bar() { } ->bar : Symbol(bar, Decl(commentEmitAtEndOfFile1.ts, 3, 12)) +>bar : Symbol(bar, Decl(commentEmitAtEndOfFile1.ts, 4, 12)) } // test #3 module empty { ->empty : Symbol(empty, Decl(commentEmitAtEndOfFile1.ts, 5, 1)) +>empty : Symbol(empty, Decl(commentEmitAtEndOfFile1.ts, 6, 1)) } // test #4 diff --git a/tests/baselines/reference/commentEmitAtEndOfFile1.types b/tests/baselines/reference/commentEmitAtEndOfFile1.types index d88d7ffa5fc..f96a1069a06 100644 --- a/tests/baselines/reference/commentEmitAtEndOfFile1.types +++ b/tests/baselines/reference/commentEmitAtEndOfFile1.types @@ -1,4 +1,5 @@ === tests/cases/compiler/commentEmitAtEndOfFile1.ts === + // test var f = '' >f : string diff --git a/tests/baselines/reference/commentsAtEndOfFile1.js b/tests/baselines/reference/commentsAtEndOfFile1.js index 2d4dae39e6b..d93dded59b0 100644 --- a/tests/baselines/reference/commentsAtEndOfFile1.js +++ b/tests/baselines/reference/commentsAtEndOfFile1.js @@ -1,4 +1,5 @@ //// [commentsAtEndOfFile1.ts] + Input: ; //Testing two diff --git a/tests/baselines/reference/commentsAtEndOfFile1.symbols b/tests/baselines/reference/commentsAtEndOfFile1.symbols index c09a435f1a7..d35b4f251f6 100644 --- a/tests/baselines/reference/commentsAtEndOfFile1.symbols +++ b/tests/baselines/reference/commentsAtEndOfFile1.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/commentsAtEndOfFile1.ts === -Input: + +No type information for this code.Input: No type information for this code.; No type information for this code.//Testing two No type information for this code. diff --git a/tests/baselines/reference/commentsAtEndOfFile1.types b/tests/baselines/reference/commentsAtEndOfFile1.types index 6bac6757061..71eb367738b 100644 --- a/tests/baselines/reference/commentsAtEndOfFile1.types +++ b/tests/baselines/reference/commentsAtEndOfFile1.types @@ -1,4 +1,5 @@ === tests/cases/compiler/commentsAtEndOfFile1.ts === + Input: >Input : any diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt index 7b26fc4bf9e..392e1781dd5 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt @@ -1,80 +1,81 @@ -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(8,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(9,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(12,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(13,9): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(16,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(17,9): 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(23,5): 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(27,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.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/compoundAssignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.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/compoundAssignmentLHSIsValue.ts(35,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(38,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(39,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.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/compoundAssignmentLHSIsValue.ts(42,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(46,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.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/compoundAssignmentLHSIsValue.ts(48,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(49,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(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(58,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(52,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(53,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(54,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(55,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(56,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected. -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,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(60,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(63,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(64,1): error TS2364: Invalid left-hand side of assignment expression. 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(71,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(76,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(81,15): error TS1034: 'super' must be followed by an argument list or member access. 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(87,21): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected. -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(89,11): error TS1005: ';' expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(92,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(93,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(97,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(98,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(99,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(100,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(101,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(102,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(103,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(104,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(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(107,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(108,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(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(111,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(112,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(113,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(114,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(115,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(116,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(117,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(118,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(119,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(120,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(121,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(122,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(123,1): error TS2364: Invalid left-hand side of assignment expression. ==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (74 errors) ==== + // expected error for all the LHS of compound assignments (arithmetic and addition) var value; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index 833c1e1ea7c..bf66183b70a 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -1,4 +1,5 @@ //// [compoundAssignmentLHSIsValue.ts] + // expected error for all the LHS of compound assignments (arithmetic and addition) var value; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt index bee6f75ff5c..23720468bb7 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt @@ -13,6 +13,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(38,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(39,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.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/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(43,3): error TS7028: Unused label. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(43,10): error TS1128: Declaration or statement expected. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.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/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(52,15): error TS1034: 'super' must be followed by an argument list or member access. @@ -37,7 +38,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (37 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (38 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value; @@ -111,6 +112,8 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm // object literals { a: 0 } **= value; + ~ +!!! error TS7028: Unused label. ~~~ !!! error TS1128: Declaration or statement expected. diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt index 2fbf68b4437..e704126c055 100644 --- a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (2 errors) ==== @@ -10,10 +10,10 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,1 static [methodName]() { } get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. set [accessorName](v) { } static get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. static set [accessorName](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt index 3f18a8764b4..6b294981638 100644 --- a/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts (2 errors) ==== @@ -10,10 +10,10 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,1 static [methodName]() { } get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. set [accessorName](v) { } static get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. static set [accessorName](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index a31965dc69e..fd6f8e8bdc1 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. @@ -16,7 +16,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ @@ -26,7 +26,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt index b9009112347..4299437777d 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. @@ -16,7 +16,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ @@ -26,7 +26,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } diff --git a/tests/baselines/reference/conditionalExpressions2.js b/tests/baselines/reference/conditionalExpressions2.js index 6749a2c0ac0..8ac7df12cfa 100644 --- a/tests/baselines/reference/conditionalExpressions2.js +++ b/tests/baselines/reference/conditionalExpressions2.js @@ -1,4 +1,5 @@ //// [conditionalExpressions2.ts] + var a = false ? 1 : null; var b = false ? undefined : 0; var c = false ? 1 : 0; diff --git a/tests/baselines/reference/conditionalExpressions2.symbols b/tests/baselines/reference/conditionalExpressions2.symbols index 63c8b417477..e6edd635b40 100644 --- a/tests/baselines/reference/conditionalExpressions2.symbols +++ b/tests/baselines/reference/conditionalExpressions2.symbols @@ -1,33 +1,34 @@ === tests/cases/compiler/conditionalExpressions2.ts === + var a = false ? 1 : null; ->a : Symbol(a, Decl(conditionalExpressions2.ts, 0, 3)) +>a : Symbol(a, Decl(conditionalExpressions2.ts, 1, 3)) var b = false ? undefined : 0; ->b : Symbol(b, Decl(conditionalExpressions2.ts, 1, 3)) +>b : Symbol(b, Decl(conditionalExpressions2.ts, 2, 3)) >undefined : Symbol(undefined) var c = false ? 1 : 0; ->c : Symbol(c, Decl(conditionalExpressions2.ts, 2, 3)) +>c : Symbol(c, Decl(conditionalExpressions2.ts, 3, 3)) var d = false ? false : true; ->d : Symbol(d, Decl(conditionalExpressions2.ts, 3, 3)) +>d : Symbol(d, Decl(conditionalExpressions2.ts, 4, 3)) var e = false ? "foo" : "bar"; ->e : Symbol(e, Decl(conditionalExpressions2.ts, 4, 3)) +>e : Symbol(e, Decl(conditionalExpressions2.ts, 5, 3)) var f = false ? null : undefined; ->f : Symbol(f, Decl(conditionalExpressions2.ts, 5, 3)) +>f : Symbol(f, Decl(conditionalExpressions2.ts, 6, 3)) >undefined : Symbol(undefined) var g = true ? {g:5} : null; ->g : Symbol(g, Decl(conditionalExpressions2.ts, 6, 3)) ->g : Symbol(g, Decl(conditionalExpressions2.ts, 6, 16)) +>g : Symbol(g, Decl(conditionalExpressions2.ts, 7, 3)) +>g : Symbol(g, Decl(conditionalExpressions2.ts, 7, 16)) var h = [{h:5}, null]; ->h : Symbol(h, Decl(conditionalExpressions2.ts, 7, 3)) ->h : Symbol(h, Decl(conditionalExpressions2.ts, 7, 10)) +>h : Symbol(h, Decl(conditionalExpressions2.ts, 8, 3)) +>h : Symbol(h, Decl(conditionalExpressions2.ts, 8, 10)) function i() { if (true) { return { x: 5 }; } else { return null; } } ->i : Symbol(i, Decl(conditionalExpressions2.ts, 7, 22)) ->x : Symbol(x, Decl(conditionalExpressions2.ts, 8, 35)) +>i : Symbol(i, Decl(conditionalExpressions2.ts, 8, 22)) +>x : Symbol(x, Decl(conditionalExpressions2.ts, 9, 35)) diff --git a/tests/baselines/reference/conditionalExpressions2.types b/tests/baselines/reference/conditionalExpressions2.types index 5f49410b1e4..77714e664fb 100644 --- a/tests/baselines/reference/conditionalExpressions2.types +++ b/tests/baselines/reference/conditionalExpressions2.types @@ -1,4 +1,5 @@ === tests/cases/compiler/conditionalExpressions2.ts === + var a = false ? 1 : null; >a : number >false ? 1 : null : number diff --git a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt index 0b667108b5f..afae9d40431 100644 --- a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt +++ b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt @@ -1,8 +1,8 @@ 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(2,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. 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(3,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ==== tests/cases/compiler/conflictingTypeAnnotatedVar.ts (5 errors) ==== @@ -13,9 +13,9 @@ tests/cases/compiler/conflictingTypeAnnotatedVar.ts(3,17): error TS2355: A funct ~~~ !!! error TS2300: Duplicate identifier 'foo'. ~~~~~~ -!!! error TS2355: 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. function foo(): number { } ~~~ !!! error TS2300: Duplicate identifier 'foo'. ~~~~~~ -!!! 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 +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-scopes.errors.txt b/tests/baselines/reference/constDeclarations-scopes.errors.txt index 138acd9b16d..4c9f7ce5163 100644 --- a/tests/baselines/reference/constDeclarations-scopes.errors.txt +++ b/tests/baselines/reference/constDeclarations-scopes.errors.txt @@ -1,7 +1,9 @@ +tests/cases/compiler/constDeclarations-scopes.ts(13,5): error TS7027: Unreachable code detected. +tests/cases/compiler/constDeclarations-scopes.ts(22,1): error TS7027: Unreachable code detected. tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. -==== tests/cases/compiler/constDeclarations-scopes.ts (1 errors) ==== +==== tests/cases/compiler/constDeclarations-scopes.ts (3 errors) ==== // global const c = "string"; @@ -15,6 +17,8 @@ tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbol } else { const c = 0; + ~~~~~ +!!! error TS7027: Unreachable code detected. n = c; } @@ -24,6 +28,8 @@ tests/cases/compiler/constDeclarations-scopes.ts(28,7): error TS2410: All symbol } do { + ~~ +!!! error TS7027: Unreachable code detected. const c = 0; n = c; } while (true); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 12f397ff06c..b9804b1b6db 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,89 +1,90 @@ -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2304: Cannot find name 'module'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'. -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(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(24,28): error TS1005: ':' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,29): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: '=' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): 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(34,26): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'. -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(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'. -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(89,23): error TS2364: Invalid left-hand side of assignment expression. -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(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. -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(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(205,28): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'. -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,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,27): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected. -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(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,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,31): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(12,13): error TS2304: Cannot find name 'module'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(12,13): error TS2503: Cannot find namespace 'module'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(12,19): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(23,35): error TS1005: ')' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(23,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(25,28): error TS1005: ':' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(25,29): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,18): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,26): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(29,30): error TS1005: '=' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(32,18): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,17): 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(35,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,28): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(36,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(39,17): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,28): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,41): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,45): error TS1002: Unterminated string literal. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(42,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(48,17): error TS2304: Cannot find name 'console'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(50,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(54,13): error TS2304: Cannot find name 'console'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(59,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(70,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(73,37): error TS1127: Invalid character. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(82,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,23): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(91,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,29): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(107,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(109,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(139,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(142,32): error TS1005: '{' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(144,13): error TS1005: 'try' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,24): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,30): error TS1005: '(' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,31): error TS2304: Cannot find name 'Property'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(167,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(206,28): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(214,16): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(219,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(224,23): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(228,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,14): error TS1005: '{' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,16): error TS2304: Cannot find name 'method1'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,24): error TS2304: Cannot find name 'val'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,27): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,28): error TS2304: Cannot find name 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(236,36): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(239,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(239,16): error TS2304: Cannot find name 'method2'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(239,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(242,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(247,25): error TS2339: Property 'method1' does not exist on type 'B'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(255,9): error TS2390: Constructor implementation is missing. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(255,21): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(255,44): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(255,69): error TS1110: Type expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. -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,35): error TS2304: Cannot find name 'string'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected. -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,35): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'. -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(257,26): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,31): error TS1005: ',' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,9): error TS1128: Declaration or statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,27): error TS1135: Argument expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,33): error TS1005: '(' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,35): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,43): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,52): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,60): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(258,65): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,9): error TS2304: Cannot find name 'public'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,16): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,16): error TS2304: Cannot find name 'DefaultValue'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,29): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,35): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,37): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,55): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ==== + declare module "fs" { export class File { constructor(filename: string); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 5a61d4d5d7e..4765d1de283 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -1,4 +1,5 @@ //// [constructorWithIncompleteTypeAnnotation.ts] + declare module "fs" { export class File { constructor(filename: string); diff --git a/tests/baselines/reference/continueNotInIterationStatement4.errors.txt b/tests/baselines/reference/continueNotInIterationStatement4.errors.txt index 1c80f7057b8..dec899c7218 100644 --- a/tests/baselines/reference/continueNotInIterationStatement4.errors.txt +++ b/tests/baselines/reference/continueNotInIterationStatement4.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/continueNotInIterationStatement4.ts(4,5): error TS1107: Jump target cannot cross function boundary. +tests/cases/compiler/continueNotInIterationStatement4.ts(5,5): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/compiler/continueNotInIterationStatement4.ts (1 errors) ==== + TWO: while (true){ var x = () => { diff --git a/tests/baselines/reference/continueNotInIterationStatement4.js b/tests/baselines/reference/continueNotInIterationStatement4.js index f3f52ecb48c..50261be23b1 100644 --- a/tests/baselines/reference/continueNotInIterationStatement4.js +++ b/tests/baselines/reference/continueNotInIterationStatement4.js @@ -1,4 +1,5 @@ //// [continueNotInIterationStatement4.ts] + TWO: while (true){ var x = () => { diff --git a/tests/baselines/reference/continueTarget3.js b/tests/baselines/reference/continueTarget3.js index 052b7b593c3..70c2d2590e5 100644 --- a/tests/baselines/reference/continueTarget3.js +++ b/tests/baselines/reference/continueTarget3.js @@ -1,4 +1,5 @@ //// [continueTarget3.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/continueTarget3.symbols b/tests/baselines/reference/continueTarget3.symbols index a1b930f2f5a..a5decfe16d1 100644 --- a/tests/baselines/reference/continueTarget3.symbols +++ b/tests/baselines/reference/continueTarget3.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/continueTarget3.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. continue target1; diff --git a/tests/baselines/reference/continueTarget3.types b/tests/baselines/reference/continueTarget3.types index 3336b47772c..d55f1c3f6d2 100644 --- a/tests/baselines/reference/continueTarget3.types +++ b/tests/baselines/reference/continueTarget3.types @@ -1,4 +1,5 @@ === tests/cases/compiler/continueTarget3.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/continueTarget4.js b/tests/baselines/reference/continueTarget4.js index 0f6211f9202..23c20a03260 100644 --- a/tests/baselines/reference/continueTarget4.js +++ b/tests/baselines/reference/continueTarget4.js @@ -1,4 +1,5 @@ //// [continueTarget4.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/continueTarget4.symbols b/tests/baselines/reference/continueTarget4.symbols index ea1989a3e4d..fc69a881a60 100644 --- a/tests/baselines/reference/continueTarget4.symbols +++ b/tests/baselines/reference/continueTarget4.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/continueTarget4.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. continue target2; diff --git a/tests/baselines/reference/continueTarget4.types b/tests/baselines/reference/continueTarget4.types index 5d2b7c29bbe..e3e3ae82dfe 100644 --- a/tests/baselines/reference/continueTarget4.types +++ b/tests/baselines/reference/continueTarget4.types @@ -1,4 +1,5 @@ === tests/cases/compiler/continueTarget4.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/continueTarget5.errors.txt b/tests/baselines/reference/continueTarget5.errors.txt index 401c5874ee0..854f57017b6 100644 --- a/tests/baselines/reference/continueTarget5.errors.txt +++ b/tests/baselines/reference/continueTarget5.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/continueTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. +tests/cases/compiler/continueTarget5.ts(6,7): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/compiler/continueTarget5.ts (1 errors) ==== + target: while (true) { function f() { diff --git a/tests/baselines/reference/continueTarget5.js b/tests/baselines/reference/continueTarget5.js index 5bf309d2690..030a1c2589c 100644 --- a/tests/baselines/reference/continueTarget5.js +++ b/tests/baselines/reference/continueTarget5.js @@ -1,4 +1,5 @@ //// [continueTarget5.ts] + target: while (true) { function f() { diff --git a/tests/baselines/reference/declarationEmitDetachedComment1.js b/tests/baselines/reference/declarationEmitDetachedComment1.js new file mode 100644 index 00000000000..38c7e60406d --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment1.js @@ -0,0 +1,85 @@ +//// [tests/cases/compiler/declarationEmitDetachedComment1.ts] //// + +//// [test1.ts] + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { + +} + +//// [test2.ts] +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { + +} + +//// [test3.ts] +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { + +} + + +//// [test1.js] +/*! Copyright 2015 MyCompany Inc. */ +/** + * Hello class + */ +var Hello = (function () { + function Hello() { + } + return Hello; +})(); +//// [test2.js] +/* A comment at the top of the file. */ +/** + * Hi class + */ +var Hi = (function () { + function Hi() { + } + return Hi; +})(); +//// [test3.js] +// A one-line comment at the top of the file. +/** + * Hola class + */ +var Hola = (function () { + function Hola() { + } + return Hola; +})(); + + +//// [test1.d.ts] +/*! Copyright 2015 MyCompany Inc. */ +/** + * Hello class + */ +declare class Hello { +} +//// [test2.d.ts] +/** + * Hi class + */ +declare class Hi { +} +//// [test3.d.ts] +/** + * Hola class + */ +declare class Hola { +} diff --git a/tests/baselines/reference/declarationEmitDetachedComment1.symbols b/tests/baselines/reference/declarationEmitDetachedComment1.symbols new file mode 100644 index 00000000000..c466716ca44 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment1.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/test1.ts === + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { +>Hello : Symbol(Hello, Decl(test1.ts, 0, 0)) + +} + +=== tests/cases/compiler/test2.ts === +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { +>Hi : Symbol(Hi, Decl(test2.ts, 0, 0)) + +} + +=== tests/cases/compiler/test3.ts === +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { +>Hola : Symbol(Hola, Decl(test3.ts, 0, 0)) + +} + diff --git a/tests/baselines/reference/declarationEmitDetachedComment1.types b/tests/baselines/reference/declarationEmitDetachedComment1.types new file mode 100644 index 00000000000..6d1a87b5151 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment1.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/test1.ts === + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { +>Hello : Hello + +} + +=== tests/cases/compiler/test2.ts === +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { +>Hi : Hi + +} + +=== tests/cases/compiler/test3.ts === +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { +>Hola : Hola + +} + diff --git a/tests/baselines/reference/declarationEmitDetachedComment2.js b/tests/baselines/reference/declarationEmitDetachedComment2.js new file mode 100644 index 00000000000..d4d176da12c --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment2.js @@ -0,0 +1,65 @@ +//// [tests/cases/compiler/declarationEmitDetachedComment2.ts] //// + +//// [test1.ts] + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { + +} + +//// [test2.ts] +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { + +} + +//// [test3.ts] +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { + +} + + +//// [test1.js] +/*! Copyright 2015 MyCompany Inc. */ +var Hello = (function () { + function Hello() { + } + return Hello; +})(); +//// [test2.js] +var Hi = (function () { + function Hi() { + } + return Hi; +})(); +//// [test3.js] +var Hola = (function () { + function Hola() { + } + return Hola; +})(); + + +//// [test1.d.ts] +/*! Copyright 2015 MyCompany Inc. */ +declare class Hello { +} +//// [test2.d.ts] +declare class Hi { +} +//// [test3.d.ts] +declare class Hola { +} diff --git a/tests/baselines/reference/declarationEmitDetachedComment2.symbols b/tests/baselines/reference/declarationEmitDetachedComment2.symbols new file mode 100644 index 00000000000..c466716ca44 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment2.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/test1.ts === + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { +>Hello : Symbol(Hello, Decl(test1.ts, 0, 0)) + +} + +=== tests/cases/compiler/test2.ts === +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { +>Hi : Symbol(Hi, Decl(test2.ts, 0, 0)) + +} + +=== tests/cases/compiler/test3.ts === +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { +>Hola : Symbol(Hola, Decl(test3.ts, 0, 0)) + +} + diff --git a/tests/baselines/reference/declarationEmitDetachedComment2.types b/tests/baselines/reference/declarationEmitDetachedComment2.types new file mode 100644 index 00000000000..6d1a87b5151 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDetachedComment2.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/test1.ts === + +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { +>Hello : Hello + +} + +=== tests/cases/compiler/test2.ts === +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { +>Hi : Hi + +} + +=== tests/cases/compiler/test3.ts === +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { +>Hola : Hola + +} + diff --git a/tests/baselines/reference/declarationFiles.errors.txt b/tests/baselines/reference/declarationFiles.errors.txt index c55cac9000b..bbd65b6d658 100644 --- a/tests/baselines/reference/declarationFiles.errors.txt +++ b/tests/baselines/reference/declarationFiles.errors.txt @@ -1,15 +1,18 @@ +tests/cases/conformance/types/thisType/declarationFiles.ts(5,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface. tests/cases/conformance/types/thisType/declarationFiles.ts(31,5): error TS2527: The inferred type of 'x1' references an inaccessible 'this' type. A type annotation is necessary. tests/cases/conformance/types/thisType/declarationFiles.ts(33,5): error TS2527: The inferred type of 'x3' references an inaccessible 'this' type. A type annotation is necessary. tests/cases/conformance/types/thisType/declarationFiles.ts(35,5): error TS2527: The inferred type of 'f1' references an inaccessible 'this' type. A type annotation is necessary. tests/cases/conformance/types/thisType/declarationFiles.ts(41,5): error TS2527: The inferred type of 'f3' references an inaccessible 'this' type. A type annotation is necessary. -==== tests/cases/conformance/types/thisType/declarationFiles.ts (4 errors) ==== +==== tests/cases/conformance/types/thisType/declarationFiles.ts (5 errors) ==== class C1 { x: this; f(x: this): this { return undefined; } constructor(x: this) { } + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. } class C2 { diff --git a/tests/baselines/reference/doWhileBreakStatements.js b/tests/baselines/reference/doWhileBreakStatements.js index a2bc0d3c549..8e272ceed0a 100644 --- a/tests/baselines/reference/doWhileBreakStatements.js +++ b/tests/baselines/reference/doWhileBreakStatements.js @@ -1,4 +1,5 @@ //// [doWhileBreakStatements.ts] + do { break; } while(true) diff --git a/tests/baselines/reference/doWhileBreakStatements.symbols b/tests/baselines/reference/doWhileBreakStatements.symbols index 7d9db9a5ebb..14db540598d 100644 --- a/tests/baselines/reference/doWhileBreakStatements.symbols +++ b/tests/baselines/reference/doWhileBreakStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts === + do { break; } while(true) @@ -34,7 +35,7 @@ do do do break SEVEN; while (true) while (true) while (true) EIGHT: do{ var fn = function () { } ->fn : Symbol(fn, Decl(doWhileBreakStatements.ts, 34, 7)) +>fn : Symbol(fn, Decl(doWhileBreakStatements.ts, 35, 7)) break EIGHT; }while(true) diff --git a/tests/baselines/reference/doWhileBreakStatements.types b/tests/baselines/reference/doWhileBreakStatements.types index c3ca932910a..f143cb17d08 100644 --- a/tests/baselines/reference/doWhileBreakStatements.types +++ b/tests/baselines/reference/doWhileBreakStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts === + do { break; } while(true) diff --git a/tests/baselines/reference/doWhileContinueStatements.js b/tests/baselines/reference/doWhileContinueStatements.js index 7f73157fd99..51bac3c4e09 100644 --- a/tests/baselines/reference/doWhileContinueStatements.js +++ b/tests/baselines/reference/doWhileContinueStatements.js @@ -1,4 +1,5 @@ //// [doWhileContinueStatements.ts] + do { continue; } while(true) diff --git a/tests/baselines/reference/doWhileContinueStatements.symbols b/tests/baselines/reference/doWhileContinueStatements.symbols index e4c6d577d5a..36ca2dde764 100644 --- a/tests/baselines/reference/doWhileContinueStatements.symbols +++ b/tests/baselines/reference/doWhileContinueStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts === + do { continue; } while(true) @@ -34,7 +35,7 @@ do do do continue SEVEN; while (true) while (true) while (true) EIGHT: do{ var fn = function () { } ->fn : Symbol(fn, Decl(doWhileContinueStatements.ts, 34, 7)) +>fn : Symbol(fn, Decl(doWhileContinueStatements.ts, 35, 7)) continue EIGHT; }while(true) diff --git a/tests/baselines/reference/doWhileContinueStatements.types b/tests/baselines/reference/doWhileContinueStatements.types index 90c9f59842a..e4d3191d040 100644 --- a/tests/baselines/reference/doWhileContinueStatements.types +++ b/tests/baselines/reference/doWhileContinueStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts === + do { continue; } while(true) diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt index 905d1a607e8..a6ada633016 100644 --- a/tests/baselines/reference/downlevelLetConst16.errors.txt +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -1,12 +1,13 @@ -tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. -tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. -tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type. -tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature. -tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array type. -tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature. +tests/cases/compiler/downlevelLetConst16.ts(152,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/downlevelLetConst16.ts(165,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/downlevelLetConst16.ts(196,14): error TS2461: Type 'undefined' is not an array type. +tests/cases/compiler/downlevelLetConst16.ts(203,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature. +tests/cases/compiler/downlevelLetConst16.ts(217,16): error TS2461: Type 'undefined' is not an array type. +tests/cases/compiler/downlevelLetConst16.ts(224,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature. ==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ==== + 'use strict' declare function use(a: any); diff --git a/tests/baselines/reference/downlevelLetConst16.js b/tests/baselines/reference/downlevelLetConst16.js index 874fc121191..d6f05f7584a 100644 --- a/tests/baselines/reference/downlevelLetConst16.js +++ b/tests/baselines/reference/downlevelLetConst16.js @@ -1,4 +1,5 @@ //// [downlevelLetConst16.ts] + 'use strict' declare function use(a: any); diff --git a/tests/baselines/reference/downlevelLetConst18.errors.txt b/tests/baselines/reference/downlevelLetConst18.errors.txt deleted file mode 100644 index 066c75abeb1..00000000000 --- a/tests/baselines/reference/downlevelLetConst18.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -tests/cases/compiler/downlevelLetConst18.ts(4,14): error TS2393: Duplicate function implementation. -tests/cases/compiler/downlevelLetConst18.ts(8,14): error TS2393: Duplicate function implementation. - - -==== tests/cases/compiler/downlevelLetConst18.ts (2 errors) ==== - 'use strict' - - for (let x; ;) { - function foo() { x }; - ~~~ -!!! error TS2393: Duplicate function implementation. - } - - for (let x; ;) { - function foo() { x }; - ~~~ -!!! error TS2393: Duplicate function implementation. - } - - for (let x; ;) { - (() => { x })(); - } - - for (const x = 1; ;) { - (() => { x })(); - } - - for (let x; ;) { - ({ foo() { x }}) - } - - for (let x; ;) { - ({ get foo() { return x } }) - } - - for (let x; ;) { - ({ set foo(v) { x } }) - } - \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst18.js b/tests/baselines/reference/downlevelLetConst18.js index 59bd316f8a3..cc11c1eef3a 100644 --- a/tests/baselines/reference/downlevelLetConst18.js +++ b/tests/baselines/reference/downlevelLetConst18.js @@ -1,4 +1,5 @@ //// [downlevelLetConst18.ts] + 'use strict' for (let x; ;) { @@ -6,7 +7,7 @@ for (let x; ;) { } for (let x; ;) { - function foo() { x }; + function foo1() { x }; } for (let x; ;) { @@ -40,7 +41,7 @@ for (var x = void 0;;) { _loop_1(x); } var _loop_2 = function(x) { - function foo() { x; } + function foo1() { x; } ; }; for (var x = void 0;;) { diff --git a/tests/baselines/reference/downlevelLetConst18.symbols b/tests/baselines/reference/downlevelLetConst18.symbols new file mode 100644 index 00000000000..a1df0dc6ae9 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.symbols @@ -0,0 +1,59 @@ +=== tests/cases/compiler/downlevelLetConst18.ts === + +'use strict' + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) + + function foo() { x }; +>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 3, 16)) +>x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) +} + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) + + function foo1() { x }; +>foo1 : Symbol(foo1, Decl(downlevelLetConst18.ts, 7, 16)) +>x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) +} + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) + + (() => { x })(); +>x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) +} + +for (const x = 1; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) + + (() => { x })(); +>x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) +} + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) + + ({ foo() { x }}) +>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 20, 6)) +>x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) +} + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) + + ({ get foo() { return x } }) +>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 24, 6)) +>x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) +} + +for (let x; ;) { +>x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) + + ({ set foo(v) { x } }) +>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 28, 6)) +>v : Symbol(v, Decl(downlevelLetConst18.ts, 28, 15)) +>x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) +} + diff --git a/tests/baselines/reference/downlevelLetConst18.types b/tests/baselines/reference/downlevelLetConst18.types new file mode 100644 index 00000000000..42421aa80c0 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.types @@ -0,0 +1,73 @@ +=== tests/cases/compiler/downlevelLetConst18.ts === + +'use strict' +>'use strict' : string + +for (let x; ;) { +>x : any + + function foo() { x }; +>foo : () => void +>x : any +} + +for (let x; ;) { +>x : any + + function foo1() { x }; +>foo1 : () => void +>x : any +} + +for (let x; ;) { +>x : any + + (() => { x })(); +>(() => { x })() : void +>(() => { x }) : () => void +>() => { x } : () => void +>x : any +} + +for (const x = 1; ;) { +>x : number +>1 : number + + (() => { x })(); +>(() => { x })() : void +>(() => { x }) : () => void +>() => { x } : () => void +>x : number +} + +for (let x; ;) { +>x : any + + ({ foo() { x }}) +>({ foo() { x }}) : { foo(): void; } +>{ foo() { x }} : { foo(): void; } +>foo : () => void +>x : any +} + +for (let x; ;) { +>x : any + + ({ get foo() { return x } }) +>({ get foo() { return x } }) : { foo: any; } +>{ get foo() { return x } } : { foo: any; } +>foo : any +>x : any +} + +for (let x; ;) { +>x : any + + ({ set foo(v) { x } }) +>({ set foo(v) { x } }) : { foo: any; } +>{ set foo(v) { x } } : { foo: any; } +>foo : any +>v : any +>x : any +} + diff --git a/tests/baselines/reference/duplicateLabel1.errors.txt b/tests/baselines/reference/duplicateLabel1.errors.txt index b34f1f771e0..cf116f656fc 100644 --- a/tests/baselines/reference/duplicateLabel1.errors.txt +++ b/tests/baselines/reference/duplicateLabel1.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target' +tests/cases/compiler/duplicateLabel1.ts(3,1): error TS1114: Duplicate label 'target' ==== tests/cases/compiler/duplicateLabel1.ts (1 errors) ==== + target: target: ~~~~~~ diff --git a/tests/baselines/reference/duplicateLabel1.js b/tests/baselines/reference/duplicateLabel1.js index e7976895c94..5251cec3e36 100644 --- a/tests/baselines/reference/duplicateLabel1.js +++ b/tests/baselines/reference/duplicateLabel1.js @@ -1,4 +1,5 @@ //// [duplicateLabel1.ts] + target: target: while (true) { diff --git a/tests/baselines/reference/duplicateLabel2.errors.txt b/tests/baselines/reference/duplicateLabel2.errors.txt index 307596cf4e8..2a87ed96648 100644 --- a/tests/baselines/reference/duplicateLabel2.errors.txt +++ b/tests/baselines/reference/duplicateLabel2.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target' +tests/cases/compiler/duplicateLabel2.ts(4,3): error TS1114: Duplicate label 'target' ==== tests/cases/compiler/duplicateLabel2.ts (1 errors) ==== + target: while (true) { target: diff --git a/tests/baselines/reference/duplicateLabel2.js b/tests/baselines/reference/duplicateLabel2.js index 9ee9671d59d..40a5ee4595e 100644 --- a/tests/baselines/reference/duplicateLabel2.js +++ b/tests/baselines/reference/duplicateLabel2.js @@ -1,4 +1,5 @@ //// [duplicateLabel2.ts] + target: while (true) { target: diff --git a/tests/baselines/reference/duplicateLabel3.js b/tests/baselines/reference/duplicateLabel3.js index 37e9619e8f6..a1d33e46fc1 100644 --- a/tests/baselines/reference/duplicateLabel3.js +++ b/tests/baselines/reference/duplicateLabel3.js @@ -1,4 +1,5 @@ //// [duplicateLabel3.ts] + target: while (true) { function f() { diff --git a/tests/baselines/reference/duplicateLabel3.symbols b/tests/baselines/reference/duplicateLabel3.symbols index 07d0ded2923..89f2d5ee48a 100644 --- a/tests/baselines/reference/duplicateLabel3.symbols +++ b/tests/baselines/reference/duplicateLabel3.symbols @@ -1,8 +1,9 @@ === tests/cases/compiler/duplicateLabel3.ts === + target: while (true) { function f() { ->f : Symbol(f, Decl(duplicateLabel3.ts, 1, 14)) +>f : Symbol(f, Decl(duplicateLabel3.ts, 2, 14)) target: while (true) { diff --git a/tests/baselines/reference/duplicateLabel3.types b/tests/baselines/reference/duplicateLabel3.types index 8d75b08c768..920a077aa9e 100644 --- a/tests/baselines/reference/duplicateLabel3.types +++ b/tests/baselines/reference/duplicateLabel3.types @@ -1,4 +1,5 @@ === tests/cases/compiler/duplicateLabel3.ts === + target: >target : any diff --git a/tests/baselines/reference/duplicateLabel4.js b/tests/baselines/reference/duplicateLabel4.js index 22d072d38d7..d5b81b1e5bb 100644 --- a/tests/baselines/reference/duplicateLabel4.js +++ b/tests/baselines/reference/duplicateLabel4.js @@ -1,4 +1,5 @@ //// [duplicateLabel4.ts] + target: while (true) { } diff --git a/tests/baselines/reference/duplicateLabel4.symbols b/tests/baselines/reference/duplicateLabel4.symbols index c671abcef35..5660782e2ec 100644 --- a/tests/baselines/reference/duplicateLabel4.symbols +++ b/tests/baselines/reference/duplicateLabel4.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/duplicateLabel4.ts === -target: + +No type information for this code.target: No type information for this code.while (true) { No type information for this code.} No type information for this code. diff --git a/tests/baselines/reference/duplicateLabel4.types b/tests/baselines/reference/duplicateLabel4.types index 9238986b582..a10a06fe7a2 100644 --- a/tests/baselines/reference/duplicateLabel4.types +++ b/tests/baselines/reference/duplicateLabel4.types @@ -1,4 +1,5 @@ === tests/cases/compiler/duplicateLabel4.ts === + target: >target : any diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index e4217d4d411..bd6d535d88e 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,7 +1,19 @@ -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(2,4): error TS1005: ';' expected. +tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected. +tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'. +tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/duplicateLocalVariable1.ts(187,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) ==== +==== tests/cases/compiler/duplicateLocalVariable1.ts (5 errors) ==== + + / /@module: commonjs + ~ +!!! error TS1005: ';' expected. + +!!! error TS1146: Declaration expected. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'commonjs'. //import FileManager = require('filemanager'); //import App = require('app'); @@ -12,6 +24,8 @@ tests/cases/compiler/duplicateLocalVariable1.ts(185,22): error TS2403: Subsequen var TestFileDir = ".\\TempTestFiles"; export class TestCase { + ~~~~~~~~ +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } } diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index 62e291f28c0..ecde1ff2407 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -1,5 +1,7 @@ //// [duplicateLocalVariable1.ts] +/ /@module: commonjs + //import FileManager = require('filemanager'); //import App = require('app'); @@ -344,8 +346,8 @@ export var tests: TestRunner = (function () { })(); //// [duplicateLocalVariable1.js] -//import FileManager = require('filemanager'); -//import App = require('app'); +/ /; +commonjs; var TestFileDir = ".\\TempTestFiles"; var TestCase = (function () { function TestCase(name, test, errorMessageRegEx) { diff --git a/tests/baselines/reference/duplicateVariablesByScope.js b/tests/baselines/reference/duplicateVariablesByScope.js index d87fd966f32..43b6e89d412 100644 --- a/tests/baselines/reference/duplicateVariablesByScope.js +++ b/tests/baselines/reference/duplicateVariablesByScope.js @@ -1,4 +1,5 @@ //// [duplicateVariablesByScope.ts] + // duplicate local variables are only reported at global scope module M { diff --git a/tests/baselines/reference/duplicateVariablesByScope.symbols b/tests/baselines/reference/duplicateVariablesByScope.symbols index bc94dc9b807..9dd280d2756 100644 --- a/tests/baselines/reference/duplicateVariablesByScope.symbols +++ b/tests/baselines/reference/duplicateVariablesByScope.symbols @@ -1,56 +1,57 @@ === tests/cases/compiler/duplicateVariablesByScope.ts === + // duplicate local variables are only reported at global scope module M { >M : Symbol(M, Decl(duplicateVariablesByScope.ts, 0, 0)) for (var j = 0; j < 10; j++) { ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) } for (var j = 0; j < 10; j++) { ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) ->j : Symbol(j, Decl(duplicateVariablesByScope.ts, 3, 12), Decl(duplicateVariablesByScope.ts, 6, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) +>j : Symbol(j, Decl(duplicateVariablesByScope.ts, 4, 12), Decl(duplicateVariablesByScope.ts, 7, 12)) } } function foo() { ->foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 8, 1)) +>foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 9, 1)) var x = 2; ->x : Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7)) +>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 12, 7), Decl(duplicateVariablesByScope.ts, 13, 7)) var x = 1; ->x : Symbol(x, Decl(duplicateVariablesByScope.ts, 11, 7), Decl(duplicateVariablesByScope.ts, 12, 7)) +>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 12, 7), Decl(duplicateVariablesByScope.ts, 13, 7)) if (true) { var result = 1; ->result : Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11)) +>result : Symbol(result, Decl(duplicateVariablesByScope.ts, 15, 11), Decl(duplicateVariablesByScope.ts, 18, 11)) } else { var result = 2; ->result : Symbol(result, Decl(duplicateVariablesByScope.ts, 14, 11), Decl(duplicateVariablesByScope.ts, 17, 11)) +>result : Symbol(result, Decl(duplicateVariablesByScope.ts, 15, 11), Decl(duplicateVariablesByScope.ts, 18, 11)) } } class C { ->C : Symbol(C, Decl(duplicateVariablesByScope.ts, 19, 1)) +>C : Symbol(C, Decl(duplicateVariablesByScope.ts, 20, 1)) foo() { ->foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 21, 9)) +>foo : Symbol(foo, Decl(duplicateVariablesByScope.ts, 22, 9)) try { var x = 1; ->x : Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15)) +>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 25, 15), Decl(duplicateVariablesByScope.ts, 28, 15)) } catch (e) { ->e : Symbol(e, Decl(duplicateVariablesByScope.ts, 26, 15)) +>e : Symbol(e, Decl(duplicateVariablesByScope.ts, 27, 15)) var x = 2; ->x : Symbol(x, Decl(duplicateVariablesByScope.ts, 24, 15), Decl(duplicateVariablesByScope.ts, 27, 15)) +>x : Symbol(x, Decl(duplicateVariablesByScope.ts, 25, 15), Decl(duplicateVariablesByScope.ts, 28, 15)) } } } diff --git a/tests/baselines/reference/duplicateVariablesByScope.types b/tests/baselines/reference/duplicateVariablesByScope.types index 42d8cae2a3c..30e68d921ca 100644 --- a/tests/baselines/reference/duplicateVariablesByScope.types +++ b/tests/baselines/reference/duplicateVariablesByScope.types @@ -1,4 +1,5 @@ === tests/cases/compiler/duplicateVariablesByScope.ts === + // duplicate local variables are only reported at global scope module M { diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js index 11c4f4e1807..52207ceda96 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js @@ -80,22 +80,22 @@ })(); (function () { var ns = []; - for (var _i = 0; _i < ns.length; _i++) { - var _a = ns[_i]; + for (var _i = 0, ns_1 = ns; _i < ns_1.length; _i++) { + var _a = ns_1[_i]; } - for (var _b = 0; _b < ns.length; _b++) { - var _c = ns[_b]; + for (var _b = 0, ns_2 = ns; _b < ns_2.length; _b++) { + var _c = ns_2[_b]; } - for (var _d = 0; _d < ns.length; _d++) { - var _e = ns[_d]; + for (var _d = 0, ns_3 = ns; _d < ns_3.length; _d++) { + var _e = ns_3[_d]; } - for (var _f = 0; _f < ns.length; _f++) { - var _g = ns[_f]; + for (var _f = 0, ns_4 = ns; _f < ns_4.length; _f++) { + var _g = ns_4[_f]; } - for (var _h = 0; _h < ns.length; _h++) { - var _j = ns[_h]; + for (var _h = 0, ns_5 = ns; _h < ns_5.length; _h++) { + var _j = ns_5[_h]; } - for (var _k = 0; _k < ns.length; _k++) { - var _l = ns[_k]; + for (var _k = 0, ns_6 = ns; _k < ns_6.length; _k++) { + var _l = ns_6[_k]; } })(); diff --git a/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt b/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt index 5b66a377307..403e79b8742 100644 --- a/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt +++ b/tests/baselines/reference/errorOnContextuallyTypedReturnType.errors.txt @@ -1,6 +1,6 @@ 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,37): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ==== tests/cases/compiler/errorOnContextuallyTypedReturnType.ts (2 errors) ==== @@ -10,5 +10,5 @@ tests/cases/compiler/errorOnContextuallyTypedReturnType.ts(2,37): error TS2355: !!! error TS2322: Type 'void' is not assignable to type 'boolean'. var n2: () => boolean = function ():boolean { }; // expect an error here ~~~~~~~ -!!! error TS2355: 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. \ No newline at end of file diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index 62c96f6260d..9f15af96be8 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -1,4 +1,5 @@ //// [es6ClassSuperCodegenBug.ts] + class A { constructor(str1:string, str2:string) {} } diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.symbols b/tests/baselines/reference/es6ClassSuperCodegenBug.symbols index d520ec3ceb1..bb500a1d2c2 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.symbols +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.symbols @@ -1,13 +1,14 @@ === tests/cases/compiler/es6ClassSuperCodegenBug.ts === + class A { >A : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0)) constructor(str1:string, str2:string) {} ->str1 : Symbol(str1, Decl(es6ClassSuperCodegenBug.ts, 1, 13)) ->str2 : Symbol(str2, Decl(es6ClassSuperCodegenBug.ts, 1, 25)) +>str1 : Symbol(str1, Decl(es6ClassSuperCodegenBug.ts, 2, 13)) +>str2 : Symbol(str2, Decl(es6ClassSuperCodegenBug.ts, 2, 25)) } class B extends A { ->B : Symbol(B, Decl(es6ClassSuperCodegenBug.ts, 2, 1)) +>B : Symbol(B, Decl(es6ClassSuperCodegenBug.ts, 3, 1)) >A : Symbol(A, Decl(es6ClassSuperCodegenBug.ts, 0, 0)) constructor() { diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.types b/tests/baselines/reference/es6ClassSuperCodegenBug.types index bdf8ebde8f2..65269c99997 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.types +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.types @@ -1,4 +1,5 @@ === tests/cases/compiler/es6ClassSuperCodegenBug.ts === + class A { >A : A diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index 5ab7dcc5a5a..64eaaa5784f 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -1,4 +1,5 @@ //// [escapedIdentifiers.ts] + /* 0 .. \u0030 9 .. \u0039 diff --git a/tests/baselines/reference/escapedIdentifiers.symbols b/tests/baselines/reference/escapedIdentifiers.symbols index 6c84b25647f..a99e067b898 100644 --- a/tests/baselines/reference/escapedIdentifiers.symbols +++ b/tests/baselines/reference/escapedIdentifiers.symbols @@ -1,4 +1,5 @@ === tests/cases/compiler/escapedIdentifiers.ts === + /* 0 .. \u0030 9 .. \u0039 @@ -12,222 +13,222 @@ // var decl var \u0061 = 1; ->\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3)) +>\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 13, 3)) a ++; ->a : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3)) +>a : Symbol(\u0061, Decl(escapedIdentifiers.ts, 13, 3)) \u0061 ++; ->\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 12, 3)) +>\u0061 : Symbol(\u0061, Decl(escapedIdentifiers.ts, 13, 3)) var b = 1; ->b : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3)) +>b : Symbol(b, Decl(escapedIdentifiers.ts, 17, 3)) b ++; ->b : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3)) +>b : Symbol(b, Decl(escapedIdentifiers.ts, 17, 3)) \u0062 ++; ->\u0062 : Symbol(b, Decl(escapedIdentifiers.ts, 16, 3)) +>\u0062 : Symbol(b, Decl(escapedIdentifiers.ts, 17, 3)) // modules module moduleType1 { ->moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10)) +>moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 19, 10)) export var baz1: number; ->baz1 : Symbol(baz1, Decl(escapedIdentifiers.ts, 22, 14)) +>baz1 : Symbol(baz1, Decl(escapedIdentifiers.ts, 23, 14)) } module moduleType\u0032 { ->moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1)) +>moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 24, 1)) export var baz2: number; ->baz2 : Symbol(baz2, Decl(escapedIdentifiers.ts, 25, 14)) +>baz2 : Symbol(baz2, Decl(escapedIdentifiers.ts, 26, 14)) } moduleType1.baz1 = 3; ->moduleType1.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14)) ->moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10)) ->baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14)) +>moduleType1.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 23, 14)) +>moduleType1 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 19, 10)) +>baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 23, 14)) moduleType\u0031.baz1 = 3; ->moduleType\u0031.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14)) ->moduleType\u0031 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 18, 10)) ->baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 22, 14)) +>moduleType\u0031.baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 23, 14)) +>moduleType\u0031 : Symbol(moduleType1, Decl(escapedIdentifiers.ts, 19, 10)) +>baz1 : Symbol(moduleType1.baz1, Decl(escapedIdentifiers.ts, 23, 14)) moduleType2.baz2 = 3; ->moduleType2.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14)) ->moduleType2 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1)) ->baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14)) +>moduleType2.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 26, 14)) +>moduleType2 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 24, 1)) +>baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 26, 14)) moduleType\u0032.baz2 = 3; ->moduleType\u0032.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14)) ->moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 23, 1)) ->baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 25, 14)) +>moduleType\u0032.baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 26, 14)) +>moduleType\u0032 : Symbol(moduleType\u0032, Decl(escapedIdentifiers.ts, 24, 1)) +>baz2 : Symbol(moduleType\u0032.baz2, Decl(escapedIdentifiers.ts, 26, 14)) // classes class classType1 { ->classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26)) +>classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 32, 26)) public foo1: number; ->foo1 : Symbol(foo1, Decl(escapedIdentifiers.ts, 35, 18)) +>foo1 : Symbol(foo1, Decl(escapedIdentifiers.ts, 36, 18)) } class classType\u0032 { ->classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1)) +>classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 38, 1)) public foo2: number; ->foo2 : Symbol(foo2, Decl(escapedIdentifiers.ts, 38, 23)) +>foo2 : Symbol(foo2, Decl(escapedIdentifiers.ts, 39, 23)) } var classType1Object1 = new classType1(); ->classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 42, 3)) ->classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26)) +>classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 43, 3)) +>classType1 : Symbol(classType1, Decl(escapedIdentifiers.ts, 32, 26)) classType1Object1.foo1 = 2; ->classType1Object1.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18)) ->classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 42, 3)) ->foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18)) +>classType1Object1.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 36, 18)) +>classType1Object1 : Symbol(classType1Object1, Decl(escapedIdentifiers.ts, 43, 3)) +>foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 36, 18)) var classType1Object2 = new classType\u0031(); ->classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 44, 3)) ->classType\u0031 : Symbol(classType1, Decl(escapedIdentifiers.ts, 31, 26)) +>classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 45, 3)) +>classType\u0031 : Symbol(classType1, Decl(escapedIdentifiers.ts, 32, 26)) classType1Object2.foo1 = 2; ->classType1Object2.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18)) ->classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 44, 3)) ->foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 35, 18)) +>classType1Object2.foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 36, 18)) +>classType1Object2 : Symbol(classType1Object2, Decl(escapedIdentifiers.ts, 45, 3)) +>foo1 : Symbol(classType1.foo1, Decl(escapedIdentifiers.ts, 36, 18)) var classType2Object1 = new classType2(); ->classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 46, 3)) ->classType2 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1)) +>classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 47, 3)) +>classType2 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 38, 1)) classType2Object1.foo2 = 2; ->classType2Object1.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23)) ->classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 46, 3)) ->foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23)) +>classType2Object1.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 39, 23)) +>classType2Object1 : Symbol(classType2Object1, Decl(escapedIdentifiers.ts, 47, 3)) +>foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 39, 23)) var classType2Object2 = new classType\u0032(); ->classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 48, 3)) ->classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 37, 1)) +>classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 49, 3)) +>classType\u0032 : Symbol(classType\u0032, Decl(escapedIdentifiers.ts, 38, 1)) classType2Object2.foo2 = 2; ->classType2Object2.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23)) ->classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 48, 3)) ->foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 38, 23)) +>classType2Object2.foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 39, 23)) +>classType2Object2 : Symbol(classType2Object2, Decl(escapedIdentifiers.ts, 49, 3)) +>foo2 : Symbol(classType\u0032.foo2, Decl(escapedIdentifiers.ts, 39, 23)) // interfaces interface interfaceType1 { ->interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27)) +>interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 50, 27)) bar1: number; ->bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 52, 26)) +>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 53, 26)) } interface interfaceType\u0032 { ->interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1)) +>interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 55, 1)) bar2: number; ->bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 55, 31)) +>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 56, 31)) } var interfaceType1Object1 = { bar1: 0 }; ->interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 59, 3)) ->interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27)) ->bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 59, 45)) +>interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 60, 3)) +>interfaceType1 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 50, 27)) +>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 60, 45)) interfaceType1Object1.bar1 = 2; ->interfaceType1Object1.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26)) ->interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 59, 3)) ->bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26)) +>interfaceType1Object1.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 53, 26)) +>interfaceType1Object1 : Symbol(interfaceType1Object1, Decl(escapedIdentifiers.ts, 60, 3)) +>bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 53, 26)) var interfaceType1Object2 = { bar1: 0 }; ->interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 61, 3)) ->interfaceType\u0031 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 49, 27)) ->bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 61, 50)) +>interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 62, 3)) +>interfaceType\u0031 : Symbol(interfaceType1, Decl(escapedIdentifiers.ts, 50, 27)) +>bar1 : Symbol(bar1, Decl(escapedIdentifiers.ts, 62, 50)) interfaceType1Object2.bar1 = 2; ->interfaceType1Object2.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26)) ->interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 61, 3)) ->bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 52, 26)) +>interfaceType1Object2.bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 53, 26)) +>interfaceType1Object2 : Symbol(interfaceType1Object2, Decl(escapedIdentifiers.ts, 62, 3)) +>bar1 : Symbol(interfaceType1.bar1, Decl(escapedIdentifiers.ts, 53, 26)) var interfaceType2Object1 = { bar2: 0 }; ->interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 63, 3)) ->interfaceType2 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1)) ->bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 63, 45)) +>interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 64, 3)) +>interfaceType2 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 55, 1)) +>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 64, 45)) interfaceType2Object1.bar2 = 2; ->interfaceType2Object1.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31)) ->interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 63, 3)) ->bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31)) +>interfaceType2Object1.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 56, 31)) +>interfaceType2Object1 : Symbol(interfaceType2Object1, Decl(escapedIdentifiers.ts, 64, 3)) +>bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 56, 31)) var interfaceType2Object2 = { bar2: 0 }; ->interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 65, 3)) ->interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 54, 1)) ->bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 65, 50)) +>interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 66, 3)) +>interfaceType\u0032 : Symbol(interfaceType\u0032, Decl(escapedIdentifiers.ts, 55, 1)) +>bar2 : Symbol(bar2, Decl(escapedIdentifiers.ts, 66, 50)) interfaceType2Object2.bar2 = 2; ->interfaceType2Object2.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31)) ->interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 65, 3)) ->bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 55, 31)) +>interfaceType2Object2.bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 56, 31)) +>interfaceType2Object2 : Symbol(interfaceType2Object2, Decl(escapedIdentifiers.ts, 66, 3)) +>bar2 : Symbol(interfaceType\u0032.bar2, Decl(escapedIdentifiers.ts, 56, 31)) // arguments class testClass { ->testClass : Symbol(testClass, Decl(escapedIdentifiers.ts, 66, 31)) +>testClass : Symbol(testClass, Decl(escapedIdentifiers.ts, 67, 31)) public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) { ->func : Symbol(func, Decl(escapedIdentifiers.ts, 70, 17)) ->arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 71, 16)) ->arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 71, 29)) ->arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 71, 48)) ->arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 71, 68)) +>func : Symbol(func, Decl(escapedIdentifiers.ts, 71, 17)) +>arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 72, 16)) +>arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 72, 29)) +>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 72, 48)) +>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 72, 68)) arg\u0031 = 1; ->arg\u0031 : Symbol(arg1, Decl(escapedIdentifiers.ts, 71, 16)) +>arg\u0031 : Symbol(arg1, Decl(escapedIdentifiers.ts, 72, 16)) arg2 = 'string'; ->arg2 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 71, 29)) +>arg2 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 72, 29)) arg\u0033 = true; ->arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 71, 48)) +>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 72, 48)) arg4 = 2; ->arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 71, 68)) +>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 72, 68)) } } // constructors class constructorTestClass { ->constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 77, 1)) +>constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 78, 1)) constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) { ->arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 81, 17)) ->arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 81, 37)) ->arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 81, 62)) ->arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 81, 88)) +>arg1 : Symbol(arg1, Decl(escapedIdentifiers.ts, 82, 17)) +>arg\u0032 : Symbol(arg\u0032, Decl(escapedIdentifiers.ts, 82, 37)) +>arg\u0033 : Symbol(arg\u0033, Decl(escapedIdentifiers.ts, 82, 62)) +>arg4 : Symbol(arg4, Decl(escapedIdentifiers.ts, 82, 88)) } } var constructorTestObject = new constructorTestClass(1, 'string', true, 2); ->constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3)) ->constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 77, 1)) +>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 85, 3)) +>constructorTestClass : Symbol(constructorTestClass, Decl(escapedIdentifiers.ts, 78, 1)) constructorTestObject.arg\u0031 = 1; ->constructorTestObject.arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 81, 17)) ->constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3)) ->arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 81, 17)) +>constructorTestObject.arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 82, 17)) +>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 85, 3)) +>arg\u0031 : Symbol(constructorTestClass.arg1, Decl(escapedIdentifiers.ts, 82, 17)) constructorTestObject.arg2 = 'string'; ->constructorTestObject.arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 81, 37)) ->constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3)) ->arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 81, 37)) +>constructorTestObject.arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 82, 37)) +>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 85, 3)) +>arg2 : Symbol(constructorTestClass.arg\u0032, Decl(escapedIdentifiers.ts, 82, 37)) constructorTestObject.arg\u0033 = true; ->constructorTestObject.arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 81, 62)) ->constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3)) ->arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 81, 62)) +>constructorTestObject.arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 82, 62)) +>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 85, 3)) +>arg\u0033 : Symbol(constructorTestClass.arg\u0033, Decl(escapedIdentifiers.ts, 82, 62)) constructorTestObject.arg4 = 2; ->constructorTestObject.arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 81, 88)) ->constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 84, 3)) ->arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 81, 88)) +>constructorTestObject.arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 82, 88)) +>constructorTestObject : Symbol(constructorTestObject, Decl(escapedIdentifiers.ts, 85, 3)) +>arg4 : Symbol(constructorTestClass.arg4, Decl(escapedIdentifiers.ts, 82, 88)) // Lables diff --git a/tests/baselines/reference/escapedIdentifiers.types b/tests/baselines/reference/escapedIdentifiers.types index b32d21a48cb..67713976bd6 100644 --- a/tests/baselines/reference/escapedIdentifiers.types +++ b/tests/baselines/reference/escapedIdentifiers.types @@ -1,4 +1,5 @@ === tests/cases/compiler/escapedIdentifiers.ts === + /* 0 .. \u0030 9 .. \u0039 diff --git a/tests/baselines/reference/for.errors.txt b/tests/baselines/reference/for.errors.txt index 41ed5765c9a..d2caefbcdae 100644 --- a/tests/baselines/reference/for.errors.txt +++ b/tests/baselines/reference/for.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/for.ts(29,6): error TS1109: Expression expected. +tests/cases/compiler/for.ts(30,6): error TS1109: Expression expected. ==== tests/cases/compiler/for.ts (1 errors) ==== + for (var i = 0; i < 10; i++) { // ok var x1 = i; } diff --git a/tests/baselines/reference/for.js b/tests/baselines/reference/for.js index a77b68d8b6e..857d42bafdb 100644 --- a/tests/baselines/reference/for.js +++ b/tests/baselines/reference/for.js @@ -1,4 +1,5 @@ //// [for.ts] + for (var i = 0; i < 10; i++) { // ok var x1 = i; } diff --git a/tests/baselines/reference/forBreakStatements.js b/tests/baselines/reference/forBreakStatements.js index 9ed65627c9c..da4fccdfd2a 100644 --- a/tests/baselines/reference/forBreakStatements.js +++ b/tests/baselines/reference/forBreakStatements.js @@ -1,4 +1,5 @@ //// [forBreakStatements.ts] + for (; ;) { break; } diff --git a/tests/baselines/reference/forBreakStatements.symbols b/tests/baselines/reference/forBreakStatements.symbols index 76db9309a39..6d869b45934 100644 --- a/tests/baselines/reference/forBreakStatements.symbols +++ b/tests/baselines/reference/forBreakStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/forBreakStatements.ts === + for (; ;) { break; } @@ -33,7 +34,7 @@ for (; ;) for (; ;) for (; ;) break SEVEN; EIGHT: for (; ;) { var fn = function () { } ->fn : Symbol(fn, Decl(forBreakStatements.ts, 33, 7)) +>fn : Symbol(fn, Decl(forBreakStatements.ts, 34, 7)) break EIGHT; } diff --git a/tests/baselines/reference/forBreakStatements.types b/tests/baselines/reference/forBreakStatements.types index 8469a85bd19..c494f6be30a 100644 --- a/tests/baselines/reference/forBreakStatements.types +++ b/tests/baselines/reference/forBreakStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/forBreakStatements.ts === + for (; ;) { break; } diff --git a/tests/baselines/reference/forContinueStatements.js b/tests/baselines/reference/forContinueStatements.js index 34f70bb1fc1..fc5aa0434b3 100644 --- a/tests/baselines/reference/forContinueStatements.js +++ b/tests/baselines/reference/forContinueStatements.js @@ -1,4 +1,5 @@ //// [forContinueStatements.ts] + for (; ;) { continue; } diff --git a/tests/baselines/reference/forContinueStatements.symbols b/tests/baselines/reference/forContinueStatements.symbols index e24eb2aaa92..9e0c396acfb 100644 --- a/tests/baselines/reference/forContinueStatements.symbols +++ b/tests/baselines/reference/forContinueStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/continueStatements/forContinueStatements.ts === + for (; ;) { continue; } @@ -33,7 +34,7 @@ for (; ;) for (; ;) for (; ;) continue SEVEN; EIGHT: for (; ;) { var fn = function () { } ->fn : Symbol(fn, Decl(forContinueStatements.ts, 33, 7)) +>fn : Symbol(fn, Decl(forContinueStatements.ts, 34, 7)) continue EIGHT; } diff --git a/tests/baselines/reference/forContinueStatements.types b/tests/baselines/reference/forContinueStatements.types index 79b78e83345..0b52bdd5d47 100644 --- a/tests/baselines/reference/forContinueStatements.types +++ b/tests/baselines/reference/forContinueStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/continueStatements/forContinueStatements.ts === + for (; ;) { continue; } diff --git a/tests/baselines/reference/forInBreakStatements.js b/tests/baselines/reference/forInBreakStatements.js index 24b7cc57b8d..ebbadb31277 100644 --- a/tests/baselines/reference/forInBreakStatements.js +++ b/tests/baselines/reference/forInBreakStatements.js @@ -1,4 +1,5 @@ //// [forInBreakStatements.ts] + for(var x in {}) { break; } diff --git a/tests/baselines/reference/forInBreakStatements.symbols b/tests/baselines/reference/forInBreakStatements.symbols index 7984edc3fd6..5f48e110835 100644 --- a/tests/baselines/reference/forInBreakStatements.symbols +++ b/tests/baselines/reference/forInBreakStatements.symbols @@ -1,13 +1,14 @@ === tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts === + for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) break; } ONE: for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) break ONE; } @@ -15,43 +16,43 @@ for(var x in {}) { TWO: THREE: for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) break THREE; } FOUR: for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) FIVE: for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) break FOUR; } } for(var x in {}) { ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) SIX: for(var x in {}) break SIX; ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) } SEVEN: for (var x in {}) for (var x in {}) for (var x in {}) break SEVEN; ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) EIGHT: for (var x in {}){ ->x : Symbol(x, Decl(forInBreakStatements.ts, 0, 7), Decl(forInBreakStatements.ts, 5, 7), Decl(forInBreakStatements.ts, 11, 7), Decl(forInBreakStatements.ts, 16, 7), Decl(forInBreakStatements.ts, 18, 11), Decl(forInBreakStatements.ts, 23, 7), Decl(forInBreakStatements.ts, 25, 11), Decl(forInBreakStatements.ts, 29, 8), Decl(forInBreakStatements.ts, 29, 26), Decl(forInBreakStatements.ts, 29, 44), Decl(forInBreakStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInBreakStatements.ts, 1, 7), Decl(forInBreakStatements.ts, 6, 7), Decl(forInBreakStatements.ts, 12, 7), Decl(forInBreakStatements.ts, 17, 7), Decl(forInBreakStatements.ts, 19, 11), Decl(forInBreakStatements.ts, 24, 7), Decl(forInBreakStatements.ts, 26, 11), Decl(forInBreakStatements.ts, 30, 8), Decl(forInBreakStatements.ts, 30, 26), Decl(forInBreakStatements.ts, 30, 44), Decl(forInBreakStatements.ts, 33, 8)) var fn = function () { } ->fn : Symbol(fn, Decl(forInBreakStatements.ts, 33, 7)) +>fn : Symbol(fn, Decl(forInBreakStatements.ts, 34, 7)) break EIGHT; } diff --git a/tests/baselines/reference/forInBreakStatements.types b/tests/baselines/reference/forInBreakStatements.types index 05ea8e35feb..7714429e5af 100644 --- a/tests/baselines/reference/forInBreakStatements.types +++ b/tests/baselines/reference/forInBreakStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts === + for(var x in {}) { >x : any >{} : {} diff --git a/tests/baselines/reference/forInContinueStatements.js b/tests/baselines/reference/forInContinueStatements.js index 8b036c59721..ca530dd5d6c 100644 --- a/tests/baselines/reference/forInContinueStatements.js +++ b/tests/baselines/reference/forInContinueStatements.js @@ -1,4 +1,5 @@ //// [forInContinueStatements.ts] + for(var x in {}) { continue; } diff --git a/tests/baselines/reference/forInContinueStatements.symbols b/tests/baselines/reference/forInContinueStatements.symbols index 88129a50d21..a0edea53f3e 100644 --- a/tests/baselines/reference/forInContinueStatements.symbols +++ b/tests/baselines/reference/forInContinueStatements.symbols @@ -1,13 +1,14 @@ === tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts === + for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) continue; } ONE: for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) continue ONE; } @@ -15,43 +16,43 @@ for(var x in {}) { TWO: THREE: for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) continue THREE; } FOUR: for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) FIVE: for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) continue FOUR; } } for(var x in {}) { ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) SIX: for(var x in {}) continue SIX; ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) } SEVEN: for (var x in {}) for (var x in {}) for (var x in {}) continue SEVEN; ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) EIGHT: for (var x in {}){ ->x : Symbol(x, Decl(forInContinueStatements.ts, 0, 7), Decl(forInContinueStatements.ts, 5, 7), Decl(forInContinueStatements.ts, 11, 7), Decl(forInContinueStatements.ts, 16, 7), Decl(forInContinueStatements.ts, 18, 11), Decl(forInContinueStatements.ts, 23, 7), Decl(forInContinueStatements.ts, 25, 11), Decl(forInContinueStatements.ts, 29, 8), Decl(forInContinueStatements.ts, 29, 26), Decl(forInContinueStatements.ts, 29, 44), Decl(forInContinueStatements.ts, 32, 8)) +>x : Symbol(x, Decl(forInContinueStatements.ts, 1, 7), Decl(forInContinueStatements.ts, 6, 7), Decl(forInContinueStatements.ts, 12, 7), Decl(forInContinueStatements.ts, 17, 7), Decl(forInContinueStatements.ts, 19, 11), Decl(forInContinueStatements.ts, 24, 7), Decl(forInContinueStatements.ts, 26, 11), Decl(forInContinueStatements.ts, 30, 8), Decl(forInContinueStatements.ts, 30, 26), Decl(forInContinueStatements.ts, 30, 44), Decl(forInContinueStatements.ts, 33, 8)) var fn = function () { } ->fn : Symbol(fn, Decl(forInContinueStatements.ts, 33, 7)) +>fn : Symbol(fn, Decl(forInContinueStatements.ts, 34, 7)) continue EIGHT; } diff --git a/tests/baselines/reference/forInContinueStatements.types b/tests/baselines/reference/forInContinueStatements.types index 95637345fa6..572fd16053d 100644 --- a/tests/baselines/reference/forInContinueStatements.types +++ b/tests/baselines/reference/forInContinueStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts === + for(var x in {}) { >x : any >{} : {} diff --git a/tests/baselines/reference/forStatements.js b/tests/baselines/reference/forStatements.js index 39fdb6c8871..253fafc81e8 100644 --- a/tests/baselines/reference/forStatements.js +++ b/tests/baselines/reference/forStatements.js @@ -1,4 +1,5 @@ //// [forStatements.ts] + interface I { id: number; } diff --git a/tests/baselines/reference/forStatements.symbols b/tests/baselines/reference/forStatements.symbols index e72d55e5813..2d5250217f9 100644 --- a/tests/baselines/reference/forStatements.symbols +++ b/tests/baselines/reference/forStatements.symbols @@ -1,145 +1,146 @@ === tests/cases/conformance/statements/forStatements/forStatements.ts === + interface I { >I : Symbol(I, Decl(forStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(forStatements.ts, 0, 13)) +>id : Symbol(id, Decl(forStatements.ts, 1, 13)) } class C implements I { ->C : Symbol(C, Decl(forStatements.ts, 2, 1)) +>C : Symbol(C, Decl(forStatements.ts, 3, 1)) >I : Symbol(I, Decl(forStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(forStatements.ts, 4, 22)) +>id : Symbol(id, Decl(forStatements.ts, 5, 22)) } class D{ ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) ->T : Symbol(T, Decl(forStatements.ts, 8, 8)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) +>T : Symbol(T, Decl(forStatements.ts, 9, 8)) source: T; ->source : Symbol(source, Decl(forStatements.ts, 8, 11)) ->T : Symbol(T, Decl(forStatements.ts, 8, 8)) +>source : Symbol(source, Decl(forStatements.ts, 9, 11)) +>T : Symbol(T, Decl(forStatements.ts, 9, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(forStatements.ts, 9, 14)) ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) ->T : Symbol(T, Decl(forStatements.ts, 8, 8)) +>recurse : Symbol(recurse, Decl(forStatements.ts, 10, 14)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) +>T : Symbol(T, Decl(forStatements.ts, 9, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(forStatements.ts, 10, 18)) ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) ->T : Symbol(T, Decl(forStatements.ts, 8, 8)) +>wrapped : Symbol(wrapped, Decl(forStatements.ts, 11, 18)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) +>T : Symbol(T, Decl(forStatements.ts, 9, 8)) } function F(x: string): number { return 42; } ->F : Symbol(F, Decl(forStatements.ts, 12, 1)) ->x : Symbol(x, Decl(forStatements.ts, 14, 11)) +>F : Symbol(F, Decl(forStatements.ts, 13, 1)) +>x : Symbol(x, Decl(forStatements.ts, 15, 11)) module M { ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) export class A { ->A : Symbol(A, Decl(forStatements.ts, 16, 10)) +>A : Symbol(A, Decl(forStatements.ts, 17, 10)) name: string; ->name : Symbol(name, Decl(forStatements.ts, 17, 20)) +>name : Symbol(name, Decl(forStatements.ts, 18, 20)) } export function F2(x: number): string { return x.toString(); } ->F2 : Symbol(F2, Decl(forStatements.ts, 19, 5)) ->x : Symbol(x, Decl(forStatements.ts, 21, 23)) +>F2 : Symbol(F2, Decl(forStatements.ts, 20, 5)) +>x : Symbol(x, Decl(forStatements.ts, 22, 23)) >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(forStatements.ts, 21, 23)) +>x : Symbol(x, Decl(forStatements.ts, 22, 23)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } for(var aNumber: number = 9.9;;){} ->aNumber : Symbol(aNumber, Decl(forStatements.ts, 24, 7)) +>aNumber : Symbol(aNumber, Decl(forStatements.ts, 25, 7)) for(var aString: string = 'this is a string';;){} ->aString : Symbol(aString, Decl(forStatements.ts, 25, 7)) +>aString : Symbol(aString, Decl(forStatements.ts, 26, 7)) for(var aDate: Date = new Date(12);;){} ->aDate : Symbol(aDate, Decl(forStatements.ts, 26, 7)) +>aDate : Symbol(aDate, Decl(forStatements.ts, 27, 7)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) for(var anObject: Object = new Object();;){} ->anObject : Symbol(anObject, Decl(forStatements.ts, 27, 7)) +>anObject : Symbol(anObject, Decl(forStatements.ts, 28, 7)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) for(var anAny: any = null;;){} ->anAny : Symbol(anAny, Decl(forStatements.ts, 29, 7)) +>anAny : Symbol(anAny, Decl(forStatements.ts, 30, 7)) for(var aSecondAny: any = undefined;;){} ->aSecondAny : Symbol(aSecondAny, Decl(forStatements.ts, 30, 7)) +>aSecondAny : Symbol(aSecondAny, Decl(forStatements.ts, 31, 7)) >undefined : Symbol(undefined) for(var aVoid: void = undefined;;){} ->aVoid : Symbol(aVoid, Decl(forStatements.ts, 31, 7)) +>aVoid : Symbol(aVoid, Decl(forStatements.ts, 32, 7)) >undefined : Symbol(undefined) for(var anInterface: I = new C();;){} ->anInterface : Symbol(anInterface, Decl(forStatements.ts, 33, 7)) +>anInterface : Symbol(anInterface, Decl(forStatements.ts, 34, 7)) >I : Symbol(I, Decl(forStatements.ts, 0, 0)) ->C : Symbol(C, Decl(forStatements.ts, 2, 1)) +>C : Symbol(C, Decl(forStatements.ts, 3, 1)) for(var aClass: C = new C();;){} ->aClass : Symbol(aClass, Decl(forStatements.ts, 34, 7)) ->C : Symbol(C, Decl(forStatements.ts, 2, 1)) ->C : Symbol(C, Decl(forStatements.ts, 2, 1)) +>aClass : Symbol(aClass, Decl(forStatements.ts, 35, 7)) +>C : Symbol(C, Decl(forStatements.ts, 3, 1)) +>C : Symbol(C, Decl(forStatements.ts, 3, 1)) for(var aGenericClass: D = new D();;){} ->aGenericClass : Symbol(aGenericClass, Decl(forStatements.ts, 35, 7)) ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) ->D : Symbol(D, Decl(forStatements.ts, 6, 1)) +>aGenericClass : Symbol(aGenericClass, Decl(forStatements.ts, 36, 7)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) +>D : Symbol(D, Decl(forStatements.ts, 7, 1)) for(var anObjectLiteral: I = { id: 12 };;){} ->anObjectLiteral : Symbol(anObjectLiteral, Decl(forStatements.ts, 36, 7)) +>anObjectLiteral : Symbol(anObjectLiteral, Decl(forStatements.ts, 37, 7)) >I : Symbol(I, Decl(forStatements.ts, 0, 0)) ->id : Symbol(id, Decl(forStatements.ts, 36, 30)) +>id : Symbol(id, Decl(forStatements.ts, 37, 30)) for(var anOtherObjectLiteral: { id: number } = new C();;){} ->anOtherObjectLiteral : Symbol(anOtherObjectLiteral, Decl(forStatements.ts, 37, 7)) ->id : Symbol(id, Decl(forStatements.ts, 37, 31)) ->C : Symbol(C, Decl(forStatements.ts, 2, 1)) +>anOtherObjectLiteral : Symbol(anOtherObjectLiteral, Decl(forStatements.ts, 38, 7)) +>id : Symbol(id, Decl(forStatements.ts, 38, 31)) +>C : Symbol(C, Decl(forStatements.ts, 3, 1)) for(var aFunction: typeof F = F;;){} ->aFunction : Symbol(aFunction, Decl(forStatements.ts, 39, 7)) ->F : Symbol(F, Decl(forStatements.ts, 12, 1)) ->F : Symbol(F, Decl(forStatements.ts, 12, 1)) +>aFunction : Symbol(aFunction, Decl(forStatements.ts, 40, 7)) +>F : Symbol(F, Decl(forStatements.ts, 13, 1)) +>F : Symbol(F, Decl(forStatements.ts, 13, 1)) for(var anOtherFunction: (x: string) => number = F;;){} ->anOtherFunction : Symbol(anOtherFunction, Decl(forStatements.ts, 40, 7)) ->x : Symbol(x, Decl(forStatements.ts, 40, 26)) ->F : Symbol(F, Decl(forStatements.ts, 12, 1)) +>anOtherFunction : Symbol(anOtherFunction, Decl(forStatements.ts, 41, 7)) +>x : Symbol(x, Decl(forStatements.ts, 41, 26)) +>F : Symbol(F, Decl(forStatements.ts, 13, 1)) for(var aLambda: typeof F = (x) => 2;;){} ->aLambda : Symbol(aLambda, Decl(forStatements.ts, 41, 7)) ->F : Symbol(F, Decl(forStatements.ts, 12, 1)) ->x : Symbol(x, Decl(forStatements.ts, 41, 29)) +>aLambda : Symbol(aLambda, Decl(forStatements.ts, 42, 7)) +>F : Symbol(F, Decl(forStatements.ts, 13, 1)) +>x : Symbol(x, Decl(forStatements.ts, 42, 29)) for(var aModule: typeof M = M;;){} ->aModule : Symbol(aModule, Decl(forStatements.ts, 43, 7)) ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) +>aModule : Symbol(aModule, Decl(forStatements.ts, 44, 7)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) for(var aClassInModule: M.A = new M.A();;){} ->aClassInModule : Symbol(aClassInModule, Decl(forStatements.ts, 44, 7)) ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) ->A : Symbol(M.A, Decl(forStatements.ts, 16, 10)) ->M.A : Symbol(M.A, Decl(forStatements.ts, 16, 10)) ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) ->A : Symbol(M.A, Decl(forStatements.ts, 16, 10)) +>aClassInModule : Symbol(aClassInModule, Decl(forStatements.ts, 45, 7)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) +>A : Symbol(M.A, Decl(forStatements.ts, 17, 10)) +>M.A : Symbol(M.A, Decl(forStatements.ts, 17, 10)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) +>A : Symbol(M.A, Decl(forStatements.ts, 17, 10)) for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){} ->aFunctionInModule : Symbol(aFunctionInModule, Decl(forStatements.ts, 45, 7)) ->M.F2 : Symbol(M.F2, Decl(forStatements.ts, 19, 5)) ->M : Symbol(M, Decl(forStatements.ts, 14, 44)) ->F2 : Symbol(M.F2, Decl(forStatements.ts, 19, 5)) ->x : Symbol(x, Decl(forStatements.ts, 45, 42)) +>aFunctionInModule : Symbol(aFunctionInModule, Decl(forStatements.ts, 46, 7)) +>M.F2 : Symbol(M.F2, Decl(forStatements.ts, 20, 5)) +>M : Symbol(M, Decl(forStatements.ts, 15, 44)) +>F2 : Symbol(M.F2, Decl(forStatements.ts, 20, 5)) +>x : Symbol(x, Decl(forStatements.ts, 46, 42)) diff --git a/tests/baselines/reference/forStatements.types b/tests/baselines/reference/forStatements.types index 3fbcf2dbfb2..95b198a7fec 100644 --- a/tests/baselines/reference/forStatements.types +++ b/tests/baselines/reference/forStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/forStatements/forStatements.ts === + interface I { >I : I diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 53ecb88363d..f1869ae7fca 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -1,18 +1,19 @@ -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 '(C | D)[]'. -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(33,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(34,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(35,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(36,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(37,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(40,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(41,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(44,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(47,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(48,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(51,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(54,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; } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 1dde9981880..20639c687cb 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -1,4 +1,5 @@ //// [forStatementsMultipleInvalidDecl.ts] + interface I { id: number; } diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.js b/tests/baselines/reference/forStatementsMultipleValidDecl.js index e95e37d63ac..6913894a15f 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.js @@ -1,4 +1,5 @@ //// [forStatementsMultipleValidDecl.ts] + // all expected to be valid for (var x: number; ;) { } diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.symbols b/tests/baselines/reference/forStatementsMultipleValidDecl.symbols index 1f131bb9701..d2d8ac01003 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.symbols +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.symbols @@ -1,110 +1,111 @@ === tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts === + // all expected to be valid for (var x: number; ;) { } ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 4, 8), Decl(forStatementsMultipleValidDecl.ts, 6, 8)) for (var x = 2; ;) { } ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 4, 8), Decl(forStatementsMultipleValidDecl.ts, 6, 8)) for (var x = undefined; ;) { } ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 2, 8), Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 5, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 3, 8), Decl(forStatementsMultipleValidDecl.ts, 4, 8), Decl(forStatementsMultipleValidDecl.ts, 6, 8)) >undefined : Symbol(undefined) // new declaration space, making redeclaring x as a string valid function declSpace() { ->declSpace : Symbol(declSpace, Decl(forStatementsMultipleValidDecl.ts, 5, 38)) +>declSpace : Symbol(declSpace, Decl(forStatementsMultipleValidDecl.ts, 6, 38)) for (var x = 'this is a string'; ;) { } ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 8, 12)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 9, 12)) } interface Point { x: number; y: number; } ->Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 10, 17)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 10, 28)) +>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 10, 1)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 11, 17)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 11, 28)) for (var p: Point; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 10, 1)) for (var p = { x: 1, y: 2 }; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 13, 14)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 13, 20)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 14, 14)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 14, 20)) for (var p: Point = { x: 0, y: undefined }; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 9, 1)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 14, 21)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 14, 27)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>Point : Symbol(Point, Decl(forStatementsMultipleValidDecl.ts, 10, 1)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 15, 21)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 15, 27)) >undefined : Symbol(undefined) for (var p = { x: 1, y: undefined }; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 15, 14)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 15, 20)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 16, 14)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 16, 20)) >undefined : Symbol(undefined) for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 16, 13)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 16, 24)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 16, 41)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 16, 47)) - -for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 17, 15)) ->y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 17, 26)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 17, 13)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 17, 24)) >x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 17, 41)) >y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 17, 47)) + +for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { } +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 18, 15)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 18, 26)) +>x : Symbol(x, Decl(forStatementsMultipleValidDecl.ts, 18, 41)) +>y : Symbol(y, Decl(forStatementsMultipleValidDecl.ts, 18, 47)) >undefined : Symbol(undefined) for (var p: typeof p; ;) { } ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) ->p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 12, 8), Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) +>p : Symbol(p, Decl(forStatementsMultipleValidDecl.ts, 13, 8), Decl(forStatementsMultipleValidDecl.ts, 14, 8), Decl(forStatementsMultipleValidDecl.ts, 15, 8), Decl(forStatementsMultipleValidDecl.ts, 16, 8), Decl(forStatementsMultipleValidDecl.ts, 17, 8), Decl(forStatementsMultipleValidDecl.ts, 18, 8), Decl(forStatementsMultipleValidDecl.ts, 19, 8)) for (var fn = function (s: string) { return 42; }; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) ->s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 20, 24)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) +>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 21, 24)) for (var fn = (s: string) => 3; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) ->s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 21, 15)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) +>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 22, 15)) for (var fn: (s: string) => number; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) ->s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 22, 14)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) +>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 23, 14)) for (var fn: { (s: string): number }; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) ->s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 23, 16)) - -for (var fn = <(s: string) => number> null; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) >s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 24, 16)) +for (var fn = <(s: string) => number> null; ;) { } +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) +>s : Symbol(s, Decl(forStatementsMultipleValidDecl.ts, 25, 16)) + for (var fn: typeof fn; ;) { } ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) ->fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 20, 8), Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) +>fn : Symbol(fn, Decl(forStatementsMultipleValidDecl.ts, 21, 8), Decl(forStatementsMultipleValidDecl.ts, 22, 8), Decl(forStatementsMultipleValidDecl.ts, 23, 8), Decl(forStatementsMultipleValidDecl.ts, 24, 8), Decl(forStatementsMultipleValidDecl.ts, 25, 8), Decl(forStatementsMultipleValidDecl.ts, 26, 8)) for (var a: string[]; ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) for (var a = ['a', 'b']; ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) for (var a = []; ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) for (var a: string[] = []; ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) for (var a = new Array(); ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) for (var a: typeof a; ;) { } ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) ->a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 27, 8), Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) +>a : Symbol(a, Decl(forStatementsMultipleValidDecl.ts, 28, 8), Decl(forStatementsMultipleValidDecl.ts, 29, 8), Decl(forStatementsMultipleValidDecl.ts, 30, 8), Decl(forStatementsMultipleValidDecl.ts, 31, 8), Decl(forStatementsMultipleValidDecl.ts, 32, 8), Decl(forStatementsMultipleValidDecl.ts, 33, 8)) diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.types b/tests/baselines/reference/forStatementsMultipleValidDecl.types index 9b9af5b850e..acb26f17312 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.types +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts === + // all expected to be valid for (var x: number; ;) { } diff --git a/tests/baselines/reference/functionImplementationErrors.errors.txt b/tests/baselines/reference/functionImplementationErrors.errors.txt index 0c74588c316..86ecb6a6057 100644 --- a/tests/baselines/reference/functionImplementationErrors.errors.txt +++ b/tests/baselines/reference/functionImplementationErrors.errors.txt @@ -1,20 +1,20 @@ -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,19): 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(49,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(53,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(57,11): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(61,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(65,11): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(3,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(7,19): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(11,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(17,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(26,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/conformance/functions/functionImplementationErrors.ts(31,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +tests/cases/conformance/functions/functionImplementationErrors.ts(36,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. +tests/cases/conformance/functions/functionImplementationErrors.ts(50,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(54,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(58,11): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(62,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(66,11): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error TS2354: No best common type exists among return expressions. -==== tests/cases/conformance/functions/functionImplementationErrors.ts (14 errors) ==== +==== tests/cases/conformance/functions/functionImplementationErrors.ts (13 errors) ==== + // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { ~~~~~~~~ @@ -52,7 +52,7 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error // Function implemetnation with non -void return type annotation with no return function f5(): number { ~~~~~~ -!!! error TS2355: 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. } var m; @@ -72,8 +72,6 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error // FunctionExpression with non -void return type annotation with a throw, no return, and other code // Should be error but isn't undefined === function (): number { - ~~~~~~ -!!! 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/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 42be5f21458..4436f1bc94f 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -1,4 +1,5 @@ //// [functionImplementationErrors.ts] + // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { return ''; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 3fc040650e4..512da960b78 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -1,4 +1,5 @@ //// [functionImplementations.ts] + // FunctionExpression with no return type annotation and no return statement returns void var v: void = function () { } (); diff --git a/tests/baselines/reference/functionImplementations.symbols b/tests/baselines/reference/functionImplementations.symbols index 3932261b27c..07945b5f765 100644 --- a/tests/baselines/reference/functionImplementations.symbols +++ b/tests/baselines/reference/functionImplementations.symbols @@ -1,109 +1,110 @@ === tests/cases/conformance/functions/functionImplementations.ts === + // FunctionExpression with no return type annotation and no return statement returns void var v: void = function () { } (); ->v : Symbol(v, Decl(functionImplementations.ts, 1, 3)) +>v : Symbol(v, Decl(functionImplementations.ts, 2, 3)) // FunctionExpression f with no return type annotation and directly references f in its body returns any var a: any = function f() { ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->f : Symbol(f, Decl(functionImplementations.ts, 4, 12)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>f : Symbol(f, Decl(functionImplementations.ts, 5, 12)) return f; ->f : Symbol(f, Decl(functionImplementations.ts, 4, 12)) +>f : Symbol(f, Decl(functionImplementations.ts, 5, 12)) }; var a: any = function f() { ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->f : Symbol(f, Decl(functionImplementations.ts, 7, 12)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>f : Symbol(f, Decl(functionImplementations.ts, 8, 12)) return f(); ->f : Symbol(f, Decl(functionImplementations.ts, 7, 12)) +>f : Symbol(f, Decl(functionImplementations.ts, 8, 12)) }; // FunctionExpression f with no return type annotation and indirectly references f in its body returns any var a: any = function f() { ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->f : Symbol(f, Decl(functionImplementations.ts, 12, 12)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>f : Symbol(f, Decl(functionImplementations.ts, 13, 12)) var x = f; ->x : Symbol(x, Decl(functionImplementations.ts, 13, 7)) ->f : Symbol(f, Decl(functionImplementations.ts, 12, 12)) +>x : Symbol(x, Decl(functionImplementations.ts, 14, 7)) +>f : Symbol(f, Decl(functionImplementations.ts, 13, 12)) return x; ->x : Symbol(x, Decl(functionImplementations.ts, 13, 7)) +>x : Symbol(x, Decl(functionImplementations.ts, 14, 7)) }; // Two mutually recursive function implementations with no return type annotations function rec1() { ->rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2)) +>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 16, 2)) return rec2(); ->rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1)) +>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 21, 1)) } function rec2() { ->rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1)) +>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 21, 1)) return rec1(); ->rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2)) +>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 16, 2)) } var a = rec1(); ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->rec1 : Symbol(rec1, Decl(functionImplementations.ts, 15, 2)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>rec1 : Symbol(rec1, Decl(functionImplementations.ts, 16, 2)) var a = rec2(); ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->rec2 : Symbol(rec2, Decl(functionImplementations.ts, 20, 1)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>rec2 : Symbol(rec2, Decl(functionImplementations.ts, 21, 1)) // Two mutually recursive function implementations with return type annotation in one function rec3(): number { ->rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15)) +>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 26, 15)) return rec4(); ->rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1)) +>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 31, 1)) } function rec4() { ->rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1)) +>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 31, 1)) return rec3(); ->rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15)) +>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 26, 15)) } var n: number; ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) var n = rec3(); ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) ->rec3 : Symbol(rec3, Decl(functionImplementations.ts, 25, 15)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) +>rec3 : Symbol(rec3, Decl(functionImplementations.ts, 26, 15)) var n = rec4(); ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) ->rec4 : Symbol(rec4, Decl(functionImplementations.ts, 30, 1)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) +>rec4 : Symbol(rec4, Decl(functionImplementations.ts, 31, 1)) // FunctionExpression with no return type annotation and returns a number var n = function () { ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) return 3; } (); // FunctionExpression with no return type annotation and returns null var nu = null; ->nu : Symbol(nu, Decl(functionImplementations.ts, 44, 3), Decl(functionImplementations.ts, 45, 3)) +>nu : Symbol(nu, Decl(functionImplementations.ts, 45, 3), Decl(functionImplementations.ts, 46, 3)) var nu = function () { ->nu : Symbol(nu, Decl(functionImplementations.ts, 44, 3), Decl(functionImplementations.ts, 45, 3)) +>nu : Symbol(nu, Decl(functionImplementations.ts, 45, 3), Decl(functionImplementations.ts, 46, 3)) return null; } (); // FunctionExpression with no return type annotation and returns undefined var un = undefined; ->un : Symbol(un, Decl(functionImplementations.ts, 50, 3), Decl(functionImplementations.ts, 51, 3)) +>un : Symbol(un, Decl(functionImplementations.ts, 51, 3), Decl(functionImplementations.ts, 52, 3)) >undefined : Symbol(undefined) var un = function () { ->un : Symbol(un, Decl(functionImplementations.ts, 50, 3), Decl(functionImplementations.ts, 51, 3)) +>un : Symbol(un, Decl(functionImplementations.ts, 51, 3), Decl(functionImplementations.ts, 52, 3)) return undefined; >undefined : Symbol(undefined) @@ -112,31 +113,31 @@ var un = function () { // FunctionExpression with no return type annotation and returns a type parameter type var n = function (x: T) { ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) ->T : Symbol(T, Decl(functionImplementations.ts, 56, 18)) ->x : Symbol(x, Decl(functionImplementations.ts, 56, 21)) ->T : Symbol(T, Decl(functionImplementations.ts, 56, 18)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) +>T : Symbol(T, Decl(functionImplementations.ts, 57, 18)) +>x : Symbol(x, Decl(functionImplementations.ts, 57, 21)) +>T : Symbol(T, Decl(functionImplementations.ts, 57, 18)) return x; ->x : Symbol(x, Decl(functionImplementations.ts, 56, 21)) +>x : Symbol(x, Decl(functionImplementations.ts, 57, 21)) } (4); // FunctionExpression with no return type annotation and returns a constrained type parameter type var n = function (x: T) { ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) ->T : Symbol(T, Decl(functionImplementations.ts, 61, 18)) ->x : Symbol(x, Decl(functionImplementations.ts, 61, 32)) ->T : Symbol(T, Decl(functionImplementations.ts, 61, 18)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) +>T : Symbol(T, Decl(functionImplementations.ts, 62, 18)) +>x : Symbol(x, Decl(functionImplementations.ts, 62, 32)) +>T : Symbol(T, Decl(functionImplementations.ts, 62, 18)) return x; ->x : Symbol(x, Decl(functionImplementations.ts, 61, 32)) +>x : Symbol(x, Decl(functionImplementations.ts, 62, 32)) } (4); // FunctionExpression with no return type annotation with multiple return statements with identical types var n = function () { ->n : Symbol(n, Decl(functionImplementations.ts, 34, 3), Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 39, 3), Decl(functionImplementations.ts, 56, 3), Decl(functionImplementations.ts, 61, 3), Decl(functionImplementations.ts, 66, 3)) +>n : Symbol(n, Decl(functionImplementations.ts, 35, 3), Decl(functionImplementations.ts, 36, 3), Decl(functionImplementations.ts, 37, 3), Decl(functionImplementations.ts, 40, 3), Decl(functionImplementations.ts, 57, 3), Decl(functionImplementations.ts, 62, 3), Decl(functionImplementations.ts, 67, 3)) return 3; return 5; @@ -148,36 +149,36 @@ var n = function () { // A compile - time error occurs if no return statement expression has a type that is a supertype of each of the others. // FunctionExpression with no return type annotation with multiple return statements with subtype relation between returns class Base { private m; } ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) ->m : Symbol(m, Decl(functionImplementations.ts, 76, 12)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) +>m : Symbol(m, Decl(functionImplementations.ts, 77, 12)) class Derived extends Base { private q; } ->Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25)) ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) ->q : Symbol(q, Decl(functionImplementations.ts, 77, 28)) +>Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) +>q : Symbol(q, Decl(functionImplementations.ts, 78, 28)) var b: Base; ->b : Symbol(b, Decl(functionImplementations.ts, 78, 3), Decl(functionImplementations.ts, 79, 3)) ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) +>b : Symbol(b, Decl(functionImplementations.ts, 79, 3), Decl(functionImplementations.ts, 80, 3)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) var b = function () { ->b : Symbol(b, Decl(functionImplementations.ts, 78, 3), Decl(functionImplementations.ts, 79, 3)) +>b : Symbol(b, Decl(functionImplementations.ts, 79, 3), Decl(functionImplementations.ts, 80, 3)) return new Base(); return new Derived(); ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) ->Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) +>Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) } (); // FunctionExpression with no return type annotation with multiple return statements with one a recursive call var a = function f() { ->a : Symbol(a, Decl(functionImplementations.ts, 4, 3), Decl(functionImplementations.ts, 7, 3), Decl(functionImplementations.ts, 12, 3), Decl(functionImplementations.ts, 24, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 84, 3)) ->f : Symbol(f, Decl(functionImplementations.ts, 84, 7)) +>a : Symbol(a, Decl(functionImplementations.ts, 5, 3), Decl(functionImplementations.ts, 8, 3), Decl(functionImplementations.ts, 13, 3), Decl(functionImplementations.ts, 25, 3), Decl(functionImplementations.ts, 26, 3), Decl(functionImplementations.ts, 85, 3)) +>f : Symbol(f, Decl(functionImplementations.ts, 85, 7)) return new Base(); return new Derived(); return f(); // ? ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) ->Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25)) ->f : Symbol(f, Decl(functionImplementations.ts, 84, 7)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) +>Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) +>f : Symbol(f, Decl(functionImplementations.ts, 85, 7)) } (); @@ -192,59 +193,59 @@ undefined === function (): number { // Type of 'this' in function implementation is 'any' function thisFunc() { ->thisFunc : Symbol(thisFunc, Decl(functionImplementations.ts, 91, 2)) +>thisFunc : Symbol(thisFunc, Decl(functionImplementations.ts, 92, 2)) var x = this; ->x : Symbol(x, Decl(functionImplementations.ts, 95, 7), Decl(functionImplementations.ts, 96, 7)) +>x : Symbol(x, Decl(functionImplementations.ts, 96, 7), Decl(functionImplementations.ts, 97, 7)) var x: any; ->x : Symbol(x, Decl(functionImplementations.ts, 95, 7), Decl(functionImplementations.ts, 96, 7)) +>x : Symbol(x, Decl(functionImplementations.ts, 96, 7), Decl(functionImplementations.ts, 97, 7)) } // Function signature with optional parameter, no type annotation and initializer has initializer's type function opt1(n = 4) { ->opt1 : Symbol(opt1, Decl(functionImplementations.ts, 97, 1)) ->n : Symbol(n, Decl(functionImplementations.ts, 100, 14)) +>opt1 : Symbol(opt1, Decl(functionImplementations.ts, 98, 1)) +>n : Symbol(n, Decl(functionImplementations.ts, 101, 14)) var m = n; ->m : Symbol(m, Decl(functionImplementations.ts, 101, 7), Decl(functionImplementations.ts, 102, 7)) ->n : Symbol(n, Decl(functionImplementations.ts, 100, 14)) +>m : Symbol(m, Decl(functionImplementations.ts, 102, 7), Decl(functionImplementations.ts, 103, 7)) +>n : Symbol(n, Decl(functionImplementations.ts, 101, 14)) var m: number; ->m : Symbol(m, Decl(functionImplementations.ts, 101, 7), Decl(functionImplementations.ts, 102, 7)) +>m : Symbol(m, Decl(functionImplementations.ts, 102, 7), Decl(functionImplementations.ts, 103, 7)) } // Function signature with optional parameter, no type annotation and initializer has initializer's widened type function opt2(n = { x: null, y: undefined }) { ->opt2 : Symbol(opt2, Decl(functionImplementations.ts, 103, 1)) ->n : Symbol(n, Decl(functionImplementations.ts, 106, 14)) ->x : Symbol(x, Decl(functionImplementations.ts, 106, 19)) ->y : Symbol(y, Decl(functionImplementations.ts, 106, 28)) +>opt2 : Symbol(opt2, Decl(functionImplementations.ts, 104, 1)) +>n : Symbol(n, Decl(functionImplementations.ts, 107, 14)) +>x : Symbol(x, Decl(functionImplementations.ts, 107, 19)) +>y : Symbol(y, Decl(functionImplementations.ts, 107, 28)) >undefined : Symbol(undefined) var m = n; ->m : Symbol(m, Decl(functionImplementations.ts, 107, 7), Decl(functionImplementations.ts, 108, 7)) ->n : Symbol(n, Decl(functionImplementations.ts, 106, 14)) +>m : Symbol(m, Decl(functionImplementations.ts, 108, 7), Decl(functionImplementations.ts, 109, 7)) +>n : Symbol(n, Decl(functionImplementations.ts, 107, 14)) var m: { x: any; y: any }; ->m : Symbol(m, Decl(functionImplementations.ts, 107, 7), Decl(functionImplementations.ts, 108, 7)) ->x : Symbol(x, Decl(functionImplementations.ts, 108, 12)) ->y : Symbol(y, Decl(functionImplementations.ts, 108, 20)) +>m : Symbol(m, Decl(functionImplementations.ts, 108, 7), Decl(functionImplementations.ts, 109, 7)) +>x : Symbol(x, Decl(functionImplementations.ts, 109, 12)) +>y : Symbol(y, Decl(functionImplementations.ts, 109, 20)) } // Function signature with initializer referencing other parameter to the left function opt3(n: number, m = n) { ->opt3 : Symbol(opt3, Decl(functionImplementations.ts, 109, 1)) ->n : Symbol(n, Decl(functionImplementations.ts, 112, 14)) ->m : Symbol(m, Decl(functionImplementations.ts, 112, 24)) ->n : Symbol(n, Decl(functionImplementations.ts, 112, 14)) +>opt3 : Symbol(opt3, Decl(functionImplementations.ts, 110, 1)) +>n : Symbol(n, Decl(functionImplementations.ts, 113, 14)) +>m : Symbol(m, Decl(functionImplementations.ts, 113, 24)) +>n : Symbol(n, Decl(functionImplementations.ts, 113, 14)) var y = m; ->y : Symbol(y, Decl(functionImplementations.ts, 113, 7), Decl(functionImplementations.ts, 114, 7)) ->m : Symbol(m, Decl(functionImplementations.ts, 112, 24)) +>y : Symbol(y, Decl(functionImplementations.ts, 114, 7), Decl(functionImplementations.ts, 115, 7)) +>m : Symbol(m, Decl(functionImplementations.ts, 113, 24)) var y: number; ->y : Symbol(y, Decl(functionImplementations.ts, 113, 7), Decl(functionImplementations.ts, 114, 7)) +>y : Symbol(y, Decl(functionImplementations.ts, 114, 7), Decl(functionImplementations.ts, 115, 7)) } // Function signature with optional parameter has correct codegen @@ -252,93 +253,93 @@ function opt3(n: number, m = n) { // FunctionExpression with non -void return type annotation return with no expression function f6(): number { ->f6 : Symbol(f6, Decl(functionImplementations.ts, 115, 1)) +>f6 : Symbol(f6, Decl(functionImplementations.ts, 116, 1)) return; } class Derived2 extends Base { private r: string; } ->Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1)) ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) ->r : Symbol(r, Decl(functionImplementations.ts, 125, 29)) +>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 124, 1)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) +>r : Symbol(r, Decl(functionImplementations.ts, 126, 29)) class AnotherClass { private x } ->AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50)) ->x : Symbol(x, Decl(functionImplementations.ts, 126, 20)) +>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 126, 50)) +>x : Symbol(x, Decl(functionImplementations.ts, 127, 20)) // if f is a contextually typed function expression, the inferred return type is the union type // of the types of the return statement expressions in the function body, // ignoring return statements with no expressions. var f7: (x: number) => string | number = x => { // should be (x: number) => number | string ->f7 : Symbol(f7, Decl(functionImplementations.ts, 130, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 130, 9)) ->x : Symbol(x, Decl(functionImplementations.ts, 130, 40)) +>f7 : Symbol(f7, Decl(functionImplementations.ts, 131, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 131, 9)) +>x : Symbol(x, Decl(functionImplementations.ts, 131, 40)) if (x < 0) { return x; } ->x : Symbol(x, Decl(functionImplementations.ts, 130, 40)) ->x : Symbol(x, Decl(functionImplementations.ts, 130, 40)) +>x : Symbol(x, Decl(functionImplementations.ts, 131, 40)) +>x : Symbol(x, Decl(functionImplementations.ts, 131, 40)) return x.toString(); >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(functionImplementations.ts, 130, 40)) +>x : Symbol(x, Decl(functionImplementations.ts, 131, 40)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } var f8: (x: number) => any = x => { // should be (x: number) => Base ->f8 : Symbol(f8, Decl(functionImplementations.ts, 134, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 134, 9)) ->x : Symbol(x, Decl(functionImplementations.ts, 134, 28)) +>f8 : Symbol(f8, Decl(functionImplementations.ts, 135, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 135, 9)) +>x : Symbol(x, Decl(functionImplementations.ts, 135, 28)) return new Base(); ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) return new Derived2(); ->Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1)) +>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 124, 1)) } var f9: (x: number) => any = x => { // should be (x: number) => Base ->f9 : Symbol(f9, Decl(functionImplementations.ts, 138, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 138, 9)) ->x : Symbol(x, Decl(functionImplementations.ts, 138, 28)) +>f9 : Symbol(f9, Decl(functionImplementations.ts, 139, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 139, 9)) +>x : Symbol(x, Decl(functionImplementations.ts, 139, 28)) return new Base(); ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) return new Derived(); ->Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25)) +>Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) return new Derived2(); ->Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1)) +>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 124, 1)) } var f10: (x: number) => any = x => { // should be (x: number) => Derived | Derived1 ->f10 : Symbol(f10, Decl(functionImplementations.ts, 143, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 143, 10)) ->x : Symbol(x, Decl(functionImplementations.ts, 143, 29)) +>f10 : Symbol(f10, Decl(functionImplementations.ts, 144, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 144, 10)) +>x : Symbol(x, Decl(functionImplementations.ts, 144, 29)) return new Derived(); ->Derived : Symbol(Derived, Decl(functionImplementations.ts, 76, 25)) +>Derived : Symbol(Derived, Decl(functionImplementations.ts, 77, 25)) return new Derived2(); ->Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 123, 1)) +>Derived2 : Symbol(Derived2, Decl(functionImplementations.ts, 124, 1)) } var f11: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass ->f11 : Symbol(f11, Decl(functionImplementations.ts, 147, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 147, 10)) ->x : Symbol(x, Decl(functionImplementations.ts, 147, 29)) +>f11 : Symbol(f11, Decl(functionImplementations.ts, 148, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 148, 10)) +>x : Symbol(x, Decl(functionImplementations.ts, 148, 29)) return new Base(); ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) return new AnotherClass(); ->AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50)) +>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 126, 50)) } var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherClass ->f12 : Symbol(f12, Decl(functionImplementations.ts, 151, 3)) ->x : Symbol(x, Decl(functionImplementations.ts, 151, 10)) ->x : Symbol(x, Decl(functionImplementations.ts, 151, 29)) +>f12 : Symbol(f12, Decl(functionImplementations.ts, 152, 3)) +>x : Symbol(x, Decl(functionImplementations.ts, 152, 10)) +>x : Symbol(x, Decl(functionImplementations.ts, 152, 29)) return new Base(); ->Base : Symbol(Base, Decl(functionImplementations.ts, 69, 4)) +>Base : Symbol(Base, Decl(functionImplementations.ts, 70, 4)) return; // should be ignored return new AnotherClass(); ->AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 125, 50)) +>AnotherClass : Symbol(AnotherClass, Decl(functionImplementations.ts, 126, 50)) } diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types index 1398e2974f0..6690ca68c98 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -1,4 +1,5 @@ === tests/cases/conformance/functions/functionImplementations.ts === + // FunctionExpression with no return type annotation and no return statement returns void var v: void = function () { } (); >v : void diff --git a/tests/baselines/reference/functionOverloads12.js b/tests/baselines/reference/functionOverloads12.js index 4681e43ee5b..8d834e8180f 100644 --- a/tests/baselines/reference/functionOverloads12.js +++ b/tests/baselines/reference/functionOverloads12.js @@ -1,4 +1,5 @@ //// [functionOverloads12.ts] + function foo():string; function foo():number; function foo():any { if (true) return ""; else return 0;} diff --git a/tests/baselines/reference/functionOverloads12.symbols b/tests/baselines/reference/functionOverloads12.symbols index 583e7f5c045..4744f98c9f2 100644 --- a/tests/baselines/reference/functionOverloads12.symbols +++ b/tests/baselines/reference/functionOverloads12.symbols @@ -1,10 +1,11 @@ === tests/cases/compiler/functionOverloads12.ts === + function foo():string; ->foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22)) +>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 1, 22), Decl(functionOverloads12.ts, 2, 22)) function foo():number; ->foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22)) +>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 1, 22), Decl(functionOverloads12.ts, 2, 22)) function foo():any { if (true) return ""; else return 0;} ->foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 0, 22), Decl(functionOverloads12.ts, 1, 22)) +>foo : Symbol(foo, Decl(functionOverloads12.ts, 0, 0), Decl(functionOverloads12.ts, 1, 22), Decl(functionOverloads12.ts, 2, 22)) diff --git a/tests/baselines/reference/functionOverloads12.types b/tests/baselines/reference/functionOverloads12.types index 20f5ee5d556..5db8ff68cd4 100644 --- a/tests/baselines/reference/functionOverloads12.types +++ b/tests/baselines/reference/functionOverloads12.types @@ -1,4 +1,5 @@ === tests/cases/compiler/functionOverloads12.ts === + function foo():string; >foo : { (): string; (): number; } diff --git a/tests/baselines/reference/functionReturn.js b/tests/baselines/reference/functionReturn.js index c433eec190d..42d0de5fd7c 100644 --- a/tests/baselines/reference/functionReturn.js +++ b/tests/baselines/reference/functionReturn.js @@ -1,4 +1,5 @@ //// [functionReturn.ts] + function f0(): void { } function f1() { var n: any = f0(); diff --git a/tests/baselines/reference/functionReturn.symbols b/tests/baselines/reference/functionReturn.symbols index 9c6b794b3d0..630e435635b 100644 --- a/tests/baselines/reference/functionReturn.symbols +++ b/tests/baselines/reference/functionReturn.symbols @@ -1,28 +1,29 @@ === tests/cases/compiler/functionReturn.ts === + function f0(): void { } >f0 : Symbol(f0, Decl(functionReturn.ts, 0, 0)) function f1() { ->f1 : Symbol(f1, Decl(functionReturn.ts, 0, 23)) +>f1 : Symbol(f1, Decl(functionReturn.ts, 1, 23)) var n: any = f0(); ->n : Symbol(n, Decl(functionReturn.ts, 2, 7)) +>n : Symbol(n, Decl(functionReturn.ts, 3, 7)) >f0 : Symbol(f0, Decl(functionReturn.ts, 0, 0)) } function f2(): any { } ->f2 : Symbol(f2, Decl(functionReturn.ts, 3, 1)) +>f2 : Symbol(f2, Decl(functionReturn.ts, 4, 1)) function f3(): string { return; } ->f3 : Symbol(f3, Decl(functionReturn.ts, 4, 22)) +>f3 : Symbol(f3, Decl(functionReturn.ts, 5, 22)) function f4(): string { ->f4 : Symbol(f4, Decl(functionReturn.ts, 5, 33)) +>f4 : Symbol(f4, Decl(functionReturn.ts, 6, 33)) return ''; return; } function f5(): string { ->f5 : Symbol(f5, Decl(functionReturn.ts, 9, 1)) +>f5 : Symbol(f5, Decl(functionReturn.ts, 10, 1)) return ''; return undefined; diff --git a/tests/baselines/reference/functionReturn.types b/tests/baselines/reference/functionReturn.types index 6fc9d680db9..f9c0b36fbc2 100644 --- a/tests/baselines/reference/functionReturn.types +++ b/tests/baselines/reference/functionReturn.types @@ -1,4 +1,5 @@ === tests/cases/compiler/functionReturn.ts === + function f0(): void { } >f0 : () => void diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt index 8a57d8e08e6..a981d337093 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt +++ b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt @@ -1,15 +1,16 @@ -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(4,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(12,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(22,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(31,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(43,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(48,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,10): 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(5,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(13,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(23,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(32,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(44,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(49,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(57,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(57,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(57,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 diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements.js b/tests/baselines/reference/functionWithMultipleReturnStatements.js index 347a05d0f33..d44c37ebbf0 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements.js +++ b/tests/baselines/reference/functionWithMultipleReturnStatements.js @@ -1,4 +1,5 @@ //// [functionWithMultipleReturnStatements.ts] + // 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 diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt b/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt index bbaa5a85578..0399c7a79a6 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt +++ b/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt @@ -1,8 +1,9 @@ -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(58,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(67,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(59,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(68,10): error TS2354: No best common type exists among return expressions. ==== tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts (2 errors) ==== + // return type of a function with multiple returns is the BCT of each return statement // no errors expected here diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements2.js b/tests/baselines/reference/functionWithMultipleReturnStatements2.js index 4674c6db953..efee5816fb6 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements2.js +++ b/tests/baselines/reference/functionWithMultipleReturnStatements2.js @@ -1,4 +1,5 @@ //// [functionWithMultipleReturnStatements2.ts] + // return type of a function with multiple returns is the BCT of each return statement // no errors expected here diff --git a/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt b/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt index 3c8fef3eb49..86234b7dd81 100644 --- a/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt +++ b/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/functionWithNoBestCommonType1.ts(1,10): error TS2354: No best common type exists among return expressions. +tests/cases/compiler/functionWithNoBestCommonType1.ts(2,10): error TS2354: No best common type exists among return expressions. ==== tests/cases/compiler/functionWithNoBestCommonType1.ts (1 errors) ==== + function foo() { ~~~ !!! error TS2354: No best common type exists among return expressions. diff --git a/tests/baselines/reference/functionWithNoBestCommonType1.js b/tests/baselines/reference/functionWithNoBestCommonType1.js index f7114fb40d8..4d197c24334 100644 --- a/tests/baselines/reference/functionWithNoBestCommonType1.js +++ b/tests/baselines/reference/functionWithNoBestCommonType1.js @@ -1,4 +1,5 @@ //// [functionWithNoBestCommonType1.ts] + function foo() { return true; return bar(); diff --git a/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt b/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt index 981e330d9b5..6ce898e447c 100644 --- a/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt +++ b/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/functionWithNoBestCommonType2.ts(1,9): error TS2354: No best common type exists among return expressions. +tests/cases/compiler/functionWithNoBestCommonType2.ts(2,9): error TS2354: No best common type exists among return expressions. ==== tests/cases/compiler/functionWithNoBestCommonType2.ts (1 errors) ==== + var v = function () { ~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. diff --git a/tests/baselines/reference/functionWithNoBestCommonType2.js b/tests/baselines/reference/functionWithNoBestCommonType2.js index 8e903518ec0..06a133b2db8 100644 --- a/tests/baselines/reference/functionWithNoBestCommonType2.js +++ b/tests/baselines/reference/functionWithNoBestCommonType2.js @@ -1,4 +1,5 @@ //// [functionWithNoBestCommonType2.ts] + var v = function () { return true; return bar(); diff --git a/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt b/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt deleted file mode 100644 index 72f45da8d97..00000000000 --- a/tests/baselines/reference/functionWithThrowButNoReturn1.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -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 { - ~~~~~~ -!!! 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; - } - \ No newline at end of file diff --git a/tests/baselines/reference/functionWithThrowButNoReturn1.symbols b/tests/baselines/reference/functionWithThrowButNoReturn1.symbols new file mode 100644 index 00000000000..ebc67c6f466 --- /dev/null +++ b/tests/baselines/reference/functionWithThrowButNoReturn1.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/functionWithThrowButNoReturn1.ts === +function fn(): number { +>fn : Symbol(fn, Decl(functionWithThrowButNoReturn1.ts, 0, 0)) + + throw new Error('NYI'); +>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + var t; +>t : Symbol(t, Decl(functionWithThrowButNoReturn1.ts, 2, 5)) +} + diff --git a/tests/baselines/reference/functionWithThrowButNoReturn1.types b/tests/baselines/reference/functionWithThrowButNoReturn1.types new file mode 100644 index 00000000000..c136d8a4076 --- /dev/null +++ b/tests/baselines/reference/functionWithThrowButNoReturn1.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/functionWithThrowButNoReturn1.ts === +function fn(): number { +>fn : () => number + + throw new Error('NYI'); +>new Error('NYI') : Error +>Error : ErrorConstructor +>'NYI' : string + + var t; +>t : any +} + diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt index 2c5ff15f863..58ffd051d4d 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt @@ -1,15 +1,14 @@ -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(117,5): error TS1003: Identifier expected. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(3,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(95,16): error TS2378: A 'get' accessor must return a value. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(118,5): error TS1003: Identifier expected. -==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (5 errors) ==== +==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (3 errors) ==== + function f1(): string { ~~~~~~ -!!! error TS2355: 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. // errors because there are no return statements } @@ -72,8 +71,6 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): e } function f14(): number { - ~~~~~~ -!!! 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; @@ -105,7 +102,7 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): e class C { public get m1() { ~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. // Errors; get accessors must return a value. } @@ -124,8 +121,6 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): e } public get m5() { - ~~ -!!! 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; diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js index 592a03d7158..f76e5342aee 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js @@ -1,5 +1,6 @@ //// [functionsMissingReturnStatementsAndExpressions.ts] + function f1(): string { // errors because there are no return statements } diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 1f7d2b8035f..a867d4b7629 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -1,4 +1,5 @@ //// [generatedContextualTyping.ts] + class Base { private p; } class Derived1 extends Base { private m; } class Derived2 extends Base { private n; } diff --git a/tests/baselines/reference/generatedContextualTyping.symbols b/tests/baselines/reference/generatedContextualTyping.symbols index df0bb33e02f..bc50fcc25c6 100644 --- a/tests/baselines/reference/generatedContextualTyping.symbols +++ b/tests/baselines/reference/generatedContextualTyping.symbols @@ -1,2831 +1,2832 @@ === tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts === + class Base { private p; } >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->p : Symbol(p, Decl(generatedContextualTyping.ts, 0, 12)) +>p : Symbol(p, Decl(generatedContextualTyping.ts, 1, 12)) class Derived1 extends Base { private m; } ->Derived1 : Symbol(Derived1, Decl(generatedContextualTyping.ts, 0, 25)) +>Derived1 : Symbol(Derived1, Decl(generatedContextualTyping.ts, 1, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->m : Symbol(m, Decl(generatedContextualTyping.ts, 1, 29)) +>m : Symbol(m, Decl(generatedContextualTyping.ts, 2, 29)) class Derived2 extends Base { private n; } ->Derived2 : Symbol(Derived2, Decl(generatedContextualTyping.ts, 1, 42)) +>Derived2 : Symbol(Derived2, Decl(generatedContextualTyping.ts, 2, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 2, 29)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 3, 29)) interface Genric { func(n: T[]); } ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) ->T : Symbol(T, Decl(generatedContextualTyping.ts, 3, 17)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 3, 21)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 3, 27)) ->T : Symbol(T, Decl(generatedContextualTyping.ts, 3, 17)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) +>T : Symbol(T, Decl(generatedContextualTyping.ts, 4, 17)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 4, 21)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 4, 27)) +>T : Symbol(T, Decl(generatedContextualTyping.ts, 4, 17)) var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); ->b : Symbol(b, Decl(generatedContextualTyping.ts, 4, 3)) +>b : Symbol(b, Decl(generatedContextualTyping.ts, 5, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->Derived1 : Symbol(Derived1, Decl(generatedContextualTyping.ts, 0, 25)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->Derived2 : Symbol(Derived2, Decl(generatedContextualTyping.ts, 1, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>Derived1 : Symbol(Derived1, Decl(generatedContextualTyping.ts, 1, 25)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>Derived2 : Symbol(Derived2, Decl(generatedContextualTyping.ts, 2, 42)) var x1: () => Base[] = () => [d1, d2]; ->x1 : Symbol(x1, Decl(generatedContextualTyping.ts, 5, 3)) +>x1 : Symbol(x1, Decl(generatedContextualTyping.ts, 6, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x2: () => Base[] = function() { return [d1, d2] }; ->x2 : Symbol(x2, Decl(generatedContextualTyping.ts, 6, 3)) +>x2 : Symbol(x2, Decl(generatedContextualTyping.ts, 7, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x3: () => Base[] = function named() { return [d1, d2] }; ->x3 : Symbol(x3, Decl(generatedContextualTyping.ts, 7, 3)) +>x3 : Symbol(x3, Decl(generatedContextualTyping.ts, 8, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 7, 22)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 8, 22)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x4: { (): Base[]; } = () => [d1, d2]; ->x4 : Symbol(x4, Decl(generatedContextualTyping.ts, 8, 3)) +>x4 : Symbol(x4, Decl(generatedContextualTyping.ts, 9, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x5: { (): Base[]; } = function() { return [d1, d2] }; ->x5 : Symbol(x5, Decl(generatedContextualTyping.ts, 9, 3)) +>x5 : Symbol(x5, Decl(generatedContextualTyping.ts, 10, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x6: { (): Base[]; } = function named() { return [d1, d2] }; ->x6 : Symbol(x6, Decl(generatedContextualTyping.ts, 10, 3)) +>x6 : Symbol(x6, Decl(generatedContextualTyping.ts, 11, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 10, 25)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 11, 25)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x7: Base[] = [d1, d2]; ->x7 : Symbol(x7, Decl(generatedContextualTyping.ts, 11, 3)) +>x7 : Symbol(x7, Decl(generatedContextualTyping.ts, 12, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x8: Array = [d1, d2]; ->x8 : Symbol(x8, Decl(generatedContextualTyping.ts, 12, 3)) +>x8 : Symbol(x8, Decl(generatedContextualTyping.ts, 13, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x9: { [n: number]: Base; } = [d1, d2]; ->x9 : Symbol(x9, Decl(generatedContextualTyping.ts, 13, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 13, 11)) +>x9 : Symbol(x9, Decl(generatedContextualTyping.ts, 14, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 14, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x10: {n: Base[]; } = { n: [d1, d2] }; ->x10 : Symbol(x10, Decl(generatedContextualTyping.ts, 14, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 14, 10)) +>x10 : Symbol(x10, Decl(generatedContextualTyping.ts, 15, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 15, 10)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 14, 27)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 15, 27)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x11: (s: Base[]) => any = n => { var n: Base[]; return null; }; ->x11 : Symbol(x11, Decl(generatedContextualTyping.ts, 15, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 15, 10)) +>x11 : Symbol(x11, Decl(generatedContextualTyping.ts, 16, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 16, 10)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 15, 29), Decl(generatedContextualTyping.ts, 15, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 15, 29), Decl(generatedContextualTyping.ts, 15, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 16, 29), Decl(generatedContextualTyping.ts, 16, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 16, 29), Decl(generatedContextualTyping.ts, 16, 40)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x12: Genric = { func: n => { return [d1, d2]; } }; ->x12 : Symbol(x12, Decl(generatedContextualTyping.ts, 16, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x12 : Symbol(x12, Decl(generatedContextualTyping.ts, 17, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 16, 25)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 16, 31)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 17, 25)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 17, 31)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x13 { member: () => Base[] = () => [d1, d2] } ->x13 : Symbol(x13, Decl(generatedContextualTyping.ts, 16, 60)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 17, 11)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x14 { member: () => Base[] = function() { return [d1, d2] } } ->x14 : Symbol(x14, Decl(generatedContextualTyping.ts, 17, 51)) +>x13 : Symbol(x13, Decl(generatedContextualTyping.ts, 17, 60)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 18, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x15 { member: () => Base[] = function named() { return [d1, d2] } } ->x15 : Symbol(x15, Decl(generatedContextualTyping.ts, 18, 67)) +class x14 { member: () => Base[] = function() { return [d1, d2] } } +>x14 : Symbol(x14, Decl(generatedContextualTyping.ts, 18, 51)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 19, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 19, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x16 { member: { (): Base[]; } = () => [d1, d2] } ->x16 : Symbol(x16, Decl(generatedContextualTyping.ts, 19, 73)) +class x15 { member: () => Base[] = function named() { return [d1, d2] } } +>x15 : Symbol(x15, Decl(generatedContextualTyping.ts, 19, 67)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 20, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 20, 34)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x17 { member: { (): Base[]; } = function() { return [d1, d2] } } ->x17 : Symbol(x17, Decl(generatedContextualTyping.ts, 20, 54)) +class x16 { member: { (): Base[]; } = () => [d1, d2] } +>x16 : Symbol(x16, Decl(generatedContextualTyping.ts, 20, 73)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 21, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } ->x18 : Symbol(x18, Decl(generatedContextualTyping.ts, 21, 70)) +class x17 { member: { (): Base[]; } = function() { return [d1, d2] } } +>x17 : Symbol(x17, Decl(generatedContextualTyping.ts, 21, 54)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 22, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 22, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x19 { member: Base[] = [d1, d2] } ->x19 : Symbol(x19, Decl(generatedContextualTyping.ts, 22, 76)) +class x18 { member: { (): Base[]; } = function named() { return [d1, d2] } } +>x18 : Symbol(x18, Decl(generatedContextualTyping.ts, 22, 70)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 23, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 23, 37)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x19 { member: Base[] = [d1, d2] } +>x19 : Symbol(x19, Decl(generatedContextualTyping.ts, 23, 76)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 24, 11)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x20 { member: Array = [d1, d2] } ->x20 : Symbol(x20, Decl(generatedContextualTyping.ts, 23, 39)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 24, 11)) +>x20 : Symbol(x20, Decl(generatedContextualTyping.ts, 24, 39)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 25, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x21 { member: { [n: number]: Base; } = [d1, d2] } ->x21 : Symbol(x21, Decl(generatedContextualTyping.ts, 24, 44)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 25, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 25, 23)) +>x21 : Symbol(x21, Decl(generatedContextualTyping.ts, 25, 44)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 26, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 26, 23)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x22 { member: {n: Base[]; } = { n: [d1, d2] } } ->x22 : Symbol(x22, Decl(generatedContextualTyping.ts, 25, 55)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 26, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 26, 21)) +>x22 : Symbol(x22, Decl(generatedContextualTyping.ts, 26, 55)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 27, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 26, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x23 { member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x23 : Symbol(x23, Decl(generatedContextualTyping.ts, 26, 54)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 27, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 27, 21)) +>x23 : Symbol(x23, Decl(generatedContextualTyping.ts, 27, 54)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 28, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 28, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 40), Decl(generatedContextualTyping.ts, 27, 51)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 27, 40), Decl(generatedContextualTyping.ts, 27, 51)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 28, 40), Decl(generatedContextualTyping.ts, 28, 51)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 28, 40), Decl(generatedContextualTyping.ts, 28, 51)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x24 { member: Genric = { func: n => { return [d1, d2]; } } } ->x24 : Symbol(x24, Decl(generatedContextualTyping.ts, 27, 79)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 28, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x24 : Symbol(x24, Decl(generatedContextualTyping.ts, 28, 79)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 29, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 28, 36)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 28, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 29, 36)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 29, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x25 { private member: () => Base[] = () => [d1, d2] } ->x25 : Symbol(x25, Decl(generatedContextualTyping.ts, 28, 72)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 29, 11)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x26 { private member: () => Base[] = function() { return [d1, d2] } } ->x26 : Symbol(x26, Decl(generatedContextualTyping.ts, 29, 59)) +>x25 : Symbol(x25, Decl(generatedContextualTyping.ts, 29, 72)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 30, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x27 { private member: () => Base[] = function named() { return [d1, d2] } } ->x27 : Symbol(x27, Decl(generatedContextualTyping.ts, 30, 75)) +class x26 { private member: () => Base[] = function() { return [d1, d2] } } +>x26 : Symbol(x26, Decl(generatedContextualTyping.ts, 30, 59)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 31, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 31, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x28 { private member: { (): Base[]; } = () => [d1, d2] } ->x28 : Symbol(x28, Decl(generatedContextualTyping.ts, 31, 81)) +class x27 { private member: () => Base[] = function named() { return [d1, d2] } } +>x27 : Symbol(x27, Decl(generatedContextualTyping.ts, 31, 75)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 32, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 32, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x29 { private member: { (): Base[]; } = function() { return [d1, d2] } } ->x29 : Symbol(x29, Decl(generatedContextualTyping.ts, 32, 62)) +class x28 { private member: { (): Base[]; } = () => [d1, d2] } +>x28 : Symbol(x28, Decl(generatedContextualTyping.ts, 32, 81)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 33, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] } } ->x30 : Symbol(x30, Decl(generatedContextualTyping.ts, 33, 78)) +class x29 { private member: { (): Base[]; } = function() { return [d1, d2] } } +>x29 : Symbol(x29, Decl(generatedContextualTyping.ts, 33, 62)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 34, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 34, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x31 { private member: Base[] = [d1, d2] } ->x31 : Symbol(x31, Decl(generatedContextualTyping.ts, 34, 84)) +class x30 { private member: { (): Base[]; } = function named() { return [d1, d2] } } +>x30 : Symbol(x30, Decl(generatedContextualTyping.ts, 34, 78)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 35, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 35, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x31 { private member: Base[] = [d1, d2] } +>x31 : Symbol(x31, Decl(generatedContextualTyping.ts, 35, 84)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 36, 11)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x32 { private member: Array = [d1, d2] } ->x32 : Symbol(x32, Decl(generatedContextualTyping.ts, 35, 47)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 36, 11)) +>x32 : Symbol(x32, Decl(generatedContextualTyping.ts, 36, 47)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 37, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x33 { private member: { [n: number]: Base; } = [d1, d2] } ->x33 : Symbol(x33, Decl(generatedContextualTyping.ts, 36, 52)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 37, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 37, 31)) +>x33 : Symbol(x33, Decl(generatedContextualTyping.ts, 37, 52)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 38, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 38, 31)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x34 { private member: {n: Base[]; } = { n: [d1, d2] } } ->x34 : Symbol(x34, Decl(generatedContextualTyping.ts, 37, 63)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 38, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 38, 29)) +>x34 : Symbol(x34, Decl(generatedContextualTyping.ts, 38, 63)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 39, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 38, 46)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 46)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x35 { private member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x35 : Symbol(x35, Decl(generatedContextualTyping.ts, 38, 62)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 39, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 39, 29)) +>x35 : Symbol(x35, Decl(generatedContextualTyping.ts, 39, 62)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 40, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 40, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 48), Decl(generatedContextualTyping.ts, 39, 59)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 39, 48), Decl(generatedContextualTyping.ts, 39, 59)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 40, 48), Decl(generatedContextualTyping.ts, 40, 59)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 40, 48), Decl(generatedContextualTyping.ts, 40, 59)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x36 { private member: Genric = { func: n => { return [d1, d2]; } } } ->x36 : Symbol(x36, Decl(generatedContextualTyping.ts, 39, 87)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 40, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x36 : Symbol(x36, Decl(generatedContextualTyping.ts, 40, 87)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 41, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 40, 44)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 40, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 41, 44)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 41, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x37 { public member: () => Base[] = () => [d1, d2] } ->x37 : Symbol(x37, Decl(generatedContextualTyping.ts, 40, 80)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 41, 11)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x38 { public member: () => Base[] = function() { return [d1, d2] } } ->x38 : Symbol(x38, Decl(generatedContextualTyping.ts, 41, 58)) +>x37 : Symbol(x37, Decl(generatedContextualTyping.ts, 41, 80)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 42, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x39 { public member: () => Base[] = function named() { return [d1, d2] } } ->x39 : Symbol(x39, Decl(generatedContextualTyping.ts, 42, 74)) +class x38 { public member: () => Base[] = function() { return [d1, d2] } } +>x38 : Symbol(x38, Decl(generatedContextualTyping.ts, 42, 58)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 43, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 43, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x40 { public member: { (): Base[]; } = () => [d1, d2] } ->x40 : Symbol(x40, Decl(generatedContextualTyping.ts, 43, 80)) +class x39 { public member: () => Base[] = function named() { return [d1, d2] } } +>x39 : Symbol(x39, Decl(generatedContextualTyping.ts, 43, 74)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 44, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 44, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x41 { public member: { (): Base[]; } = function() { return [d1, d2] } } ->x41 : Symbol(x41, Decl(generatedContextualTyping.ts, 44, 61)) +class x40 { public member: { (): Base[]; } = () => [d1, d2] } +>x40 : Symbol(x40, Decl(generatedContextualTyping.ts, 44, 80)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 45, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] } } ->x42 : Symbol(x42, Decl(generatedContextualTyping.ts, 45, 77)) +class x41 { public member: { (): Base[]; } = function() { return [d1, d2] } } +>x41 : Symbol(x41, Decl(generatedContextualTyping.ts, 45, 61)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 46, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 46, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x43 { public member: Base[] = [d1, d2] } ->x43 : Symbol(x43, Decl(generatedContextualTyping.ts, 46, 83)) +class x42 { public member: { (): Base[]; } = function named() { return [d1, d2] } } +>x42 : Symbol(x42, Decl(generatedContextualTyping.ts, 46, 77)) >member : Symbol(member, Decl(generatedContextualTyping.ts, 47, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 47, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x43 { public member: Base[] = [d1, d2] } +>x43 : Symbol(x43, Decl(generatedContextualTyping.ts, 47, 83)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 48, 11)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x44 { public member: Array = [d1, d2] } ->x44 : Symbol(x44, Decl(generatedContextualTyping.ts, 47, 46)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 48, 11)) +>x44 : Symbol(x44, Decl(generatedContextualTyping.ts, 48, 46)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 49, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x45 { public member: { [n: number]: Base; } = [d1, d2] } ->x45 : Symbol(x45, Decl(generatedContextualTyping.ts, 48, 51)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 49, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 49, 30)) +>x45 : Symbol(x45, Decl(generatedContextualTyping.ts, 49, 51)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 50, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 50, 30)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x46 { public member: {n: Base[]; } = { n: [d1, d2] } } ->x46 : Symbol(x46, Decl(generatedContextualTyping.ts, 49, 62)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 50, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 50, 28)) +>x46 : Symbol(x46, Decl(generatedContextualTyping.ts, 50, 62)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 51, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 50, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x47 { public member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x47 : Symbol(x47, Decl(generatedContextualTyping.ts, 50, 61)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 51, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 51, 28)) +>x47 : Symbol(x47, Decl(generatedContextualTyping.ts, 51, 61)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 52, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 52, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 47), Decl(generatedContextualTyping.ts, 51, 58)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 51, 47), Decl(generatedContextualTyping.ts, 51, 58)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 52, 47), Decl(generatedContextualTyping.ts, 52, 58)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 52, 47), Decl(generatedContextualTyping.ts, 52, 58)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x48 { public member: Genric = { func: n => { return [d1, d2]; } } } ->x48 : Symbol(x48, Decl(generatedContextualTyping.ts, 51, 86)) ->member : Symbol(member, Decl(generatedContextualTyping.ts, 52, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x48 : Symbol(x48, Decl(generatedContextualTyping.ts, 52, 86)) +>member : Symbol(member, Decl(generatedContextualTyping.ts, 53, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 52, 43)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 52, 49)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 53, 43)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 53, 49)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x49 { static member: () => Base[] = () => [d1, d2] } ->x49 : Symbol(x49, Decl(generatedContextualTyping.ts, 52, 79)) ->member : Symbol(x49.member, Decl(generatedContextualTyping.ts, 53, 11)) +>x49 : Symbol(x49, Decl(generatedContextualTyping.ts, 53, 79)) +>member : Symbol(x49.member, Decl(generatedContextualTyping.ts, 54, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x50 { static member: () => Base[] = function() { return [d1, d2] } } ->x50 : Symbol(x50, Decl(generatedContextualTyping.ts, 53, 58)) ->member : Symbol(x50.member, Decl(generatedContextualTyping.ts, 54, 11)) +>x50 : Symbol(x50, Decl(generatedContextualTyping.ts, 54, 58)) +>member : Symbol(x50.member, Decl(generatedContextualTyping.ts, 55, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x51 { static member: () => Base[] = function named() { return [d1, d2] } } ->x51 : Symbol(x51, Decl(generatedContextualTyping.ts, 54, 74)) ->member : Symbol(x51.member, Decl(generatedContextualTyping.ts, 55, 11)) +>x51 : Symbol(x51, Decl(generatedContextualTyping.ts, 55, 74)) +>member : Symbol(x51.member, Decl(generatedContextualTyping.ts, 56, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 55, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 56, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x52 { static member: { (): Base[]; } = () => [d1, d2] } ->x52 : Symbol(x52, Decl(generatedContextualTyping.ts, 55, 80)) ->member : Symbol(x52.member, Decl(generatedContextualTyping.ts, 56, 11)) +>x52 : Symbol(x52, Decl(generatedContextualTyping.ts, 56, 80)) +>member : Symbol(x52.member, Decl(generatedContextualTyping.ts, 57, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x53 { static member: { (): Base[]; } = function() { return [d1, d2] } } ->x53 : Symbol(x53, Decl(generatedContextualTyping.ts, 56, 61)) ->member : Symbol(x53.member, Decl(generatedContextualTyping.ts, 57, 11)) +>x53 : Symbol(x53, Decl(generatedContextualTyping.ts, 57, 61)) +>member : Symbol(x53.member, Decl(generatedContextualTyping.ts, 58, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x54 { static member: { (): Base[]; } = function named() { return [d1, d2] } } ->x54 : Symbol(x54, Decl(generatedContextualTyping.ts, 57, 77)) ->member : Symbol(x54.member, Decl(generatedContextualTyping.ts, 58, 11)) +>x54 : Symbol(x54, Decl(generatedContextualTyping.ts, 58, 77)) +>member : Symbol(x54.member, Decl(generatedContextualTyping.ts, 59, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 58, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 59, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x55 { static member: Base[] = [d1, d2] } ->x55 : Symbol(x55, Decl(generatedContextualTyping.ts, 58, 83)) ->member : Symbol(x55.member, Decl(generatedContextualTyping.ts, 59, 11)) +>x55 : Symbol(x55, Decl(generatedContextualTyping.ts, 59, 83)) +>member : Symbol(x55.member, Decl(generatedContextualTyping.ts, 60, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x56 { static member: Array = [d1, d2] } ->x56 : Symbol(x56, Decl(generatedContextualTyping.ts, 59, 46)) ->member : Symbol(x56.member, Decl(generatedContextualTyping.ts, 60, 11)) +>x56 : Symbol(x56, Decl(generatedContextualTyping.ts, 60, 46)) +>member : Symbol(x56.member, Decl(generatedContextualTyping.ts, 61, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x57 { static member: { [n: number]: Base; } = [d1, d2] } ->x57 : Symbol(x57, Decl(generatedContextualTyping.ts, 60, 51)) ->member : Symbol(x57.member, Decl(generatedContextualTyping.ts, 61, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 61, 30)) +>x57 : Symbol(x57, Decl(generatedContextualTyping.ts, 61, 51)) +>member : Symbol(x57.member, Decl(generatedContextualTyping.ts, 62, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 62, 30)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x58 { static member: {n: Base[]; } = { n: [d1, d2] } } ->x58 : Symbol(x58, Decl(generatedContextualTyping.ts, 61, 62)) ->member : Symbol(x58.member, Decl(generatedContextualTyping.ts, 62, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 62, 28)) +>x58 : Symbol(x58, Decl(generatedContextualTyping.ts, 62, 62)) +>member : Symbol(x58.member, Decl(generatedContextualTyping.ts, 63, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 63, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 62, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 63, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x59 { static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x59 : Symbol(x59, Decl(generatedContextualTyping.ts, 62, 61)) ->member : Symbol(x59.member, Decl(generatedContextualTyping.ts, 63, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 63, 28)) +>x59 : Symbol(x59, Decl(generatedContextualTyping.ts, 63, 61)) +>member : Symbol(x59.member, Decl(generatedContextualTyping.ts, 64, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 64, 28)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 63, 47), Decl(generatedContextualTyping.ts, 63, 58)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 63, 47), Decl(generatedContextualTyping.ts, 63, 58)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 64, 47), Decl(generatedContextualTyping.ts, 64, 58)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 64, 47), Decl(generatedContextualTyping.ts, 64, 58)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x60 { static member: Genric = { func: n => { return [d1, d2]; } } } ->x60 : Symbol(x60, Decl(generatedContextualTyping.ts, 63, 86)) ->member : Symbol(x60.member, Decl(generatedContextualTyping.ts, 64, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x60 : Symbol(x60, Decl(generatedContextualTyping.ts, 64, 86)) +>member : Symbol(x60.member, Decl(generatedContextualTyping.ts, 65, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 64, 43)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 64, 49)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 65, 43)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 65, 49)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x61 { private static member: () => Base[] = () => [d1, d2] } ->x61 : Symbol(x61, Decl(generatedContextualTyping.ts, 64, 79)) ->member : Symbol(x61.member, Decl(generatedContextualTyping.ts, 65, 11)) +>x61 : Symbol(x61, Decl(generatedContextualTyping.ts, 65, 79)) +>member : Symbol(x61.member, Decl(generatedContextualTyping.ts, 66, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x62 { private static member: () => Base[] = function() { return [d1, d2] } } ->x62 : Symbol(x62, Decl(generatedContextualTyping.ts, 65, 66)) ->member : Symbol(x62.member, Decl(generatedContextualTyping.ts, 66, 11)) +>x62 : Symbol(x62, Decl(generatedContextualTyping.ts, 66, 66)) +>member : Symbol(x62.member, Decl(generatedContextualTyping.ts, 67, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x63 { private static member: () => Base[] = function named() { return [d1, d2] } } ->x63 : Symbol(x63, Decl(generatedContextualTyping.ts, 66, 82)) ->member : Symbol(x63.member, Decl(generatedContextualTyping.ts, 67, 11)) +>x63 : Symbol(x63, Decl(generatedContextualTyping.ts, 67, 82)) +>member : Symbol(x63.member, Decl(generatedContextualTyping.ts, 68, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 67, 49)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 68, 49)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x64 { private static member: { (): Base[]; } = () => [d1, d2] } ->x64 : Symbol(x64, Decl(generatedContextualTyping.ts, 67, 88)) ->member : Symbol(x64.member, Decl(generatedContextualTyping.ts, 68, 11)) +>x64 : Symbol(x64, Decl(generatedContextualTyping.ts, 68, 88)) +>member : Symbol(x64.member, Decl(generatedContextualTyping.ts, 69, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x65 { private static member: { (): Base[]; } = function() { return [d1, d2] } } ->x65 : Symbol(x65, Decl(generatedContextualTyping.ts, 68, 69)) ->member : Symbol(x65.member, Decl(generatedContextualTyping.ts, 69, 11)) +>x65 : Symbol(x65, Decl(generatedContextualTyping.ts, 69, 69)) +>member : Symbol(x65.member, Decl(generatedContextualTyping.ts, 70, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x66 { private static member: { (): Base[]; } = function named() { return [d1, d2] } } ->x66 : Symbol(x66, Decl(generatedContextualTyping.ts, 69, 85)) ->member : Symbol(x66.member, Decl(generatedContextualTyping.ts, 70, 11)) +>x66 : Symbol(x66, Decl(generatedContextualTyping.ts, 70, 85)) +>member : Symbol(x66.member, Decl(generatedContextualTyping.ts, 71, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 70, 52)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 71, 52)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x67 { private static member: Base[] = [d1, d2] } ->x67 : Symbol(x67, Decl(generatedContextualTyping.ts, 70, 91)) ->member : Symbol(x67.member, Decl(generatedContextualTyping.ts, 71, 11)) +>x67 : Symbol(x67, Decl(generatedContextualTyping.ts, 71, 91)) +>member : Symbol(x67.member, Decl(generatedContextualTyping.ts, 72, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x68 { private static member: Array = [d1, d2] } ->x68 : Symbol(x68, Decl(generatedContextualTyping.ts, 71, 54)) ->member : Symbol(x68.member, Decl(generatedContextualTyping.ts, 72, 11)) +>x68 : Symbol(x68, Decl(generatedContextualTyping.ts, 72, 54)) +>member : Symbol(x68.member, Decl(generatedContextualTyping.ts, 73, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x69 { private static member: { [n: number]: Base; } = [d1, d2] } ->x69 : Symbol(x69, Decl(generatedContextualTyping.ts, 72, 59)) ->member : Symbol(x69.member, Decl(generatedContextualTyping.ts, 73, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 73, 38)) +>x69 : Symbol(x69, Decl(generatedContextualTyping.ts, 73, 59)) +>member : Symbol(x69.member, Decl(generatedContextualTyping.ts, 74, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 74, 38)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x70 { private static member: {n: Base[]; } = { n: [d1, d2] } } ->x70 : Symbol(x70, Decl(generatedContextualTyping.ts, 73, 70)) ->member : Symbol(x70.member, Decl(generatedContextualTyping.ts, 74, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 74, 36)) +>x70 : Symbol(x70, Decl(generatedContextualTyping.ts, 74, 70)) +>member : Symbol(x70.member, Decl(generatedContextualTyping.ts, 75, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 75, 36)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 74, 53)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 75, 53)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x71 { private static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x71 : Symbol(x71, Decl(generatedContextualTyping.ts, 74, 69)) ->member : Symbol(x71.member, Decl(generatedContextualTyping.ts, 75, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 75, 36)) +>x71 : Symbol(x71, Decl(generatedContextualTyping.ts, 75, 69)) +>member : Symbol(x71.member, Decl(generatedContextualTyping.ts, 76, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 76, 36)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 75, 55), Decl(generatedContextualTyping.ts, 75, 66)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 75, 55), Decl(generatedContextualTyping.ts, 75, 66)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 76, 55), Decl(generatedContextualTyping.ts, 76, 66)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 76, 55), Decl(generatedContextualTyping.ts, 76, 66)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x72 { private static member: Genric = { func: n => { return [d1, d2]; } } } ->x72 : Symbol(x72, Decl(generatedContextualTyping.ts, 75, 94)) ->member : Symbol(x72.member, Decl(generatedContextualTyping.ts, 76, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x72 : Symbol(x72, Decl(generatedContextualTyping.ts, 76, 94)) +>member : Symbol(x72.member, Decl(generatedContextualTyping.ts, 77, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 76, 51)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 76, 57)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 77, 51)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 77, 57)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x73 { public static member: () => Base[] = () => [d1, d2] } ->x73 : Symbol(x73, Decl(generatedContextualTyping.ts, 76, 87)) ->member : Symbol(x73.member, Decl(generatedContextualTyping.ts, 77, 11)) +>x73 : Symbol(x73, Decl(generatedContextualTyping.ts, 77, 87)) +>member : Symbol(x73.member, Decl(generatedContextualTyping.ts, 78, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x74 { public static member: () => Base[] = function() { return [d1, d2] } } ->x74 : Symbol(x74, Decl(generatedContextualTyping.ts, 77, 65)) ->member : Symbol(x74.member, Decl(generatedContextualTyping.ts, 78, 11)) +>x74 : Symbol(x74, Decl(generatedContextualTyping.ts, 78, 65)) +>member : Symbol(x74.member, Decl(generatedContextualTyping.ts, 79, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x75 { public static member: () => Base[] = function named() { return [d1, d2] } } ->x75 : Symbol(x75, Decl(generatedContextualTyping.ts, 78, 81)) ->member : Symbol(x75.member, Decl(generatedContextualTyping.ts, 79, 11)) +>x75 : Symbol(x75, Decl(generatedContextualTyping.ts, 79, 81)) +>member : Symbol(x75.member, Decl(generatedContextualTyping.ts, 80, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 79, 48)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 80, 48)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x76 { public static member: { (): Base[]; } = () => [d1, d2] } ->x76 : Symbol(x76, Decl(generatedContextualTyping.ts, 79, 87)) ->member : Symbol(x76.member, Decl(generatedContextualTyping.ts, 80, 11)) +>x76 : Symbol(x76, Decl(generatedContextualTyping.ts, 80, 87)) +>member : Symbol(x76.member, Decl(generatedContextualTyping.ts, 81, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x77 { public static member: { (): Base[]; } = function() { return [d1, d2] } } ->x77 : Symbol(x77, Decl(generatedContextualTyping.ts, 80, 68)) ->member : Symbol(x77.member, Decl(generatedContextualTyping.ts, 81, 11)) +>x77 : Symbol(x77, Decl(generatedContextualTyping.ts, 81, 68)) +>member : Symbol(x77.member, Decl(generatedContextualTyping.ts, 82, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x78 { public static member: { (): Base[]; } = function named() { return [d1, d2] } } ->x78 : Symbol(x78, Decl(generatedContextualTyping.ts, 81, 84)) ->member : Symbol(x78.member, Decl(generatedContextualTyping.ts, 82, 11)) +>x78 : Symbol(x78, Decl(generatedContextualTyping.ts, 82, 84)) +>member : Symbol(x78.member, Decl(generatedContextualTyping.ts, 83, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 82, 51)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 83, 51)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x79 { public static member: Base[] = [d1, d2] } ->x79 : Symbol(x79, Decl(generatedContextualTyping.ts, 82, 90)) ->member : Symbol(x79.member, Decl(generatedContextualTyping.ts, 83, 11)) +>x79 : Symbol(x79, Decl(generatedContextualTyping.ts, 83, 90)) +>member : Symbol(x79.member, Decl(generatedContextualTyping.ts, 84, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x80 { public static member: Array = [d1, d2] } ->x80 : Symbol(x80, Decl(generatedContextualTyping.ts, 83, 53)) ->member : Symbol(x80.member, Decl(generatedContextualTyping.ts, 84, 11)) +>x80 : Symbol(x80, Decl(generatedContextualTyping.ts, 84, 53)) +>member : Symbol(x80.member, Decl(generatedContextualTyping.ts, 85, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x81 { public static member: { [n: number]: Base; } = [d1, d2] } ->x81 : Symbol(x81, Decl(generatedContextualTyping.ts, 84, 58)) ->member : Symbol(x81.member, Decl(generatedContextualTyping.ts, 85, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 85, 37)) +>x81 : Symbol(x81, Decl(generatedContextualTyping.ts, 85, 58)) +>member : Symbol(x81.member, Decl(generatedContextualTyping.ts, 86, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 86, 37)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x82 { public static member: {n: Base[]; } = { n: [d1, d2] } } ->x82 : Symbol(x82, Decl(generatedContextualTyping.ts, 85, 69)) ->member : Symbol(x82.member, Decl(generatedContextualTyping.ts, 86, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 86, 35)) +>x82 : Symbol(x82, Decl(generatedContextualTyping.ts, 86, 69)) +>member : Symbol(x82.member, Decl(generatedContextualTyping.ts, 87, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 87, 35)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 86, 52)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 87, 52)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x83 { public static member: (s: Base[]) => any = n => { var n: Base[]; return null; } } ->x83 : Symbol(x83, Decl(generatedContextualTyping.ts, 86, 68)) ->member : Symbol(x83.member, Decl(generatedContextualTyping.ts, 87, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 87, 35)) +>x83 : Symbol(x83, Decl(generatedContextualTyping.ts, 87, 68)) +>member : Symbol(x83.member, Decl(generatedContextualTyping.ts, 88, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 88, 35)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 87, 54), Decl(generatedContextualTyping.ts, 87, 65)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 87, 54), Decl(generatedContextualTyping.ts, 87, 65)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 88, 54), Decl(generatedContextualTyping.ts, 88, 65)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 88, 54), Decl(generatedContextualTyping.ts, 88, 65)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x84 { public static member: Genric = { func: n => { return [d1, d2]; } } } ->x84 : Symbol(x84, Decl(generatedContextualTyping.ts, 87, 93)) ->member : Symbol(x84.member, Decl(generatedContextualTyping.ts, 88, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x84 : Symbol(x84, Decl(generatedContextualTyping.ts, 88, 93)) +>member : Symbol(x84.member, Decl(generatedContextualTyping.ts, 89, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 88, 50)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 88, 56)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 89, 50)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 89, 56)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x85 { constructor(parm: () => Base[] = () => [d1, d2]) { } } ->x85 : Symbol(x85, Decl(generatedContextualTyping.ts, 88, 86)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 89, 24)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x86 { constructor(parm: () => Base[] = function() { return [d1, d2] }) { } } ->x86 : Symbol(x86, Decl(generatedContextualTyping.ts, 89, 66)) +>x85 : Symbol(x85, Decl(generatedContextualTyping.ts, 89, 86)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 90, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x87 { constructor(parm: () => Base[] = function named() { return [d1, d2] }) { } } ->x87 : Symbol(x87, Decl(generatedContextualTyping.ts, 90, 82)) +class x86 { constructor(parm: () => Base[] = function() { return [d1, d2] }) { } } +>x86 : Symbol(x86, Decl(generatedContextualTyping.ts, 90, 66)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 91, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 91, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x88 { constructor(parm: { (): Base[]; } = () => [d1, d2]) { } } ->x88 : Symbol(x88, Decl(generatedContextualTyping.ts, 91, 88)) +class x87 { constructor(parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x87 : Symbol(x87, Decl(generatedContextualTyping.ts, 91, 82)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 92, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 92, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x89 { constructor(parm: { (): Base[]; } = function() { return [d1, d2] }) { } } ->x89 : Symbol(x89, Decl(generatedContextualTyping.ts, 92, 69)) +class x88 { constructor(parm: { (): Base[]; } = () => [d1, d2]) { } } +>x88 : Symbol(x88, Decl(generatedContextualTyping.ts, 92, 88)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 93, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x90 { constructor(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } ->x90 : Symbol(x90, Decl(generatedContextualTyping.ts, 93, 85)) +class x89 { constructor(parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x89 : Symbol(x89, Decl(generatedContextualTyping.ts, 93, 69)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 94, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 94, 47)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x91 { constructor(parm: Base[] = [d1, d2]) { } } ->x91 : Symbol(x91, Decl(generatedContextualTyping.ts, 94, 91)) +class x90 { constructor(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x90 : Symbol(x90, Decl(generatedContextualTyping.ts, 94, 85)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 95, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 95, 47)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x91 { constructor(parm: Base[] = [d1, d2]) { } } +>x91 : Symbol(x91, Decl(generatedContextualTyping.ts, 95, 91)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 96, 24)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x92 { constructor(parm: Array = [d1, d2]) { } } ->x92 : Symbol(x92, Decl(generatedContextualTyping.ts, 95, 54)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 96, 24)) +>x92 : Symbol(x92, Decl(generatedContextualTyping.ts, 96, 54)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 97, 24)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x93 { constructor(parm: { [n: number]: Base; } = [d1, d2]) { } } ->x93 : Symbol(x93, Decl(generatedContextualTyping.ts, 96, 59)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 97, 24)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 97, 33)) +>x93 : Symbol(x93, Decl(generatedContextualTyping.ts, 97, 59)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 98, 24)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 98, 33)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x94 { constructor(parm: {n: Base[]; } = { n: [d1, d2] }) { } } ->x94 : Symbol(x94, Decl(generatedContextualTyping.ts, 97, 70)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 98, 24)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 98, 31)) +>x94 : Symbol(x94, Decl(generatedContextualTyping.ts, 98, 70)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 99, 24)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 99, 31)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 98, 48)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 99, 48)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x95 { constructor(parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } ->x95 : Symbol(x95, Decl(generatedContextualTyping.ts, 98, 69)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 99, 24)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 99, 31)) +>x95 : Symbol(x95, Decl(generatedContextualTyping.ts, 99, 69)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 100, 24)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 100, 31)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 99, 50), Decl(generatedContextualTyping.ts, 99, 61)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 99, 50), Decl(generatedContextualTyping.ts, 99, 61)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 100, 50), Decl(generatedContextualTyping.ts, 100, 61)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 100, 50), Decl(generatedContextualTyping.ts, 100, 61)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x96 { constructor(parm: Genric = { func: n => { return [d1, d2]; } }) { } } ->x96 : Symbol(x96, Decl(generatedContextualTyping.ts, 99, 94)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 100, 24)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x96 : Symbol(x96, Decl(generatedContextualTyping.ts, 100, 94)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 101, 24)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 100, 46)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 100, 52)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 101, 46)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 101, 52)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x97 { constructor(public parm: () => Base[] = () => [d1, d2]) { } } ->x97 : Symbol(x97, Decl(generatedContextualTyping.ts, 100, 87)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 101, 24)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x98 { constructor(public parm: () => Base[] = function() { return [d1, d2] }) { } } ->x98 : Symbol(x98, Decl(generatedContextualTyping.ts, 101, 73)) +>x97 : Symbol(x97, Decl(generatedContextualTyping.ts, 101, 87)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 102, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x99 { constructor(public parm: () => Base[] = function named() { return [d1, d2] }) { } } ->x99 : Symbol(x99, Decl(generatedContextualTyping.ts, 102, 89)) +class x98 { constructor(public parm: () => Base[] = function() { return [d1, d2] }) { } } +>x98 : Symbol(x98, Decl(generatedContextualTyping.ts, 102, 73)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 103, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 103, 51)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x99 { constructor(public parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x99 : Symbol(x99, Decl(generatedContextualTyping.ts, 103, 89)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 104, 24)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 104, 51)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x100 { constructor(public parm: { (): Base[]; } = () => [d1, d2]) { } } ->x100 : Symbol(x100, Decl(generatedContextualTyping.ts, 103, 95)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 104, 25)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x101 { constructor(public parm: { (): Base[]; } = function() { return [d1, d2] }) { } } ->x101 : Symbol(x101, Decl(generatedContextualTyping.ts, 104, 77)) +>x100 : Symbol(x100, Decl(generatedContextualTyping.ts, 104, 95)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 105, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x102 { constructor(public parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } ->x102 : Symbol(x102, Decl(generatedContextualTyping.ts, 105, 93)) +class x101 { constructor(public parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x101 : Symbol(x101, Decl(generatedContextualTyping.ts, 105, 77)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 106, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 106, 55)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x103 { constructor(public parm: Base[] = [d1, d2]) { } } ->x103 : Symbol(x103, Decl(generatedContextualTyping.ts, 106, 99)) +class x102 { constructor(public parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x102 : Symbol(x102, Decl(generatedContextualTyping.ts, 106, 93)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 107, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 107, 55)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x103 { constructor(public parm: Base[] = [d1, d2]) { } } +>x103 : Symbol(x103, Decl(generatedContextualTyping.ts, 107, 99)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 108, 25)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x104 { constructor(public parm: Array = [d1, d2]) { } } ->x104 : Symbol(x104, Decl(generatedContextualTyping.ts, 107, 62)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 108, 25)) +>x104 : Symbol(x104, Decl(generatedContextualTyping.ts, 108, 62)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 109, 25)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } } ->x105 : Symbol(x105, Decl(generatedContextualTyping.ts, 108, 67)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 109, 25)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 109, 41)) +>x105 : Symbol(x105, Decl(generatedContextualTyping.ts, 109, 67)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 110, 25)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 110, 41)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x106 { constructor(public parm: {n: Base[]; } = { n: [d1, d2] }) { } } ->x106 : Symbol(x106, Decl(generatedContextualTyping.ts, 109, 78)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 110, 25)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 110, 39)) +>x106 : Symbol(x106, Decl(generatedContextualTyping.ts, 110, 78)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 111, 25)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 39)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 110, 56)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 56)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x107 { constructor(public parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } ->x107 : Symbol(x107, Decl(generatedContextualTyping.ts, 110, 77)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 111, 25)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 111, 39)) +>x107 : Symbol(x107, Decl(generatedContextualTyping.ts, 111, 77)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 112, 25)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 112, 39)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 58), Decl(generatedContextualTyping.ts, 111, 69)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 111, 58), Decl(generatedContextualTyping.ts, 111, 69)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 112, 58), Decl(generatedContextualTyping.ts, 112, 69)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 112, 58), Decl(generatedContextualTyping.ts, 112, 69)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x108 { constructor(public parm: Genric = { func: n => { return [d1, d2]; } }) { } } ->x108 : Symbol(x108, Decl(generatedContextualTyping.ts, 111, 102)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 112, 25)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x108 : Symbol(x108, Decl(generatedContextualTyping.ts, 112, 102)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 113, 25)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 112, 54)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 112, 60)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 113, 54)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 113, 60)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x109 { constructor(private parm: () => Base[] = () => [d1, d2]) { } } ->x109 : Symbol(x109, Decl(generatedContextualTyping.ts, 112, 95)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 113, 25)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -class x110 { constructor(private parm: () => Base[] = function() { return [d1, d2] }) { } } ->x110 : Symbol(x110, Decl(generatedContextualTyping.ts, 113, 75)) +>x109 : Symbol(x109, Decl(generatedContextualTyping.ts, 113, 95)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 114, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x111 { constructor(private parm: () => Base[] = function named() { return [d1, d2] }) { } } ->x111 : Symbol(x111, Decl(generatedContextualTyping.ts, 114, 91)) +class x110 { constructor(private parm: () => Base[] = function() { return [d1, d2] }) { } } +>x110 : Symbol(x110, Decl(generatedContextualTyping.ts, 114, 75)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 115, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 115, 53)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x112 { constructor(private parm: { (): Base[]; } = () => [d1, d2]) { } } ->x112 : Symbol(x112, Decl(generatedContextualTyping.ts, 115, 97)) +class x111 { constructor(private parm: () => Base[] = function named() { return [d1, d2] }) { } } +>x111 : Symbol(x111, Decl(generatedContextualTyping.ts, 115, 91)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 116, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 116, 53)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x113 { constructor(private parm: { (): Base[]; } = function() { return [d1, d2] }) { } } ->x113 : Symbol(x113, Decl(generatedContextualTyping.ts, 116, 78)) +class x112 { constructor(private parm: { (): Base[]; } = () => [d1, d2]) { } } +>x112 : Symbol(x112, Decl(generatedContextualTyping.ts, 116, 97)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 117, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x114 { constructor(private parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } ->x114 : Symbol(x114, Decl(generatedContextualTyping.ts, 117, 94)) +class x113 { constructor(private parm: { (): Base[]; } = function() { return [d1, d2] }) { } } +>x113 : Symbol(x113, Decl(generatedContextualTyping.ts, 117, 78)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 118, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 118, 56)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -class x115 { constructor(private parm: Base[] = [d1, d2]) { } } ->x115 : Symbol(x115, Decl(generatedContextualTyping.ts, 118, 100)) +class x114 { constructor(private parm: { (): Base[]; } = function named() { return [d1, d2] }) { } } +>x114 : Symbol(x114, Decl(generatedContextualTyping.ts, 118, 94)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 119, 25)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 119, 56)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +class x115 { constructor(private parm: Base[] = [d1, d2]) { } } +>x115 : Symbol(x115, Decl(generatedContextualTyping.ts, 119, 100)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 120, 25)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x116 { constructor(private parm: Array = [d1, d2]) { } } ->x116 : Symbol(x116, Decl(generatedContextualTyping.ts, 119, 63)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 120, 25)) +>x116 : Symbol(x116, Decl(generatedContextualTyping.ts, 120, 63)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 121, 25)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } } ->x117 : Symbol(x117, Decl(generatedContextualTyping.ts, 120, 68)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 121, 25)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 121, 42)) +>x117 : Symbol(x117, Decl(generatedContextualTyping.ts, 121, 68)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 122, 25)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 122, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x118 { constructor(private parm: {n: Base[]; } = { n: [d1, d2] }) { } } ->x118 : Symbol(x118, Decl(generatedContextualTyping.ts, 121, 79)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 122, 25)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 122, 40)) +>x118 : Symbol(x118, Decl(generatedContextualTyping.ts, 122, 79)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 123, 25)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 40)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 122, 57)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 57)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) class x119 { constructor(private parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } } ->x119 : Symbol(x119, Decl(generatedContextualTyping.ts, 122, 78)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 123, 25)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 123, 40)) +>x119 : Symbol(x119, Decl(generatedContextualTyping.ts, 123, 78)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 124, 25)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 124, 40)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 59), Decl(generatedContextualTyping.ts, 123, 70)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 123, 59), Decl(generatedContextualTyping.ts, 123, 70)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 124, 59), Decl(generatedContextualTyping.ts, 124, 70)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 124, 59), Decl(generatedContextualTyping.ts, 124, 70)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) class x120 { constructor(private parm: Genric = { func: n => { return [d1, d2]; } }) { } } ->x120 : Symbol(x120, Decl(generatedContextualTyping.ts, 123, 103)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 124, 25)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x120 : Symbol(x120, Decl(generatedContextualTyping.ts, 124, 103)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 125, 25)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 124, 55)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 124, 61)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 125, 55)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 125, 61)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x121(parm: () => Base[] = () => [d1, d2]) { } ->x121 : Symbol(x121, Decl(generatedContextualTyping.ts, 124, 96)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 125, 14)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -function x122(parm: () => Base[] = function() { return [d1, d2] }) { } ->x122 : Symbol(x122, Decl(generatedContextualTyping.ts, 125, 54)) +>x121 : Symbol(x121, Decl(generatedContextualTyping.ts, 125, 96)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 126, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x123(parm: () => Base[] = function named() { return [d1, d2] }) { } ->x123 : Symbol(x123, Decl(generatedContextualTyping.ts, 126, 70)) +function x122(parm: () => Base[] = function() { return [d1, d2] }) { } +>x122 : Symbol(x122, Decl(generatedContextualTyping.ts, 126, 54)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 127, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 127, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x124(parm: { (): Base[]; } = () => [d1, d2]) { } ->x124 : Symbol(x124, Decl(generatedContextualTyping.ts, 127, 76)) +function x123(parm: () => Base[] = function named() { return [d1, d2] }) { } +>x123 : Symbol(x123, Decl(generatedContextualTyping.ts, 127, 70)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 128, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 128, 34)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x125(parm: { (): Base[]; } = function() { return [d1, d2] }) { } ->x125 : Symbol(x125, Decl(generatedContextualTyping.ts, 128, 57)) +function x124(parm: { (): Base[]; } = () => [d1, d2]) { } +>x124 : Symbol(x124, Decl(generatedContextualTyping.ts, 128, 76)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 129, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x126(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } ->x126 : Symbol(x126, Decl(generatedContextualTyping.ts, 129, 73)) +function x125(parm: { (): Base[]; } = function() { return [d1, d2] }) { } +>x125 : Symbol(x125, Decl(generatedContextualTyping.ts, 129, 57)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 130, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 130, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x127(parm: Base[] = [d1, d2]) { } ->x127 : Symbol(x127, Decl(generatedContextualTyping.ts, 130, 79)) +function x126(parm: { (): Base[]; } = function named() { return [d1, d2] }) { } +>x126 : Symbol(x126, Decl(generatedContextualTyping.ts, 130, 73)) >parm : Symbol(parm, Decl(generatedContextualTyping.ts, 131, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 131, 37)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +function x127(parm: Base[] = [d1, d2]) { } +>x127 : Symbol(x127, Decl(generatedContextualTyping.ts, 131, 79)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 132, 14)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x128(parm: Array = [d1, d2]) { } ->x128 : Symbol(x128, Decl(generatedContextualTyping.ts, 131, 42)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 132, 14)) +>x128 : Symbol(x128, Decl(generatedContextualTyping.ts, 132, 42)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 133, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x129(parm: { [n: number]: Base; } = [d1, d2]) { } ->x129 : Symbol(x129, Decl(generatedContextualTyping.ts, 132, 47)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 133, 14)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 133, 23)) +>x129 : Symbol(x129, Decl(generatedContextualTyping.ts, 133, 47)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 134, 14)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 134, 23)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x130(parm: {n: Base[]; } = { n: [d1, d2] }) { } ->x130 : Symbol(x130, Decl(generatedContextualTyping.ts, 133, 58)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 134, 14)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 134, 21)) +>x130 : Symbol(x130, Decl(generatedContextualTyping.ts, 134, 58)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 135, 14)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 135, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 134, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 135, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x131(parm: (s: Base[]) => any = n => { var n: Base[]; return null; }) { } ->x131 : Symbol(x131, Decl(generatedContextualTyping.ts, 134, 57)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 135, 14)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 135, 21)) +>x131 : Symbol(x131, Decl(generatedContextualTyping.ts, 135, 57)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 136, 14)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 136, 21)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 135, 40), Decl(generatedContextualTyping.ts, 135, 51)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 135, 40), Decl(generatedContextualTyping.ts, 135, 51)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 136, 40), Decl(generatedContextualTyping.ts, 136, 51)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 136, 40), Decl(generatedContextualTyping.ts, 136, 51)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) function x132(parm: Genric = { func: n => { return [d1, d2]; } }) { } ->x132 : Symbol(x132, Decl(generatedContextualTyping.ts, 135, 82)) ->parm : Symbol(parm, Decl(generatedContextualTyping.ts, 136, 14)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x132 : Symbol(x132, Decl(generatedContextualTyping.ts, 136, 82)) +>parm : Symbol(parm, Decl(generatedContextualTyping.ts, 137, 14)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 136, 36)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 136, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 137, 36)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 137, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x133(): () => Base[] { return () => [d1, d2]; } ->x133 : Symbol(x133, Decl(generatedContextualTyping.ts, 136, 75)) +>x133 : Symbol(x133, Decl(generatedContextualTyping.ts, 137, 75)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x134(): () => Base[] { return function() { return [d1, d2] }; } ->x134 : Symbol(x134, Decl(generatedContextualTyping.ts, 137, 56)) +>x134 : Symbol(x134, Decl(generatedContextualTyping.ts, 138, 56)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x135(): () => Base[] { return function named() { return [d1, d2] }; } ->x135 : Symbol(x135, Decl(generatedContextualTyping.ts, 138, 72)) +>x135 : Symbol(x135, Decl(generatedContextualTyping.ts, 139, 72)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 139, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 140, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x136(): { (): Base[]; } { return () => [d1, d2]; } ->x136 : Symbol(x136, Decl(generatedContextualTyping.ts, 139, 78)) +>x136 : Symbol(x136, Decl(generatedContextualTyping.ts, 140, 78)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x137(): { (): Base[]; } { return function() { return [d1, d2] }; } ->x137 : Symbol(x137, Decl(generatedContextualTyping.ts, 140, 59)) +>x137 : Symbol(x137, Decl(generatedContextualTyping.ts, 141, 59)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x138(): { (): Base[]; } { return function named() { return [d1, d2] }; } ->x138 : Symbol(x138, Decl(generatedContextualTyping.ts, 141, 75)) +>x138 : Symbol(x138, Decl(generatedContextualTyping.ts, 142, 75)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 142, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 143, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x139(): Base[] { return [d1, d2]; } ->x139 : Symbol(x139, Decl(generatedContextualTyping.ts, 142, 81)) +>x139 : Symbol(x139, Decl(generatedContextualTyping.ts, 143, 81)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x140(): Array { return [d1, d2]; } ->x140 : Symbol(x140, Decl(generatedContextualTyping.ts, 143, 44)) +>x140 : Symbol(x140, Decl(generatedContextualTyping.ts, 144, 44)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x141(): { [n: number]: Base; } { return [d1, d2]; } ->x141 : Symbol(x141, Decl(generatedContextualTyping.ts, 144, 49)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 145, 20)) +>x141 : Symbol(x141, Decl(generatedContextualTyping.ts, 145, 49)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 146, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x142(): {n: Base[]; } { return { n: [d1, d2] }; } ->x142 : Symbol(x142, Decl(generatedContextualTyping.ts, 145, 60)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 146, 18)) +>x142 : Symbol(x142, Decl(generatedContextualTyping.ts, 146, 60)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 147, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 146, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 147, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x143(): (s: Base[]) => any { return n => { var n: Base[]; return null; }; } ->x143 : Symbol(x143, Decl(generatedContextualTyping.ts, 146, 59)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 147, 18)) +>x143 : Symbol(x143, Decl(generatedContextualTyping.ts, 147, 59)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 148, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 147, 44), Decl(generatedContextualTyping.ts, 147, 55)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 147, 44), Decl(generatedContextualTyping.ts, 147, 55)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 148, 44), Decl(generatedContextualTyping.ts, 148, 55)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 148, 44), Decl(generatedContextualTyping.ts, 148, 55)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) function x144(): Genric { return { func: n => { return [d1, d2]; } }; } ->x144 : Symbol(x144, Decl(generatedContextualTyping.ts, 147, 84)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x144 : Symbol(x144, Decl(generatedContextualTyping.ts, 148, 84)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 148, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 148, 46)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 149, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 149, 46)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x145(): () => Base[] { return () => [d1, d2]; return () => [d1, d2]; } ->x145 : Symbol(x145, Decl(generatedContextualTyping.ts, 148, 77)) +>x145 : Symbol(x145, Decl(generatedContextualTyping.ts, 149, 77)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x146(): () => Base[] { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } ->x146 : Symbol(x146, Decl(generatedContextualTyping.ts, 149, 79)) +>x146 : Symbol(x146, Decl(generatedContextualTyping.ts, 150, 79)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x147(): () => Base[] { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } ->x147 : Symbol(x147, Decl(generatedContextualTyping.ts, 150, 111)) +>x147 : Symbol(x147, Decl(generatedContextualTyping.ts, 151, 111)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 151, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 151, 83)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 152, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 152, 83)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x148(): { (): Base[]; } { return () => [d1, d2]; return () => [d1, d2]; } ->x148 : Symbol(x148, Decl(generatedContextualTyping.ts, 151, 123)) +>x148 : Symbol(x148, Decl(generatedContextualTyping.ts, 152, 123)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x149(): { (): Base[]; } { return function() { return [d1, d2] }; return function() { return [d1, d2] }; } ->x149 : Symbol(x149, Decl(generatedContextualTyping.ts, 152, 82)) +>x149 : Symbol(x149, Decl(generatedContextualTyping.ts, 153, 82)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x150(): { (): Base[]; } { return function named() { return [d1, d2] }; return function named() { return [d1, d2] }; } ->x150 : Symbol(x150, Decl(generatedContextualTyping.ts, 153, 114)) +>x150 : Symbol(x150, Decl(generatedContextualTyping.ts, 154, 114)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 154, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 154, 86)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 155, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 155, 86)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x151(): Base[] { return [d1, d2]; return [d1, d2]; } ->x151 : Symbol(x151, Decl(generatedContextualTyping.ts, 154, 126)) +>x151 : Symbol(x151, Decl(generatedContextualTyping.ts, 155, 126)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x152(): Array { return [d1, d2]; return [d1, d2]; } ->x152 : Symbol(x152, Decl(generatedContextualTyping.ts, 155, 61)) +>x152 : Symbol(x152, Decl(generatedContextualTyping.ts, 156, 61)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x153(): { [n: number]: Base; } { return [d1, d2]; return [d1, d2]; } ->x153 : Symbol(x153, Decl(generatedContextualTyping.ts, 156, 66)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 157, 20)) +>x153 : Symbol(x153, Decl(generatedContextualTyping.ts, 157, 66)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 158, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x154(): {n: Base[]; } { return { n: [d1, d2] }; return { n: [d1, d2] }; } ->x154 : Symbol(x154, Decl(generatedContextualTyping.ts, 157, 77)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 158, 18)) +>x154 : Symbol(x154, Decl(generatedContextualTyping.ts, 158, 77)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 158, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 158, 66)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 66)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x155(): (s: Base[]) => any { return n => { var n: Base[]; return null; }; return n => { var n: Base[]; return null; }; } ->x155 : Symbol(x155, Decl(generatedContextualTyping.ts, 158, 83)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 159, 18)) +>x155 : Symbol(x155, Decl(generatedContextualTyping.ts, 159, 83)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 160, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 44), Decl(generatedContextualTyping.ts, 159, 55)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 44), Decl(generatedContextualTyping.ts, 159, 55)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 44), Decl(generatedContextualTyping.ts, 160, 55)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 44), Decl(generatedContextualTyping.ts, 160, 55)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 89), Decl(generatedContextualTyping.ts, 159, 100)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 159, 89), Decl(generatedContextualTyping.ts, 159, 100)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 89), Decl(generatedContextualTyping.ts, 160, 100)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 89), Decl(generatedContextualTyping.ts, 160, 100)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) function x156(): Genric { return { func: n => { return [d1, d2]; } }; return { func: n => { return [d1, d2]; } }; } ->x156 : Symbol(x156, Decl(generatedContextualTyping.ts, 159, 129)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x156 : Symbol(x156, Decl(generatedContextualTyping.ts, 160, 129)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 160, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 46)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 160, 84)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 160, 90)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 161, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 161, 46)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 161, 84)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 161, 90)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x157: () => () => Base[] = () => { return () => [d1, d2]; }; ->x157 : Symbol(x157, Decl(generatedContextualTyping.ts, 161, 3)) +>x157 : Symbol(x157, Decl(generatedContextualTyping.ts, 162, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x158: () => () => Base[] = () => { return function() { return [d1, d2] }; }; ->x158 : Symbol(x158, Decl(generatedContextualTyping.ts, 162, 3)) +>x158 : Symbol(x158, Decl(generatedContextualTyping.ts, 163, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x159: () => () => Base[] = () => { return function named() { return [d1, d2] }; }; ->x159 : Symbol(x159, Decl(generatedContextualTyping.ts, 163, 3)) +>x159 : Symbol(x159, Decl(generatedContextualTyping.ts, 164, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 163, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 164, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x160: () => { (): Base[]; } = () => { return () => [d1, d2]; }; ->x160 : Symbol(x160, Decl(generatedContextualTyping.ts, 164, 3)) +>x160 : Symbol(x160, Decl(generatedContextualTyping.ts, 165, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x161: () => { (): Base[]; } = () => { return function() { return [d1, d2] }; }; ->x161 : Symbol(x161, Decl(generatedContextualTyping.ts, 165, 3)) +>x161 : Symbol(x161, Decl(generatedContextualTyping.ts, 166, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x162: () => { (): Base[]; } = () => { return function named() { return [d1, d2] }; }; ->x162 : Symbol(x162, Decl(generatedContextualTyping.ts, 166, 3)) +>x162 : Symbol(x162, Decl(generatedContextualTyping.ts, 167, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 166, 48)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 167, 48)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x163: () => Base[] = () => { return [d1, d2]; }; ->x163 : Symbol(x163, Decl(generatedContextualTyping.ts, 167, 3)) +>x163 : Symbol(x163, Decl(generatedContextualTyping.ts, 168, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x164: () => Array = () => { return [d1, d2]; }; ->x164 : Symbol(x164, Decl(generatedContextualTyping.ts, 168, 3)) +>x164 : Symbol(x164, Decl(generatedContextualTyping.ts, 169, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x165: () => { [n: number]: Base; } = () => { return [d1, d2]; }; ->x165 : Symbol(x165, Decl(generatedContextualTyping.ts, 169, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 169, 19)) +>x165 : Symbol(x165, Decl(generatedContextualTyping.ts, 170, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 170, 19)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x166: () => {n: Base[]; } = () => { return { n: [d1, d2] }; }; ->x166 : Symbol(x166, Decl(generatedContextualTyping.ts, 170, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 170, 17)) +>x166 : Symbol(x166, Decl(generatedContextualTyping.ts, 171, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 171, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 170, 49)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 171, 49)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x167: () => (s: Base[]) => any = () => { return n => { var n: Base[]; return null; }; }; ->x167 : Symbol(x167, Decl(generatedContextualTyping.ts, 171, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 171, 17)) +>x167 : Symbol(x167, Decl(generatedContextualTyping.ts, 172, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 172, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 171, 51), Decl(generatedContextualTyping.ts, 171, 62)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 171, 51), Decl(generatedContextualTyping.ts, 171, 62)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 172, 51), Decl(generatedContextualTyping.ts, 172, 62)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 172, 51), Decl(generatedContextualTyping.ts, 172, 62)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x168: () => Genric = () => { return { func: n => { return [d1, d2]; } }; }; ->x168 : Symbol(x168, Decl(generatedContextualTyping.ts, 172, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x168 : Symbol(x168, Decl(generatedContextualTyping.ts, 173, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 172, 47)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 172, 53)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 173, 47)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 173, 53)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x169: () => () => Base[] = function() { return () => [d1, d2]; }; ->x169 : Symbol(x169, Decl(generatedContextualTyping.ts, 173, 3)) +>x169 : Symbol(x169, Decl(generatedContextualTyping.ts, 174, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x170: () => () => Base[] = function() { return function() { return [d1, d2] }; }; ->x170 : Symbol(x170, Decl(generatedContextualTyping.ts, 174, 3)) +>x170 : Symbol(x170, Decl(generatedContextualTyping.ts, 175, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x171: () => () => Base[] = function() { return function named() { return [d1, d2] }; }; ->x171 : Symbol(x171, Decl(generatedContextualTyping.ts, 175, 3)) +>x171 : Symbol(x171, Decl(generatedContextualTyping.ts, 176, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 175, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 176, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x172: () => { (): Base[]; } = function() { return () => [d1, d2]; }; ->x172 : Symbol(x172, Decl(generatedContextualTyping.ts, 176, 3)) +>x172 : Symbol(x172, Decl(generatedContextualTyping.ts, 177, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x173: () => { (): Base[]; } = function() { return function() { return [d1, d2] }; }; ->x173 : Symbol(x173, Decl(generatedContextualTyping.ts, 177, 3)) +>x173 : Symbol(x173, Decl(generatedContextualTyping.ts, 178, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x174: () => { (): Base[]; } = function() { return function named() { return [d1, d2] }; }; ->x174 : Symbol(x174, Decl(generatedContextualTyping.ts, 178, 3)) +>x174 : Symbol(x174, Decl(generatedContextualTyping.ts, 179, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 178, 53)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 179, 53)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x175: () => Base[] = function() { return [d1, d2]; }; ->x175 : Symbol(x175, Decl(generatedContextualTyping.ts, 179, 3)) +>x175 : Symbol(x175, Decl(generatedContextualTyping.ts, 180, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x176: () => Array = function() { return [d1, d2]; }; ->x176 : Symbol(x176, Decl(generatedContextualTyping.ts, 180, 3)) +>x176 : Symbol(x176, Decl(generatedContextualTyping.ts, 181, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x177: () => { [n: number]: Base; } = function() { return [d1, d2]; }; ->x177 : Symbol(x177, Decl(generatedContextualTyping.ts, 181, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 181, 19)) +>x177 : Symbol(x177, Decl(generatedContextualTyping.ts, 182, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 182, 19)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x178: () => {n: Base[]; } = function() { return { n: [d1, d2] }; }; ->x178 : Symbol(x178, Decl(generatedContextualTyping.ts, 182, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 182, 17)) +>x178 : Symbol(x178, Decl(generatedContextualTyping.ts, 183, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 183, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 182, 54)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 183, 54)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x179: () => (s: Base[]) => any = function() { return n => { var n: Base[]; return null; }; }; ->x179 : Symbol(x179, Decl(generatedContextualTyping.ts, 183, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 183, 17)) +>x179 : Symbol(x179, Decl(generatedContextualTyping.ts, 184, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 184, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 183, 56), Decl(generatedContextualTyping.ts, 183, 67)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 183, 56), Decl(generatedContextualTyping.ts, 183, 67)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 184, 56), Decl(generatedContextualTyping.ts, 184, 67)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 184, 56), Decl(generatedContextualTyping.ts, 184, 67)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x180: () => Genric = function() { return { func: n => { return [d1, d2]; } }; }; ->x180 : Symbol(x180, Decl(generatedContextualTyping.ts, 184, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x180 : Symbol(x180, Decl(generatedContextualTyping.ts, 185, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 184, 52)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 184, 58)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 185, 52)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 185, 58)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x181 { var t: () => Base[] = () => [d1, d2]; } ->x181 : Symbol(x181, Decl(generatedContextualTyping.ts, 184, 90)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 185, 17)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -module x182 { var t: () => Base[] = function() { return [d1, d2] }; } ->x182 : Symbol(x182, Decl(generatedContextualTyping.ts, 185, 53)) +>x181 : Symbol(x181, Decl(generatedContextualTyping.ts, 185, 90)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 186, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x183 { var t: () => Base[] = function named() { return [d1, d2] }; } ->x183 : Symbol(x183, Decl(generatedContextualTyping.ts, 186, 69)) +module x182 { var t: () => Base[] = function() { return [d1, d2] }; } +>x182 : Symbol(x182, Decl(generatedContextualTyping.ts, 186, 53)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 187, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 187, 35)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x184 { var t: { (): Base[]; } = () => [d1, d2]; } ->x184 : Symbol(x184, Decl(generatedContextualTyping.ts, 187, 75)) +module x183 { var t: () => Base[] = function named() { return [d1, d2] }; } +>x183 : Symbol(x183, Decl(generatedContextualTyping.ts, 187, 69)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 188, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 188, 35)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x185 { var t: { (): Base[]; } = function() { return [d1, d2] }; } ->x185 : Symbol(x185, Decl(generatedContextualTyping.ts, 188, 56)) +module x184 { var t: { (): Base[]; } = () => [d1, d2]; } +>x184 : Symbol(x184, Decl(generatedContextualTyping.ts, 188, 75)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 189, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x186 { var t: { (): Base[]; } = function named() { return [d1, d2] }; } ->x186 : Symbol(x186, Decl(generatedContextualTyping.ts, 189, 72)) +module x185 { var t: { (): Base[]; } = function() { return [d1, d2] }; } +>x185 : Symbol(x185, Decl(generatedContextualTyping.ts, 189, 56)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 190, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 190, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x187 { var t: Base[] = [d1, d2]; } ->x187 : Symbol(x187, Decl(generatedContextualTyping.ts, 190, 78)) +module x186 { var t: { (): Base[]; } = function named() { return [d1, d2] }; } +>x186 : Symbol(x186, Decl(generatedContextualTyping.ts, 190, 72)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 191, 17)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 191, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +module x187 { var t: Base[] = [d1, d2]; } +>x187 : Symbol(x187, Decl(generatedContextualTyping.ts, 191, 78)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 192, 17)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x188 { var t: Array = [d1, d2]; } ->x188 : Symbol(x188, Decl(generatedContextualTyping.ts, 191, 41)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 192, 17)) +>x188 : Symbol(x188, Decl(generatedContextualTyping.ts, 192, 41)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 193, 17)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x189 { var t: { [n: number]: Base; } = [d1, d2]; } ->x189 : Symbol(x189, Decl(generatedContextualTyping.ts, 192, 46)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 193, 17)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 193, 24)) +>x189 : Symbol(x189, Decl(generatedContextualTyping.ts, 193, 46)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 194, 17)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 194, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x190 { var t: {n: Base[]; } = { n: [d1, d2] }; } ->x190 : Symbol(x190, Decl(generatedContextualTyping.ts, 193, 57)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 194, 17)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 194, 22)) +>x190 : Symbol(x190, Decl(generatedContextualTyping.ts, 194, 57)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 195, 17)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 195, 22)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 194, 39)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 195, 39)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x191 { var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } ->x191 : Symbol(x191, Decl(generatedContextualTyping.ts, 194, 56)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 195, 17)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 195, 22)) +>x191 : Symbol(x191, Decl(generatedContextualTyping.ts, 195, 56)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 196, 17)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 196, 22)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 195, 41), Decl(generatedContextualTyping.ts, 195, 52)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 195, 41), Decl(generatedContextualTyping.ts, 195, 52)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 196, 41), Decl(generatedContextualTyping.ts, 196, 52)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 196, 41), Decl(generatedContextualTyping.ts, 196, 52)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) module x192 { var t: Genric = { func: n => { return [d1, d2]; } }; } ->x192 : Symbol(x192, Decl(generatedContextualTyping.ts, 195, 81)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 196, 17)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x192 : Symbol(x192, Decl(generatedContextualTyping.ts, 196, 81)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 197, 17)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 196, 37)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 196, 43)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 197, 37)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 197, 43)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x193 { export var t: () => Base[] = () => [d1, d2]; } ->x193 : Symbol(x193, Decl(generatedContextualTyping.ts, 196, 74)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 197, 24)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -module x194 { export var t: () => Base[] = function() { return [d1, d2] }; } ->x194 : Symbol(x194, Decl(generatedContextualTyping.ts, 197, 60)) +>x193 : Symbol(x193, Decl(generatedContextualTyping.ts, 197, 74)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 198, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x195 { export var t: () => Base[] = function named() { return [d1, d2] }; } ->x195 : Symbol(x195, Decl(generatedContextualTyping.ts, 198, 76)) +module x194 { export var t: () => Base[] = function() { return [d1, d2] }; } +>x194 : Symbol(x194, Decl(generatedContextualTyping.ts, 198, 60)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 199, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 199, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x196 { export var t: { (): Base[]; } = () => [d1, d2]; } ->x196 : Symbol(x196, Decl(generatedContextualTyping.ts, 199, 82)) +module x195 { export var t: () => Base[] = function named() { return [d1, d2] }; } +>x195 : Symbol(x195, Decl(generatedContextualTyping.ts, 199, 76)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 200, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 200, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x197 { export var t: { (): Base[]; } = function() { return [d1, d2] }; } ->x197 : Symbol(x197, Decl(generatedContextualTyping.ts, 200, 63)) +module x196 { export var t: { (): Base[]; } = () => [d1, d2]; } +>x196 : Symbol(x196, Decl(generatedContextualTyping.ts, 200, 82)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 201, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x198 { export var t: { (): Base[]; } = function named() { return [d1, d2] }; } ->x198 : Symbol(x198, Decl(generatedContextualTyping.ts, 201, 79)) +module x197 { export var t: { (): Base[]; } = function() { return [d1, d2] }; } +>x197 : Symbol(x197, Decl(generatedContextualTyping.ts, 201, 63)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 202, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 202, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -module x199 { export var t: Base[] = [d1, d2]; } ->x199 : Symbol(x199, Decl(generatedContextualTyping.ts, 202, 85)) +module x198 { export var t: { (): Base[]; } = function named() { return [d1, d2] }; } +>x198 : Symbol(x198, Decl(generatedContextualTyping.ts, 202, 79)) >t : Symbol(t, Decl(generatedContextualTyping.ts, 203, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 203, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +module x199 { export var t: Base[] = [d1, d2]; } +>x199 : Symbol(x199, Decl(generatedContextualTyping.ts, 203, 85)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 204, 24)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x200 { export var t: Array = [d1, d2]; } ->x200 : Symbol(x200, Decl(generatedContextualTyping.ts, 203, 48)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 204, 24)) +>x200 : Symbol(x200, Decl(generatedContextualTyping.ts, 204, 48)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 205, 24)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x201 { export var t: { [n: number]: Base; } = [d1, d2]; } ->x201 : Symbol(x201, Decl(generatedContextualTyping.ts, 204, 53)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 205, 24)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 205, 31)) +>x201 : Symbol(x201, Decl(generatedContextualTyping.ts, 205, 53)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 206, 24)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 206, 31)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x202 { export var t: {n: Base[]; } = { n: [d1, d2] }; } ->x202 : Symbol(x202, Decl(generatedContextualTyping.ts, 205, 64)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 206, 24)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 206, 29)) +>x202 : Symbol(x202, Decl(generatedContextualTyping.ts, 206, 64)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 207, 24)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 207, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 206, 46)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 207, 46)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) module x203 { export var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } ->x203 : Symbol(x203, Decl(generatedContextualTyping.ts, 206, 63)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 207, 24)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 207, 29)) +>x203 : Symbol(x203, Decl(generatedContextualTyping.ts, 207, 63)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 208, 24)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 208, 29)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 207, 48), Decl(generatedContextualTyping.ts, 207, 59)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 207, 48), Decl(generatedContextualTyping.ts, 207, 59)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 208, 48), Decl(generatedContextualTyping.ts, 208, 59)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 208, 48), Decl(generatedContextualTyping.ts, 208, 59)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) module x204 { export var t: Genric = { func: n => { return [d1, d2]; } }; } ->x204 : Symbol(x204, Decl(generatedContextualTyping.ts, 207, 88)) ->t : Symbol(t, Decl(generatedContextualTyping.ts, 208, 24)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x204 : Symbol(x204, Decl(generatedContextualTyping.ts, 208, 88)) +>t : Symbol(t, Decl(generatedContextualTyping.ts, 209, 24)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 208, 44)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 208, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 209, 44)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 209, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x206 = <() => Base[]>function() { return [d1, d2] }; ->x206 : Symbol(x206, Decl(generatedContextualTyping.ts, 209, 3)) +>x206 : Symbol(x206, Decl(generatedContextualTyping.ts, 210, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x207 = <() => Base[]>function named() { return [d1, d2] }; ->x207 : Symbol(x207, Decl(generatedContextualTyping.ts, 210, 3)) +>x207 : Symbol(x207, Decl(generatedContextualTyping.ts, 211, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 210, 25)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 211, 25)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x209 = <{ (): Base[]; }>function() { return [d1, d2] }; ->x209 : Symbol(x209, Decl(generatedContextualTyping.ts, 211, 3)) +>x209 : Symbol(x209, Decl(generatedContextualTyping.ts, 212, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x210 = <{ (): Base[]; }>function named() { return [d1, d2] }; ->x210 : Symbol(x210, Decl(generatedContextualTyping.ts, 212, 3)) +>x210 : Symbol(x210, Decl(generatedContextualTyping.ts, 213, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 212, 28)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 213, 28)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x211 = [d1, d2]; ->x211 : Symbol(x211, Decl(generatedContextualTyping.ts, 213, 3)) +>x211 : Symbol(x211, Decl(generatedContextualTyping.ts, 214, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x212 = >[d1, d2]; ->x212 : Symbol(x212, Decl(generatedContextualTyping.ts, 214, 3)) +>x212 : Symbol(x212, Decl(generatedContextualTyping.ts, 215, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x213 = <{ [n: number]: Base; }>[d1, d2]; ->x213 : Symbol(x213, Decl(generatedContextualTyping.ts, 215, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 215, 15)) +>x213 : Symbol(x213, Decl(generatedContextualTyping.ts, 216, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 216, 15)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x214 = <{n: Base[]; } >{ n: [d1, d2] }; ->x214 : Symbol(x214, Decl(generatedContextualTyping.ts, 216, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 216, 13)) +>x214 : Symbol(x214, Decl(generatedContextualTyping.ts, 217, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 217, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 216, 28)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 217, 28)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x216 = >{ func: n => { return [d1, d2]; } }; ->x216 : Symbol(x216, Decl(generatedContextualTyping.ts, 217, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x216 : Symbol(x216, Decl(generatedContextualTyping.ts, 218, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 217, 26)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 217, 32)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 218, 26)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 218, 32)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; ->x217 : Symbol(x217, Decl(generatedContextualTyping.ts, 218, 3)) +>x217 : Symbol(x217, Decl(generatedContextualTyping.ts, 219, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; ->x218 : Symbol(x218, Decl(generatedContextualTyping.ts, 219, 3)) +>x218 : Symbol(x218, Decl(generatedContextualTyping.ts, 220, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 219, 39)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 220, 39)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; ->x219 : Symbol(x219, Decl(generatedContextualTyping.ts, 220, 3)) +>x219 : Symbol(x219, Decl(generatedContextualTyping.ts, 221, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; ->x220 : Symbol(x220, Decl(generatedContextualTyping.ts, 221, 3)) +>x220 : Symbol(x220, Decl(generatedContextualTyping.ts, 222, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 221, 42)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 222, 42)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x221 = (undefined) || [d1, d2]; ->x221 : Symbol(x221, Decl(generatedContextualTyping.ts, 222, 3)) +>x221 : Symbol(x221, Decl(generatedContextualTyping.ts, 223, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x222 = (>undefined) || [d1, d2]; ->x222 : Symbol(x222, Decl(generatedContextualTyping.ts, 223, 3)) +>x222 : Symbol(x222, Decl(generatedContextualTyping.ts, 224, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ->x223 : Symbol(x223, Decl(generatedContextualTyping.ts, 224, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 224, 16)) +>x223 : Symbol(x223, Decl(generatedContextualTyping.ts, 225, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 225, 16)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; ->x224 : Symbol(x224, Decl(generatedContextualTyping.ts, 225, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 225, 14)) +>x224 : Symbol(x224, Decl(generatedContextualTyping.ts, 226, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 226, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 225, 43)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 226, 43)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x225: () => Base[]; x225 = () => [d1, d2]; ->x225 : Symbol(x225, Decl(generatedContextualTyping.ts, 226, 3)) +>x225 : Symbol(x225, Decl(generatedContextualTyping.ts, 227, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x225 : Symbol(x225, Decl(generatedContextualTyping.ts, 226, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x225 : Symbol(x225, Decl(generatedContextualTyping.ts, 227, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x226: () => Base[]; x226 = function() { return [d1, d2] }; ->x226 : Symbol(x226, Decl(generatedContextualTyping.ts, 227, 3)) +>x226 : Symbol(x226, Decl(generatedContextualTyping.ts, 228, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x226 : Symbol(x226, Decl(generatedContextualTyping.ts, 227, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x226 : Symbol(x226, Decl(generatedContextualTyping.ts, 228, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x227: () => Base[]; x227 = function named() { return [d1, d2] }; ->x227 : Symbol(x227, Decl(generatedContextualTyping.ts, 228, 3)) +>x227 : Symbol(x227, Decl(generatedContextualTyping.ts, 229, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x227 : Symbol(x227, Decl(generatedContextualTyping.ts, 228, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 228, 30)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x227 : Symbol(x227, Decl(generatedContextualTyping.ts, 229, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 229, 30)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x228: { (): Base[]; }; x228 = () => [d1, d2]; ->x228 : Symbol(x228, Decl(generatedContextualTyping.ts, 229, 3)) +>x228 : Symbol(x228, Decl(generatedContextualTyping.ts, 230, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x228 : Symbol(x228, Decl(generatedContextualTyping.ts, 229, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x228 : Symbol(x228, Decl(generatedContextualTyping.ts, 230, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x229: { (): Base[]; }; x229 = function() { return [d1, d2] }; ->x229 : Symbol(x229, Decl(generatedContextualTyping.ts, 230, 3)) +>x229 : Symbol(x229, Decl(generatedContextualTyping.ts, 231, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x229 : Symbol(x229, Decl(generatedContextualTyping.ts, 230, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x229 : Symbol(x229, Decl(generatedContextualTyping.ts, 231, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x230: { (): Base[]; }; x230 = function named() { return [d1, d2] }; ->x230 : Symbol(x230, Decl(generatedContextualTyping.ts, 231, 3)) +>x230 : Symbol(x230, Decl(generatedContextualTyping.ts, 232, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x230 : Symbol(x230, Decl(generatedContextualTyping.ts, 231, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 231, 33)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x230 : Symbol(x230, Decl(generatedContextualTyping.ts, 232, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 232, 33)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x231: Base[]; x231 = [d1, d2]; ->x231 : Symbol(x231, Decl(generatedContextualTyping.ts, 232, 3)) +>x231 : Symbol(x231, Decl(generatedContextualTyping.ts, 233, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x231 : Symbol(x231, Decl(generatedContextualTyping.ts, 232, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x231 : Symbol(x231, Decl(generatedContextualTyping.ts, 233, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x232: Array; x232 = [d1, d2]; ->x232 : Symbol(x232, Decl(generatedContextualTyping.ts, 233, 3)) +>x232 : Symbol(x232, Decl(generatedContextualTyping.ts, 234, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x232 : Symbol(x232, Decl(generatedContextualTyping.ts, 233, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x232 : Symbol(x232, Decl(generatedContextualTyping.ts, 234, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x233: { [n: number]: Base; }; x233 = [d1, d2]; ->x233 : Symbol(x233, Decl(generatedContextualTyping.ts, 234, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 234, 13)) +>x233 : Symbol(x233, Decl(generatedContextualTyping.ts, 235, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 235, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x233 : Symbol(x233, Decl(generatedContextualTyping.ts, 234, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x233 : Symbol(x233, Decl(generatedContextualTyping.ts, 235, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x234: {n: Base[]; } ; x234 = { n: [d1, d2] }; ->x234 : Symbol(x234, Decl(generatedContextualTyping.ts, 235, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 235, 11)) +>x234 : Symbol(x234, Decl(generatedContextualTyping.ts, 236, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 236, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x234 : Symbol(x234, Decl(generatedContextualTyping.ts, 235, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 235, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x234 : Symbol(x234, Decl(generatedContextualTyping.ts, 236, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 236, 34)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x235: (s: Base[]) => any; x235 = n => { var n: Base[]; return null; }; ->x235 : Symbol(x235, Decl(generatedContextualTyping.ts, 236, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 236, 11)) +>x235 : Symbol(x235, Decl(generatedContextualTyping.ts, 237, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 237, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x235 : Symbol(x235, Decl(generatedContextualTyping.ts, 236, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 236, 36), Decl(generatedContextualTyping.ts, 236, 47)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 236, 36), Decl(generatedContextualTyping.ts, 236, 47)) +>x235 : Symbol(x235, Decl(generatedContextualTyping.ts, 237, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 237, 36), Decl(generatedContextualTyping.ts, 237, 47)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 237, 36), Decl(generatedContextualTyping.ts, 237, 47)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x236: Genric; x236 = { func: n => { return [d1, d2]; } }; ->x236 : Symbol(x236, Decl(generatedContextualTyping.ts, 237, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x236 : Symbol(x236, Decl(generatedContextualTyping.ts, 238, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x236 : Symbol(x236, Decl(generatedContextualTyping.ts, 237, 3)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 237, 32)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 237, 38)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x236 : Symbol(x236, Decl(generatedContextualTyping.ts, 238, 3)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 238, 32)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 238, 38)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x237: { n: () => Base[]; } = { n: () => [d1, d2] }; ->x237 : Symbol(x237, Decl(generatedContextualTyping.ts, 238, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 238, 11)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 238, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -var x238: { n: () => Base[]; } = { n: function() { return [d1, d2] } }; ->x238 : Symbol(x238, Decl(generatedContextualTyping.ts, 239, 3)) +>x237 : Symbol(x237, Decl(generatedContextualTyping.ts, 239, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 239, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 239, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x239: { n: () => Base[]; } = { n: function named() { return [d1, d2] } }; ->x239 : Symbol(x239, Decl(generatedContextualTyping.ts, 240, 3)) +var x238: { n: () => Base[]; } = { n: function() { return [d1, d2] } }; +>x238 : Symbol(x238, Decl(generatedContextualTyping.ts, 240, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 240, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 240, 34)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 240, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x240: { n: { (): Base[]; }; } = { n: () => [d1, d2] }; ->x240 : Symbol(x240, Decl(generatedContextualTyping.ts, 241, 3)) +var x239: { n: () => Base[]; } = { n: function named() { return [d1, d2] } }; +>x239 : Symbol(x239, Decl(generatedContextualTyping.ts, 241, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 241, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 241, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 241, 34)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 241, 37)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x241: { n: { (): Base[]; }; } = { n: function() { return [d1, d2] } }; ->x241 : Symbol(x241, Decl(generatedContextualTyping.ts, 242, 3)) +var x240: { n: { (): Base[]; }; } = { n: () => [d1, d2] }; +>x240 : Symbol(x240, Decl(generatedContextualTyping.ts, 242, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 242, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 242, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x242: { n: { (): Base[]; }; } = { n: function named() { return [d1, d2] } }; ->x242 : Symbol(x242, Decl(generatedContextualTyping.ts, 243, 3)) +var x241: { n: { (): Base[]; }; } = { n: function() { return [d1, d2] } }; +>x241 : Symbol(x241, Decl(generatedContextualTyping.ts, 243, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 243, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 243, 37)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 243, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x243: { n: Base[]; } = { n: [d1, d2] }; ->x243 : Symbol(x243, Decl(generatedContextualTyping.ts, 244, 3)) +var x242: { n: { (): Base[]; }; } = { n: function named() { return [d1, d2] } }; +>x242 : Symbol(x242, Decl(generatedContextualTyping.ts, 244, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 244, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 244, 28)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 244, 37)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 244, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +var x243: { n: Base[]; } = { n: [d1, d2] }; +>x243 : Symbol(x243, Decl(generatedContextualTyping.ts, 245, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 245, 11)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 245, 28)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x244: { n: Array; } = { n: [d1, d2] }; ->x244 : Symbol(x244, Decl(generatedContextualTyping.ts, 245, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 245, 11)) +>x244 : Symbol(x244, Decl(generatedContextualTyping.ts, 246, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 246, 11)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 245, 33)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 246, 33)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x245: { n: { [n: number]: Base; }; } = { n: [d1, d2] }; ->x245 : Symbol(x245, Decl(generatedContextualTyping.ts, 246, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 246, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 246, 18)) +>x245 : Symbol(x245, Decl(generatedContextualTyping.ts, 247, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 246, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x246: { n: {n: Base[]; } ; } = { n: { n: [d1, d2] } }; ->x246 : Symbol(x246, Decl(generatedContextualTyping.ts, 247, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 11)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 16)) +>x246 : Symbol(x246, Decl(generatedContextualTyping.ts, 248, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 11)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 16)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 36)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 247, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 36)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x247: { n: (s: Base[]) => any; } = { n: n => { var n: Base[]; return null; } }; ->x247 : Symbol(x247, Decl(generatedContextualTyping.ts, 248, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 11)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 248, 16)) +>x247 : Symbol(x247, Decl(generatedContextualTyping.ts, 249, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 11)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 249, 16)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 43), Decl(generatedContextualTyping.ts, 248, 54)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 248, 43), Decl(generatedContextualTyping.ts, 248, 54)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 43), Decl(generatedContextualTyping.ts, 249, 54)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 43), Decl(generatedContextualTyping.ts, 249, 54)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x248: { n: Genric; } = { n: { func: n => { return [d1, d2]; } } }; ->x248 : Symbol(x248, Decl(generatedContextualTyping.ts, 249, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 11)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x248 : Symbol(x248, Decl(generatedContextualTyping.ts, 250, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 250, 11)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 34)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 249, 39)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 249, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 250, 34)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 250, 39)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 250, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x252: { (): Base[]; }[] = [() => [d1, d2]]; ->x252 : Symbol(x252, Decl(generatedContextualTyping.ts, 250, 3)) +>x252 : Symbol(x252, Decl(generatedContextualTyping.ts, 251, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x253: { (): Base[]; }[] = [function() { return [d1, d2] }]; ->x253 : Symbol(x253, Decl(generatedContextualTyping.ts, 251, 3)) +>x253 : Symbol(x253, Decl(generatedContextualTyping.ts, 252, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x254: { (): Base[]; }[] = [function named() { return [d1, d2] }]; ->x254 : Symbol(x254, Decl(generatedContextualTyping.ts, 252, 3)) +>x254 : Symbol(x254, Decl(generatedContextualTyping.ts, 253, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 252, 31)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 253, 31)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x255: Base[][] = [[d1, d2]]; ->x255 : Symbol(x255, Decl(generatedContextualTyping.ts, 253, 3)) +>x255 : Symbol(x255, Decl(generatedContextualTyping.ts, 254, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x256: Array[] = [[d1, d2]]; ->x256 : Symbol(x256, Decl(generatedContextualTyping.ts, 254, 3)) +>x256 : Symbol(x256, Decl(generatedContextualTyping.ts, 255, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x257: { [n: number]: Base; }[] = [[d1, d2]]; ->x257 : Symbol(x257, Decl(generatedContextualTyping.ts, 255, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 255, 13)) +>x257 : Symbol(x257, Decl(generatedContextualTyping.ts, 256, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 256, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x258: {n: Base[]; } [] = [{ n: [d1, d2] }]; ->x258 : Symbol(x258, Decl(generatedContextualTyping.ts, 256, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 256, 11)) +>x258 : Symbol(x258, Decl(generatedContextualTyping.ts, 257, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 257, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 256, 31)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 257, 31)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x260: Genric[] = [{ func: n => { return [d1, d2]; } }]; ->x260 : Symbol(x260, Decl(generatedContextualTyping.ts, 257, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x260 : Symbol(x260, Decl(generatedContextualTyping.ts, 258, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 257, 29)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 257, 35)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 258, 29)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 258, 35)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x261: () => Base[] = function() { return [d1, d2] } || undefined; ->x261 : Symbol(x261, Decl(generatedContextualTyping.ts, 258, 3)) +>x261 : Symbol(x261, Decl(generatedContextualTyping.ts, 259, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x262: () => Base[] = function named() { return [d1, d2] } || undefined; ->x262 : Symbol(x262, Decl(generatedContextualTyping.ts, 259, 3)) +>x262 : Symbol(x262, Decl(generatedContextualTyping.ts, 260, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 259, 24)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 260, 24)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x263: { (): Base[]; } = function() { return [d1, d2] } || undefined; ->x263 : Symbol(x263, Decl(generatedContextualTyping.ts, 260, 3)) +>x263 : Symbol(x263, Decl(generatedContextualTyping.ts, 261, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x264: { (): Base[]; } = function named() { return [d1, d2] } || undefined; ->x264 : Symbol(x264, Decl(generatedContextualTyping.ts, 261, 3)) +>x264 : Symbol(x264, Decl(generatedContextualTyping.ts, 262, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 261, 27)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 262, 27)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x265: Base[] = [d1, d2] || undefined; ->x265 : Symbol(x265, Decl(generatedContextualTyping.ts, 262, 3)) +>x265 : Symbol(x265, Decl(generatedContextualTyping.ts, 263, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x266: Array = [d1, d2] || undefined; ->x266 : Symbol(x266, Decl(generatedContextualTyping.ts, 263, 3)) +>x266 : Symbol(x266, Decl(generatedContextualTyping.ts, 264, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x267: { [n: number]: Base; } = [d1, d2] || undefined; ->x267 : Symbol(x267, Decl(generatedContextualTyping.ts, 264, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 264, 13)) +>x267 : Symbol(x267, Decl(generatedContextualTyping.ts, 265, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 265, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x268: {n: Base[]; } = { n: [d1, d2] } || undefined; ->x268 : Symbol(x268, Decl(generatedContextualTyping.ts, 265, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 265, 11)) +>x268 : Symbol(x268, Decl(generatedContextualTyping.ts, 266, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 266, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 265, 28)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 266, 28)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x269: () => Base[] = undefined || function() { return [d1, d2] }; ->x269 : Symbol(x269, Decl(generatedContextualTyping.ts, 266, 3)) +>x269 : Symbol(x269, Decl(generatedContextualTyping.ts, 267, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x270: () => Base[] = undefined || function named() { return [d1, d2] }; ->x270 : Symbol(x270, Decl(generatedContextualTyping.ts, 267, 3)) +>x270 : Symbol(x270, Decl(generatedContextualTyping.ts, 268, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 267, 37)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 268, 37)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x271: { (): Base[]; } = undefined || function() { return [d1, d2] }; ->x271 : Symbol(x271, Decl(generatedContextualTyping.ts, 268, 3)) +>x271 : Symbol(x271, Decl(generatedContextualTyping.ts, 269, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x272: { (): Base[]; } = undefined || function named() { return [d1, d2] }; ->x272 : Symbol(x272, Decl(generatedContextualTyping.ts, 269, 3)) +>x272 : Symbol(x272, Decl(generatedContextualTyping.ts, 270, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 269, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 270, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x273: Base[] = undefined || [d1, d2]; ->x273 : Symbol(x273, Decl(generatedContextualTyping.ts, 270, 3)) +>x273 : Symbol(x273, Decl(generatedContextualTyping.ts, 271, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x274: Array = undefined || [d1, d2]; ->x274 : Symbol(x274, Decl(generatedContextualTyping.ts, 271, 3)) +>x274 : Symbol(x274, Decl(generatedContextualTyping.ts, 272, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x275: { [n: number]: Base; } = undefined || [d1, d2]; ->x275 : Symbol(x275, Decl(generatedContextualTyping.ts, 272, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 272, 13)) +>x275 : Symbol(x275, Decl(generatedContextualTyping.ts, 273, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 273, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x276: {n: Base[]; } = undefined || { n: [d1, d2] }; ->x276 : Symbol(x276, Decl(generatedContextualTyping.ts, 273, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 273, 11)) +>x276 : Symbol(x276, Decl(generatedContextualTyping.ts, 274, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 274, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 273, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 274, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x277: () => Base[] = function() { return [d1, d2] } || function() { return [d1, d2] }; ->x277 : Symbol(x277, Decl(generatedContextualTyping.ts, 274, 3)) +>x277 : Symbol(x277, Decl(generatedContextualTyping.ts, 275, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x278: () => Base[] = function named() { return [d1, d2] } || function named() { return [d1, d2] }; ->x278 : Symbol(x278, Decl(generatedContextualTyping.ts, 275, 3)) +>x278 : Symbol(x278, Decl(generatedContextualTyping.ts, 276, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 275, 24)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 275, 64)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 276, 24)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 276, 64)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x279: { (): Base[]; } = function() { return [d1, d2] } || function() { return [d1, d2] }; ->x279 : Symbol(x279, Decl(generatedContextualTyping.ts, 276, 3)) +>x279 : Symbol(x279, Decl(generatedContextualTyping.ts, 277, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x280: { (): Base[]; } = function named() { return [d1, d2] } || function named() { return [d1, d2] }; ->x280 : Symbol(x280, Decl(generatedContextualTyping.ts, 277, 3)) +>x280 : Symbol(x280, Decl(generatedContextualTyping.ts, 278, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 277, 27)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 277, 67)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 278, 27)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 278, 67)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x281: Base[] = [d1, d2] || [d1, d2]; ->x281 : Symbol(x281, Decl(generatedContextualTyping.ts, 278, 3)) +>x281 : Symbol(x281, Decl(generatedContextualTyping.ts, 279, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x282: Array = [d1, d2] || [d1, d2]; ->x282 : Symbol(x282, Decl(generatedContextualTyping.ts, 279, 3)) +>x282 : Symbol(x282, Decl(generatedContextualTyping.ts, 280, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x283: { [n: number]: Base; } = [d1, d2] || [d1, d2]; ->x283 : Symbol(x283, Decl(generatedContextualTyping.ts, 280, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 280, 13)) +>x283 : Symbol(x283, Decl(generatedContextualTyping.ts, 281, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 281, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x284: {n: Base[]; } = { n: [d1, d2] } || { n: [d1, d2] }; ->x284 : Symbol(x284, Decl(generatedContextualTyping.ts, 281, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 281, 11)) +>x284 : Symbol(x284, Decl(generatedContextualTyping.ts, 282, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 282, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 281, 28)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 281, 47)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 282, 28)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 282, 47)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x285: () => Base[] = true ? () => [d1, d2] : () => [d1, d2]; ->x285 : Symbol(x285, Decl(generatedContextualTyping.ts, 282, 3)) +>x285 : Symbol(x285, Decl(generatedContextualTyping.ts, 283, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x286: () => Base[] = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; ->x286 : Symbol(x286, Decl(generatedContextualTyping.ts, 283, 3)) +>x286 : Symbol(x286, Decl(generatedContextualTyping.ts, 284, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x287: () => Base[] = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; ->x287 : Symbol(x287, Decl(generatedContextualTyping.ts, 284, 3)) +>x287 : Symbol(x287, Decl(generatedContextualTyping.ts, 285, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 284, 31)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 284, 70)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 285, 31)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 285, 70)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x288: { (): Base[]; } = true ? () => [d1, d2] : () => [d1, d2]; ->x288 : Symbol(x288, Decl(generatedContextualTyping.ts, 285, 3)) +>x288 : Symbol(x288, Decl(generatedContextualTyping.ts, 286, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x289: { (): Base[]; } = true ? function() { return [d1, d2] } : function() { return [d1, d2] }; ->x289 : Symbol(x289, Decl(generatedContextualTyping.ts, 286, 3)) +>x289 : Symbol(x289, Decl(generatedContextualTyping.ts, 287, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x290: { (): Base[]; } = true ? function named() { return [d1, d2] } : function named() { return [d1, d2] }; ->x290 : Symbol(x290, Decl(generatedContextualTyping.ts, 287, 3)) +>x290 : Symbol(x290, Decl(generatedContextualTyping.ts, 288, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 287, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 287, 73)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 288, 34)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 288, 73)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x291: Base[] = true ? [d1, d2] : [d1, d2]; ->x291 : Symbol(x291, Decl(generatedContextualTyping.ts, 288, 3)) +>x291 : Symbol(x291, Decl(generatedContextualTyping.ts, 289, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x292: Array = true ? [d1, d2] : [d1, d2]; ->x292 : Symbol(x292, Decl(generatedContextualTyping.ts, 289, 3)) +>x292 : Symbol(x292, Decl(generatedContextualTyping.ts, 290, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x293: { [n: number]: Base; } = true ? [d1, d2] : [d1, d2]; ->x293 : Symbol(x293, Decl(generatedContextualTyping.ts, 290, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 290, 13)) +>x293 : Symbol(x293, Decl(generatedContextualTyping.ts, 291, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 291, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x294: {n: Base[]; } = true ? { n: [d1, d2] } : { n: [d1, d2] }; ->x294 : Symbol(x294, Decl(generatedContextualTyping.ts, 291, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 291, 11)) +>x294 : Symbol(x294, Decl(generatedContextualTyping.ts, 292, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 291, 35)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 291, 53)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 35)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 53)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x295: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : n => { var n: Base[]; return null; }; ->x295 : Symbol(x295, Decl(generatedContextualTyping.ts, 292, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 292, 11)) +>x295 : Symbol(x295, Decl(generatedContextualTyping.ts, 293, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 293, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 37), Decl(generatedContextualTyping.ts, 292, 48)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 37), Decl(generatedContextualTyping.ts, 292, 48)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 37), Decl(generatedContextualTyping.ts, 293, 48)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 37), Decl(generatedContextualTyping.ts, 293, 48)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 76), Decl(generatedContextualTyping.ts, 292, 87)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 292, 76), Decl(generatedContextualTyping.ts, 292, 87)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 76), Decl(generatedContextualTyping.ts, 293, 87)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 76), Decl(generatedContextualTyping.ts, 293, 87)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x296: Genric = true ? { func: n => { return [d1, d2]; } } : { func: n => { return [d1, d2]; } }; ->x296 : Symbol(x296, Decl(generatedContextualTyping.ts, 293, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x296 : Symbol(x296, Decl(generatedContextualTyping.ts, 294, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 293, 33)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 39)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 293, 71)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 293, 77)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 294, 33)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 294, 39)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 294, 71)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 294, 77)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x297: () => Base[] = true ? undefined : () => [d1, d2]; ->x297 : Symbol(x297, Decl(generatedContextualTyping.ts, 294, 3)) +>x297 : Symbol(x297, Decl(generatedContextualTyping.ts, 295, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x298: () => Base[] = true ? undefined : function() { return [d1, d2] }; ->x298 : Symbol(x298, Decl(generatedContextualTyping.ts, 295, 3)) +>x298 : Symbol(x298, Decl(generatedContextualTyping.ts, 296, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x299: () => Base[] = true ? undefined : function named() { return [d1, d2] }; ->x299 : Symbol(x299, Decl(generatedContextualTyping.ts, 296, 3)) +>x299 : Symbol(x299, Decl(generatedContextualTyping.ts, 297, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 296, 43)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 297, 43)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x300: { (): Base[]; } = true ? undefined : () => [d1, d2]; ->x300 : Symbol(x300, Decl(generatedContextualTyping.ts, 297, 3)) +>x300 : Symbol(x300, Decl(generatedContextualTyping.ts, 298, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x301: { (): Base[]; } = true ? undefined : function() { return [d1, d2] }; ->x301 : Symbol(x301, Decl(generatedContextualTyping.ts, 298, 3)) +>x301 : Symbol(x301, Decl(generatedContextualTyping.ts, 299, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x302: { (): Base[]; } = true ? undefined : function named() { return [d1, d2] }; ->x302 : Symbol(x302, Decl(generatedContextualTyping.ts, 299, 3)) +>x302 : Symbol(x302, Decl(generatedContextualTyping.ts, 300, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 299, 46)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 300, 46)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x303: Base[] = true ? undefined : [d1, d2]; ->x303 : Symbol(x303, Decl(generatedContextualTyping.ts, 300, 3)) +>x303 : Symbol(x303, Decl(generatedContextualTyping.ts, 301, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x304: Array = true ? undefined : [d1, d2]; ->x304 : Symbol(x304, Decl(generatedContextualTyping.ts, 301, 3)) +>x304 : Symbol(x304, Decl(generatedContextualTyping.ts, 302, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x305: { [n: number]: Base; } = true ? undefined : [d1, d2]; ->x305 : Symbol(x305, Decl(generatedContextualTyping.ts, 302, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 302, 13)) +>x305 : Symbol(x305, Decl(generatedContextualTyping.ts, 303, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 303, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x306: {n: Base[]; } = true ? undefined : { n: [d1, d2] }; ->x306 : Symbol(x306, Decl(generatedContextualTyping.ts, 303, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 303, 11)) +>x306 : Symbol(x306, Decl(generatedContextualTyping.ts, 304, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 304, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 303, 47)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 304, 47)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x307: (s: Base[]) => any = true ? undefined : n => { var n: Base[]; return null; }; ->x307 : Symbol(x307, Decl(generatedContextualTyping.ts, 304, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 304, 11)) +>x307 : Symbol(x307, Decl(generatedContextualTyping.ts, 305, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 305, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 304, 49), Decl(generatedContextualTyping.ts, 304, 60)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 304, 49), Decl(generatedContextualTyping.ts, 304, 60)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 305, 49), Decl(generatedContextualTyping.ts, 305, 60)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 305, 49), Decl(generatedContextualTyping.ts, 305, 60)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x308: Genric = true ? undefined : { func: n => { return [d1, d2]; } }; ->x308 : Symbol(x308, Decl(generatedContextualTyping.ts, 305, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x308 : Symbol(x308, Decl(generatedContextualTyping.ts, 306, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 305, 45)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 305, 51)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 306, 45)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 306, 51)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x309: () => Base[] = true ? () => [d1, d2] : undefined; ->x309 : Symbol(x309, Decl(generatedContextualTyping.ts, 306, 3)) +>x309 : Symbol(x309, Decl(generatedContextualTyping.ts, 307, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x310: () => Base[] = true ? function() { return [d1, d2] } : undefined; ->x310 : Symbol(x310, Decl(generatedContextualTyping.ts, 307, 3)) +>x310 : Symbol(x310, Decl(generatedContextualTyping.ts, 308, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x311: () => Base[] = true ? function named() { return [d1, d2] } : undefined; ->x311 : Symbol(x311, Decl(generatedContextualTyping.ts, 308, 3)) +>x311 : Symbol(x311, Decl(generatedContextualTyping.ts, 309, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 308, 31)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 309, 31)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x312: { (): Base[]; } = true ? () => [d1, d2] : undefined; ->x312 : Symbol(x312, Decl(generatedContextualTyping.ts, 309, 3)) +>x312 : Symbol(x312, Decl(generatedContextualTyping.ts, 310, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x313: { (): Base[]; } = true ? function() { return [d1, d2] } : undefined; ->x313 : Symbol(x313, Decl(generatedContextualTyping.ts, 310, 3)) +>x313 : Symbol(x313, Decl(generatedContextualTyping.ts, 311, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x314: { (): Base[]; } = true ? function named() { return [d1, d2] } : undefined; ->x314 : Symbol(x314, Decl(generatedContextualTyping.ts, 311, 3)) +>x314 : Symbol(x314, Decl(generatedContextualTyping.ts, 312, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 311, 34)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 312, 34)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x315: Base[] = true ? [d1, d2] : undefined; ->x315 : Symbol(x315, Decl(generatedContextualTyping.ts, 312, 3)) +>x315 : Symbol(x315, Decl(generatedContextualTyping.ts, 313, 3)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x316: Array = true ? [d1, d2] : undefined; ->x316 : Symbol(x316, Decl(generatedContextualTyping.ts, 313, 3)) +>x316 : Symbol(x316, Decl(generatedContextualTyping.ts, 314, 3)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x317: { [n: number]: Base; } = true ? [d1, d2] : undefined; ->x317 : Symbol(x317, Decl(generatedContextualTyping.ts, 314, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 314, 13)) +>x317 : Symbol(x317, Decl(generatedContextualTyping.ts, 315, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 315, 13)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x318: {n: Base[]; } = true ? { n: [d1, d2] } : undefined; ->x318 : Symbol(x318, Decl(generatedContextualTyping.ts, 315, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 315, 11)) +>x318 : Symbol(x318, Decl(generatedContextualTyping.ts, 316, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 316, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 315, 35)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 316, 35)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) var x319: (s: Base[]) => any = true ? n => { var n: Base[]; return null; } : undefined; ->x319 : Symbol(x319, Decl(generatedContextualTyping.ts, 316, 3)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 316, 11)) +>x319 : Symbol(x319, Decl(generatedContextualTyping.ts, 317, 3)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 317, 11)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 316, 37), Decl(generatedContextualTyping.ts, 316, 48)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 316, 37), Decl(generatedContextualTyping.ts, 316, 48)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 317, 37), Decl(generatedContextualTyping.ts, 317, 48)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 317, 37), Decl(generatedContextualTyping.ts, 317, 48)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) >undefined : Symbol(undefined) var x320: Genric = true ? { func: n => { return [d1, d2]; } } : undefined; ->x320 : Symbol(x320, Decl(generatedContextualTyping.ts, 317, 3)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x320 : Symbol(x320, Decl(generatedContextualTyping.ts, 318, 3)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 317, 33)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 317, 39)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 318, 33)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 318, 39)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) >undefined : Symbol(undefined) function x321(n: () => Base[]) { }; x321(() => [d1, d2]); ->x321 : Symbol(x321, Decl(generatedContextualTyping.ts, 317, 80)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 318, 14)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x321 : Symbol(x321, Decl(generatedContextualTyping.ts, 317, 80)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -function x322(n: () => Base[]) { }; x322(function() { return [d1, d2] }); ->x322 : Symbol(x322, Decl(generatedContextualTyping.ts, 318, 57)) +>x321 : Symbol(x321, Decl(generatedContextualTyping.ts, 318, 80)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 319, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x322 : Symbol(x322, Decl(generatedContextualTyping.ts, 318, 57)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x321 : Symbol(x321, Decl(generatedContextualTyping.ts, 318, 80)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x323(n: () => Base[]) { }; x323(function named() { return [d1, d2] }); ->x323 : Symbol(x323, Decl(generatedContextualTyping.ts, 319, 73)) +function x322(n: () => Base[]) { }; x322(function() { return [d1, d2] }); +>x322 : Symbol(x322, Decl(generatedContextualTyping.ts, 319, 57)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 320, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x323 : Symbol(x323, Decl(generatedContextualTyping.ts, 319, 73)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 320, 41)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x322 : Symbol(x322, Decl(generatedContextualTyping.ts, 319, 57)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x324(n: { (): Base[]; }) { }; x324(() => [d1, d2]); ->x324 : Symbol(x324, Decl(generatedContextualTyping.ts, 320, 79)) +function x323(n: () => Base[]) { }; x323(function named() { return [d1, d2] }); +>x323 : Symbol(x323, Decl(generatedContextualTyping.ts, 320, 73)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 321, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x324 : Symbol(x324, Decl(generatedContextualTyping.ts, 320, 79)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x323 : Symbol(x323, Decl(generatedContextualTyping.ts, 320, 73)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 321, 41)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x325(n: { (): Base[]; }) { }; x325(function() { return [d1, d2] }); ->x325 : Symbol(x325, Decl(generatedContextualTyping.ts, 321, 60)) +function x324(n: { (): Base[]; }) { }; x324(() => [d1, d2]); +>x324 : Symbol(x324, Decl(generatedContextualTyping.ts, 321, 79)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 322, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x325 : Symbol(x325, Decl(generatedContextualTyping.ts, 321, 60)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x324 : Symbol(x324, Decl(generatedContextualTyping.ts, 321, 79)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x326(n: { (): Base[]; }) { }; x326(function named() { return [d1, d2] }); ->x326 : Symbol(x326, Decl(generatedContextualTyping.ts, 322, 76)) +function x325(n: { (): Base[]; }) { }; x325(function() { return [d1, d2] }); +>x325 : Symbol(x325, Decl(generatedContextualTyping.ts, 322, 60)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 323, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x326 : Symbol(x326, Decl(generatedContextualTyping.ts, 322, 76)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 323, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x325 : Symbol(x325, Decl(generatedContextualTyping.ts, 322, 60)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -function x327(n: Base[]) { }; x327([d1, d2]); ->x327 : Symbol(x327, Decl(generatedContextualTyping.ts, 323, 82)) +function x326(n: { (): Base[]; }) { }; x326(function named() { return [d1, d2] }); +>x326 : Symbol(x326, Decl(generatedContextualTyping.ts, 323, 76)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 324, 14)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x327 : Symbol(x327, Decl(generatedContextualTyping.ts, 323, 82)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x326 : Symbol(x326, Decl(generatedContextualTyping.ts, 323, 76)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 324, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +function x327(n: Base[]) { }; x327([d1, d2]); +>x327 : Symbol(x327, Decl(generatedContextualTyping.ts, 324, 82)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 325, 14)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>x327 : Symbol(x327, Decl(generatedContextualTyping.ts, 324, 82)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x328(n: Array) { }; x328([d1, d2]); ->x328 : Symbol(x328, Decl(generatedContextualTyping.ts, 324, 45)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 325, 14)) +>x328 : Symbol(x328, Decl(generatedContextualTyping.ts, 325, 45)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 326, 14)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x328 : Symbol(x328, Decl(generatedContextualTyping.ts, 324, 45)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x328 : Symbol(x328, Decl(generatedContextualTyping.ts, 325, 45)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x329(n: { [n: number]: Base; }) { }; x329([d1, d2]); ->x329 : Symbol(x329, Decl(generatedContextualTyping.ts, 325, 50)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 326, 14)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 326, 20)) +>x329 : Symbol(x329, Decl(generatedContextualTyping.ts, 326, 50)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 327, 14)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 327, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x329 : Symbol(x329, Decl(generatedContextualTyping.ts, 325, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x329 : Symbol(x329, Decl(generatedContextualTyping.ts, 326, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x330(n: {n: Base[]; } ) { }; x330({ n: [d1, d2] }); ->x330 : Symbol(x330, Decl(generatedContextualTyping.ts, 326, 61)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 327, 14)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 327, 18)) +>x330 : Symbol(x330, Decl(generatedContextualTyping.ts, 327, 61)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 14)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x330 : Symbol(x330, Decl(generatedContextualTyping.ts, 326, 61)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 327, 44)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x330 : Symbol(x330, Decl(generatedContextualTyping.ts, 327, 61)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 44)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) function x331(n: (s: Base[]) => any) { }; x331(n => { var n: Base[]; return null; }); ->x331 : Symbol(x331, Decl(generatedContextualTyping.ts, 327, 60)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 14)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 328, 18)) +>x331 : Symbol(x331, Decl(generatedContextualTyping.ts, 328, 60)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 329, 14)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 329, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x331 : Symbol(x331, Decl(generatedContextualTyping.ts, 327, 60)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 47), Decl(generatedContextualTyping.ts, 328, 57)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 328, 47), Decl(generatedContextualTyping.ts, 328, 57)) +>x331 : Symbol(x331, Decl(generatedContextualTyping.ts, 328, 60)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 329, 47), Decl(generatedContextualTyping.ts, 329, 57)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 329, 47), Decl(generatedContextualTyping.ts, 329, 57)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) function x332(n: Genric) { }; x332({ func: n => { return [d1, d2]; } }); ->x332 : Symbol(x332, Decl(generatedContextualTyping.ts, 328, 85)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 329, 14)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x332 : Symbol(x332, Decl(generatedContextualTyping.ts, 329, 85)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 330, 14)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x332 : Symbol(x332, Decl(generatedContextualTyping.ts, 328, 85)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 329, 42)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 329, 48)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x332 : Symbol(x332, Decl(generatedContextualTyping.ts, 329, 85)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 330, 42)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 330, 48)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x333 = (n: () => Base[]) => n; x333(() => [d1, d2]); ->x333 : Symbol(x333, Decl(generatedContextualTyping.ts, 330, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 330, 12)) +>x333 : Symbol(x333, Decl(generatedContextualTyping.ts, 331, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 331, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 330, 12)) ->x333 : Symbol(x333, Decl(generatedContextualTyping.ts, 330, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 331, 12)) +>x333 : Symbol(x333, Decl(generatedContextualTyping.ts, 331, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x334 = (n: () => Base[]) => n; x334(function() { return [d1, d2] }); ->x334 : Symbol(x334, Decl(generatedContextualTyping.ts, 331, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 331, 12)) +>x334 : Symbol(x334, Decl(generatedContextualTyping.ts, 332, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 332, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 331, 12)) ->x334 : Symbol(x334, Decl(generatedContextualTyping.ts, 331, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 332, 12)) +>x334 : Symbol(x334, Decl(generatedContextualTyping.ts, 332, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x335 = (n: () => Base[]) => n; x335(function named() { return [d1, d2] }); ->x335 : Symbol(x335, Decl(generatedContextualTyping.ts, 332, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 332, 12)) +>x335 : Symbol(x335, Decl(generatedContextualTyping.ts, 333, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 333, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 332, 12)) ->x335 : Symbol(x335, Decl(generatedContextualTyping.ts, 332, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 332, 40)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 333, 12)) +>x335 : Symbol(x335, Decl(generatedContextualTyping.ts, 333, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 333, 40)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x336 = (n: { (): Base[]; }) => n; x336(() => [d1, d2]); ->x336 : Symbol(x336, Decl(generatedContextualTyping.ts, 333, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 333, 12)) +>x336 : Symbol(x336, Decl(generatedContextualTyping.ts, 334, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 334, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 333, 12)) ->x336 : Symbol(x336, Decl(generatedContextualTyping.ts, 333, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 334, 12)) +>x336 : Symbol(x336, Decl(generatedContextualTyping.ts, 334, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x337 = (n: { (): Base[]; }) => n; x337(function() { return [d1, d2] }); ->x337 : Symbol(x337, Decl(generatedContextualTyping.ts, 334, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 334, 12)) +>x337 : Symbol(x337, Decl(generatedContextualTyping.ts, 335, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 335, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 334, 12)) ->x337 : Symbol(x337, Decl(generatedContextualTyping.ts, 334, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 335, 12)) +>x337 : Symbol(x337, Decl(generatedContextualTyping.ts, 335, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x338 = (n: { (): Base[]; }) => n; x338(function named() { return [d1, d2] }); ->x338 : Symbol(x338, Decl(generatedContextualTyping.ts, 335, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 335, 12)) +>x338 : Symbol(x338, Decl(generatedContextualTyping.ts, 336, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 336, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 335, 12)) ->x338 : Symbol(x338, Decl(generatedContextualTyping.ts, 335, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 335, 43)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 336, 12)) +>x338 : Symbol(x338, Decl(generatedContextualTyping.ts, 336, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 336, 43)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x339 = (n: Base[]) => n; x339([d1, d2]); ->x339 : Symbol(x339, Decl(generatedContextualTyping.ts, 336, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 336, 12)) +>x339 : Symbol(x339, Decl(generatedContextualTyping.ts, 337, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 337, 12)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 336, 12)) ->x339 : Symbol(x339, Decl(generatedContextualTyping.ts, 336, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 337, 12)) +>x339 : Symbol(x339, Decl(generatedContextualTyping.ts, 337, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x340 = (n: Array) => n; x340([d1, d2]); ->x340 : Symbol(x340, Decl(generatedContextualTyping.ts, 337, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 337, 12)) +>x340 : Symbol(x340, Decl(generatedContextualTyping.ts, 338, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 338, 12)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 337, 12)) ->x340 : Symbol(x340, Decl(generatedContextualTyping.ts, 337, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 338, 12)) +>x340 : Symbol(x340, Decl(generatedContextualTyping.ts, 338, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]); ->x341 : Symbol(x341, Decl(generatedContextualTyping.ts, 338, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 338, 12)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 338, 18)) +>x341 : Symbol(x341, Decl(generatedContextualTyping.ts, 339, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 12)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 18)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 338, 12)) ->x341 : Symbol(x341, Decl(generatedContextualTyping.ts, 338, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 12)) +>x341 : Symbol(x341, Decl(generatedContextualTyping.ts, 339, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x342 = (n: {n: Base[]; } ) => n; x342({ n: [d1, d2] }); ->x342 : Symbol(x342, Decl(generatedContextualTyping.ts, 339, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 12)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 16)) +>x342 : Symbol(x342, Decl(generatedContextualTyping.ts, 340, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 12)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 16)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 12)) ->x342 : Symbol(x342, Decl(generatedContextualTyping.ts, 339, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 339, 43)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 12)) +>x342 : Symbol(x342, Decl(generatedContextualTyping.ts, 340, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 43)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x343 = (n: (s: Base[]) => any) => n; x343(n => { var n: Base[]; return null; }); ->x343 : Symbol(x343, Decl(generatedContextualTyping.ts, 340, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 12)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 340, 16)) +>x343 : Symbol(x343, Decl(generatedContextualTyping.ts, 341, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 12)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 341, 16)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 12)) ->x343 : Symbol(x343, Decl(generatedContextualTyping.ts, 340, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 46), Decl(generatedContextualTyping.ts, 340, 56)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 340, 46), Decl(generatedContextualTyping.ts, 340, 56)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 12)) +>x343 : Symbol(x343, Decl(generatedContextualTyping.ts, 341, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 46), Decl(generatedContextualTyping.ts, 341, 56)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 46), Decl(generatedContextualTyping.ts, 341, 56)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x344 = (n: Genric) => n; x344({ func: n => { return [d1, d2]; } }); ->x344 : Symbol(x344, Decl(generatedContextualTyping.ts, 341, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 12)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x344 : Symbol(x344, Decl(generatedContextualTyping.ts, 342, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 342, 12)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 12)) ->x344 : Symbol(x344, Decl(generatedContextualTyping.ts, 341, 3)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 341, 41)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 341, 47)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 342, 12)) +>x344 : Symbol(x344, Decl(generatedContextualTyping.ts, 342, 3)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 342, 41)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 342, 47)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x345 = function(n: () => Base[]) { }; x345(() => [d1, d2]); ->x345 : Symbol(x345, Decl(generatedContextualTyping.ts, 342, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 342, 20)) ->Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x345 : Symbol(x345, Decl(generatedContextualTyping.ts, 342, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) - -var x346 = function(n: () => Base[]) { }; x346(function() { return [d1, d2] }); ->x346 : Symbol(x346, Decl(generatedContextualTyping.ts, 343, 3)) +>x345 : Symbol(x345, Decl(generatedContextualTyping.ts, 343, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 343, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x346 : Symbol(x346, Decl(generatedContextualTyping.ts, 343, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x345 : Symbol(x345, Decl(generatedContextualTyping.ts, 343, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x347 = function(n: () => Base[]) { }; x347(function named() { return [d1, d2] }); ->x347 : Symbol(x347, Decl(generatedContextualTyping.ts, 344, 3)) +var x346 = function(n: () => Base[]) { }; x346(function() { return [d1, d2] }); +>x346 : Symbol(x346, Decl(generatedContextualTyping.ts, 344, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 344, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x347 : Symbol(x347, Decl(generatedContextualTyping.ts, 344, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 344, 47)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x346 : Symbol(x346, Decl(generatedContextualTyping.ts, 344, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x348 = function(n: { (): Base[]; }) { }; x348(() => [d1, d2]); ->x348 : Symbol(x348, Decl(generatedContextualTyping.ts, 345, 3)) +var x347 = function(n: () => Base[]) { }; x347(function named() { return [d1, d2] }); +>x347 : Symbol(x347, Decl(generatedContextualTyping.ts, 345, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 345, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x348 : Symbol(x348, Decl(generatedContextualTyping.ts, 345, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x347 : Symbol(x347, Decl(generatedContextualTyping.ts, 345, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 345, 47)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x349 = function(n: { (): Base[]; }) { }; x349(function() { return [d1, d2] }); ->x349 : Symbol(x349, Decl(generatedContextualTyping.ts, 346, 3)) +var x348 = function(n: { (): Base[]; }) { }; x348(() => [d1, d2]); +>x348 : Symbol(x348, Decl(generatedContextualTyping.ts, 346, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 346, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x349 : Symbol(x349, Decl(generatedContextualTyping.ts, 346, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x348 : Symbol(x348, Decl(generatedContextualTyping.ts, 346, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x350 = function(n: { (): Base[]; }) { }; x350(function named() { return [d1, d2] }); ->x350 : Symbol(x350, Decl(generatedContextualTyping.ts, 347, 3)) +var x349 = function(n: { (): Base[]; }) { }; x349(function() { return [d1, d2] }); +>x349 : Symbol(x349, Decl(generatedContextualTyping.ts, 347, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 347, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x350 : Symbol(x350, Decl(generatedContextualTyping.ts, 347, 3)) ->named : Symbol(named, Decl(generatedContextualTyping.ts, 347, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x349 : Symbol(x349, Decl(generatedContextualTyping.ts, 347, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) -var x351 = function(n: Base[]) { }; x351([d1, d2]); ->x351 : Symbol(x351, Decl(generatedContextualTyping.ts, 348, 3)) +var x350 = function(n: { (): Base[]; }) { }; x350(function named() { return [d1, d2] }); +>x350 : Symbol(x350, Decl(generatedContextualTyping.ts, 348, 3)) >n : Symbol(n, Decl(generatedContextualTyping.ts, 348, 20)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x351 : Symbol(x351, Decl(generatedContextualTyping.ts, 348, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x350 : Symbol(x350, Decl(generatedContextualTyping.ts, 348, 3)) +>named : Symbol(named, Decl(generatedContextualTyping.ts, 348, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) + +var x351 = function(n: Base[]) { }; x351([d1, d2]); +>x351 : Symbol(x351, Decl(generatedContextualTyping.ts, 349, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 349, 20)) +>Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) +>x351 : Symbol(x351, Decl(generatedContextualTyping.ts, 349, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x352 = function(n: Array) { }; x352([d1, d2]); ->x352 : Symbol(x352, Decl(generatedContextualTyping.ts, 349, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 349, 20)) +>x352 : Symbol(x352, Decl(generatedContextualTyping.ts, 350, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 350, 20)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x352 : Symbol(x352, Decl(generatedContextualTyping.ts, 349, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x352 : Symbol(x352, Decl(generatedContextualTyping.ts, 350, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]); ->x353 : Symbol(x353, Decl(generatedContextualTyping.ts, 350, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 350, 20)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 350, 26)) +>x353 : Symbol(x353, Decl(generatedContextualTyping.ts, 351, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 351, 20)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 351, 26)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x353 : Symbol(x353, Decl(generatedContextualTyping.ts, 350, 3)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x353 : Symbol(x353, Decl(generatedContextualTyping.ts, 351, 3)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x354 = function(n: {n: Base[]; } ) { }; x354({ n: [d1, d2] }); ->x354 : Symbol(x354, Decl(generatedContextualTyping.ts, 351, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 351, 20)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 351, 24)) +>x354 : Symbol(x354, Decl(generatedContextualTyping.ts, 352, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 20)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x354 : Symbol(x354, Decl(generatedContextualTyping.ts, 351, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 351, 50)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x354 : Symbol(x354, Decl(generatedContextualTyping.ts, 352, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 50)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; return null; }); ->x355 : Symbol(x355, Decl(generatedContextualTyping.ts, 352, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 20)) ->s : Symbol(s, Decl(generatedContextualTyping.ts, 352, 24)) +>x355 : Symbol(x355, Decl(generatedContextualTyping.ts, 353, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 353, 20)) +>s : Symbol(s, Decl(generatedContextualTyping.ts, 353, 24)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x355 : Symbol(x355, Decl(generatedContextualTyping.ts, 352, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 53), Decl(generatedContextualTyping.ts, 352, 63)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 352, 53), Decl(generatedContextualTyping.ts, 352, 63)) +>x355 : Symbol(x355, Decl(generatedContextualTyping.ts, 353, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 353, 53), Decl(generatedContextualTyping.ts, 353, 63)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 353, 53), Decl(generatedContextualTyping.ts, 353, 63)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); ->x356 : Symbol(x356, Decl(generatedContextualTyping.ts, 353, 3)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 353, 20)) ->Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 2, 42)) +>x356 : Symbol(x356, Decl(generatedContextualTyping.ts, 354, 3)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 354, 20)) +>Genric : Symbol(Genric, Decl(generatedContextualTyping.ts, 3, 42)) >Base : Symbol(Base, Decl(generatedContextualTyping.ts, 0, 0)) ->x356 : Symbol(x356, Decl(generatedContextualTyping.ts, 353, 3)) ->func : Symbol(func, Decl(generatedContextualTyping.ts, 353, 48)) ->n : Symbol(n, Decl(generatedContextualTyping.ts, 353, 54)) ->d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 4, 19)) ->d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 4, 40)) +>x356 : Symbol(x356, Decl(generatedContextualTyping.ts, 354, 3)) +>func : Symbol(func, Decl(generatedContextualTyping.ts, 354, 48)) +>n : Symbol(n, Decl(generatedContextualTyping.ts, 354, 54)) +>d1 : Symbol(d1, Decl(generatedContextualTyping.ts, 5, 19)) +>d2 : Symbol(d2, Decl(generatedContextualTyping.ts, 5, 40)) diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index e8f434d31a8..2e9625cdb8b 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -1,4 +1,5 @@ === tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts === + class Base { private p; } >Base : Base >p : any diff --git a/tests/baselines/reference/getterMissingReturnError.errors.txt b/tests/baselines/reference/getterMissingReturnError.errors.txt index 8900cc5e78f..e504de07ef4 100644 --- a/tests/baselines/reference/getterMissingReturnError.errors.txt +++ b/tests/baselines/reference/getterMissingReturnError.errors.txt @@ -1,5 +1,5 @@ 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,16): error TS2378: A 'get' accessor must return a value. ==== tests/cases/compiler/getterMissingReturnError.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/getterMissingReturnError.ts(2,16): error TS2378: A 'get' ac ~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } } diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 020d3f053d1..a2553c674b0 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -1,4 +1,5 @@ //// [ifDoWhileStatements.ts] + interface I { id: number; } diff --git a/tests/baselines/reference/ifDoWhileStatements.symbols b/tests/baselines/reference/ifDoWhileStatements.symbols index e2b375cb54b..80c8fc7f1d8 100644 --- a/tests/baselines/reference/ifDoWhileStatements.symbols +++ b/tests/baselines/reference/ifDoWhileStatements.symbols @@ -1,92 +1,93 @@ === tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts === + interface I { >I : Symbol(I, Decl(ifDoWhileStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 0, 13)) +>id : Symbol(id, Decl(ifDoWhileStatements.ts, 1, 13)) } class C implements I { ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) >I : Symbol(I, Decl(ifDoWhileStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 4, 22)) +>id : Symbol(id, Decl(ifDoWhileStatements.ts, 5, 22)) name: string; ->name : Symbol(name, Decl(ifDoWhileStatements.ts, 5, 15)) +>name : Symbol(name, Decl(ifDoWhileStatements.ts, 6, 15)) } class C2 extends C { ->C2 : Symbol(C2, Decl(ifDoWhileStatements.ts, 7, 1)) ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>C2 : Symbol(C2, Decl(ifDoWhileStatements.ts, 8, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) valid: boolean; ->valid : Symbol(valid, Decl(ifDoWhileStatements.ts, 9, 20)) +>valid : Symbol(valid, Decl(ifDoWhileStatements.ts, 10, 20)) } class D{ ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->T : Symbol(T, Decl(ifDoWhileStatements.ts, 13, 8)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) source: T; ->source : Symbol(source, Decl(ifDoWhileStatements.ts, 13, 11)) ->T : Symbol(T, Decl(ifDoWhileStatements.ts, 13, 8)) +>source : Symbol(source, Decl(ifDoWhileStatements.ts, 14, 11)) +>T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(ifDoWhileStatements.ts, 14, 14)) ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->T : Symbol(T, Decl(ifDoWhileStatements.ts, 13, 8)) +>recurse : Symbol(recurse, Decl(ifDoWhileStatements.ts, 15, 14)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(ifDoWhileStatements.ts, 15, 18)) ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->T : Symbol(T, Decl(ifDoWhileStatements.ts, 13, 8)) +>wrapped : Symbol(wrapped, Decl(ifDoWhileStatements.ts, 16, 18)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>T : Symbol(T, Decl(ifDoWhileStatements.ts, 14, 8)) } function F(x: string): number { return 42; } ->F : Symbol(F, Decl(ifDoWhileStatements.ts, 17, 1)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 19, 11)) +>F : Symbol(F, Decl(ifDoWhileStatements.ts, 18, 1)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 20, 11)) function F2(x: number): boolean { return x < 42; } ->F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 19, 44)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 20, 12)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 20, 12)) +>F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 20, 44)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 21, 12)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 21, 12)) module M { ->M : Symbol(M, Decl(ifDoWhileStatements.ts, 20, 50)) +>M : Symbol(M, Decl(ifDoWhileStatements.ts, 21, 50)) export class A { ->A : Symbol(A, Decl(ifDoWhileStatements.ts, 22, 10)) +>A : Symbol(A, Decl(ifDoWhileStatements.ts, 23, 10)) name: string; ->name : Symbol(name, Decl(ifDoWhileStatements.ts, 23, 20)) +>name : Symbol(name, Decl(ifDoWhileStatements.ts, 24, 20)) } export function F2(x: number): string { return x.toString(); } ->F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 25, 5)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 27, 23)) +>F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 26, 5)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 28, 23)) >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 27, 23)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 28, 23)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } module N { ->N : Symbol(N, Decl(ifDoWhileStatements.ts, 28, 1)) +>N : Symbol(N, Decl(ifDoWhileStatements.ts, 29, 1)) export class A { ->A : Symbol(A, Decl(ifDoWhileStatements.ts, 30, 10)) +>A : Symbol(A, Decl(ifDoWhileStatements.ts, 31, 10)) id: number; ->id : Symbol(id, Decl(ifDoWhileStatements.ts, 31, 20)) +>id : Symbol(id, Decl(ifDoWhileStatements.ts, 32, 20)) } export function F2(x: number): string { return x.toString(); } ->F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 33, 5)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 35, 23)) +>F2 : Symbol(F2, Decl(ifDoWhileStatements.ts, 34, 5)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 36, 23)) >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 35, 23)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 36, 23)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } @@ -137,200 +138,200 @@ while ({}) { } do { }while({}) if ({ x: 1, y: 'a' }) { } ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 79, 5)) ->y : Symbol(y, Decl(ifDoWhileStatements.ts, 79, 11)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 80, 5)) +>y : Symbol(y, Decl(ifDoWhileStatements.ts, 80, 11)) while ({ x: 1, y: 'a' }) { } ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 80, 8)) ->y : Symbol(y, Decl(ifDoWhileStatements.ts, 80, 14)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 81, 8)) +>y : Symbol(y, Decl(ifDoWhileStatements.ts, 81, 14)) do { }while({ x: 1, y: 'a' }) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 81, 13)) ->y : Symbol(y, Decl(ifDoWhileStatements.ts, 81, 19)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 82, 13)) +>y : Symbol(y, Decl(ifDoWhileStatements.ts, 82, 19)) if (() => 43) { } while (() => 43) { } do { }while(() => 43) if (new C()) { } ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) while (new C()) { } ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) do { }while(new C()) ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) if (new D()) { } ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) while (new D()) { } ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) do { }while(new D()) ->D : Symbol(D, Decl(ifDoWhileStatements.ts, 11, 1)) ->C : Symbol(C, Decl(ifDoWhileStatements.ts, 2, 1)) +>D : Symbol(D, Decl(ifDoWhileStatements.ts, 12, 1)) +>C : Symbol(C, Decl(ifDoWhileStatements.ts, 3, 1)) // references var a = true; ->a : Symbol(a, Decl(ifDoWhileStatements.ts, 96, 3)) +>a : Symbol(a, Decl(ifDoWhileStatements.ts, 97, 3)) if (a) { } ->a : Symbol(a, Decl(ifDoWhileStatements.ts, 96, 3)) +>a : Symbol(a, Decl(ifDoWhileStatements.ts, 97, 3)) while (a) { } ->a : Symbol(a, Decl(ifDoWhileStatements.ts, 96, 3)) +>a : Symbol(a, Decl(ifDoWhileStatements.ts, 97, 3)) do { }while(a) ->a : Symbol(a, Decl(ifDoWhileStatements.ts, 96, 3)) +>a : Symbol(a, Decl(ifDoWhileStatements.ts, 97, 3)) var b = null; ->b : Symbol(b, Decl(ifDoWhileStatements.ts, 101, 3)) +>b : Symbol(b, Decl(ifDoWhileStatements.ts, 102, 3)) if (b) { } ->b : Symbol(b, Decl(ifDoWhileStatements.ts, 101, 3)) +>b : Symbol(b, Decl(ifDoWhileStatements.ts, 102, 3)) while (b) { } ->b : Symbol(b, Decl(ifDoWhileStatements.ts, 101, 3)) +>b : Symbol(b, Decl(ifDoWhileStatements.ts, 102, 3)) do { }while(b) ->b : Symbol(b, Decl(ifDoWhileStatements.ts, 101, 3)) +>b : Symbol(b, Decl(ifDoWhileStatements.ts, 102, 3)) var c = undefined; ->c : Symbol(c, Decl(ifDoWhileStatements.ts, 106, 3)) +>c : Symbol(c, Decl(ifDoWhileStatements.ts, 107, 3)) >undefined : Symbol(undefined) if (c) { } ->c : Symbol(c, Decl(ifDoWhileStatements.ts, 106, 3)) +>c : Symbol(c, Decl(ifDoWhileStatements.ts, 107, 3)) while (c) { } ->c : Symbol(c, Decl(ifDoWhileStatements.ts, 106, 3)) +>c : Symbol(c, Decl(ifDoWhileStatements.ts, 107, 3)) do { }while(c) ->c : Symbol(c, Decl(ifDoWhileStatements.ts, 106, 3)) +>c : Symbol(c, Decl(ifDoWhileStatements.ts, 107, 3)) var d = 0.0; ->d : Symbol(d, Decl(ifDoWhileStatements.ts, 111, 3)) +>d : Symbol(d, Decl(ifDoWhileStatements.ts, 112, 3)) if (d) { } ->d : Symbol(d, Decl(ifDoWhileStatements.ts, 111, 3)) +>d : Symbol(d, Decl(ifDoWhileStatements.ts, 112, 3)) while (d) { } ->d : Symbol(d, Decl(ifDoWhileStatements.ts, 111, 3)) +>d : Symbol(d, Decl(ifDoWhileStatements.ts, 112, 3)) do { }while(d) ->d : Symbol(d, Decl(ifDoWhileStatements.ts, 111, 3)) +>d : Symbol(d, Decl(ifDoWhileStatements.ts, 112, 3)) var e = 'a string'; ->e : Symbol(e, Decl(ifDoWhileStatements.ts, 116, 3)) +>e : Symbol(e, Decl(ifDoWhileStatements.ts, 117, 3)) if (e) { } ->e : Symbol(e, Decl(ifDoWhileStatements.ts, 116, 3)) +>e : Symbol(e, Decl(ifDoWhileStatements.ts, 117, 3)) while (e) { } ->e : Symbol(e, Decl(ifDoWhileStatements.ts, 116, 3)) +>e : Symbol(e, Decl(ifDoWhileStatements.ts, 117, 3)) do { }while(e) ->e : Symbol(e, Decl(ifDoWhileStatements.ts, 116, 3)) +>e : Symbol(e, Decl(ifDoWhileStatements.ts, 117, 3)) var f = ''; ->f : Symbol(f, Decl(ifDoWhileStatements.ts, 121, 3)) +>f : Symbol(f, Decl(ifDoWhileStatements.ts, 122, 3)) if (f) { } ->f : Symbol(f, Decl(ifDoWhileStatements.ts, 121, 3)) +>f : Symbol(f, Decl(ifDoWhileStatements.ts, 122, 3)) while (f) { } ->f : Symbol(f, Decl(ifDoWhileStatements.ts, 121, 3)) +>f : Symbol(f, Decl(ifDoWhileStatements.ts, 122, 3)) do { }while(f) ->f : Symbol(f, Decl(ifDoWhileStatements.ts, 121, 3)) +>f : Symbol(f, Decl(ifDoWhileStatements.ts, 122, 3)) var g = /[a-z]/ ->g : Symbol(g, Decl(ifDoWhileStatements.ts, 126, 3)) +>g : Symbol(g, Decl(ifDoWhileStatements.ts, 127, 3)) if (g) { } ->g : Symbol(g, Decl(ifDoWhileStatements.ts, 126, 3)) +>g : Symbol(g, Decl(ifDoWhileStatements.ts, 127, 3)) while (g) { } ->g : Symbol(g, Decl(ifDoWhileStatements.ts, 126, 3)) +>g : Symbol(g, Decl(ifDoWhileStatements.ts, 127, 3)) do { }while(g) ->g : Symbol(g, Decl(ifDoWhileStatements.ts, 126, 3)) +>g : Symbol(g, Decl(ifDoWhileStatements.ts, 127, 3)) var h = []; ->h : Symbol(h, Decl(ifDoWhileStatements.ts, 131, 3)) +>h : Symbol(h, Decl(ifDoWhileStatements.ts, 132, 3)) if (h) { } ->h : Symbol(h, Decl(ifDoWhileStatements.ts, 131, 3)) +>h : Symbol(h, Decl(ifDoWhileStatements.ts, 132, 3)) while (h) { } ->h : Symbol(h, Decl(ifDoWhileStatements.ts, 131, 3)) +>h : Symbol(h, Decl(ifDoWhileStatements.ts, 132, 3)) do { }while(h) ->h : Symbol(h, Decl(ifDoWhileStatements.ts, 131, 3)) +>h : Symbol(h, Decl(ifDoWhileStatements.ts, 132, 3)) var i = [1, 2]; ->i : Symbol(i, Decl(ifDoWhileStatements.ts, 136, 3)) +>i : Symbol(i, Decl(ifDoWhileStatements.ts, 137, 3)) if (i) { } ->i : Symbol(i, Decl(ifDoWhileStatements.ts, 136, 3)) +>i : Symbol(i, Decl(ifDoWhileStatements.ts, 137, 3)) while (i) { } ->i : Symbol(i, Decl(ifDoWhileStatements.ts, 136, 3)) +>i : Symbol(i, Decl(ifDoWhileStatements.ts, 137, 3)) do { }while(i) ->i : Symbol(i, Decl(ifDoWhileStatements.ts, 136, 3)) +>i : Symbol(i, Decl(ifDoWhileStatements.ts, 137, 3)) var j = {}; ->j : Symbol(j, Decl(ifDoWhileStatements.ts, 141, 3)) +>j : Symbol(j, Decl(ifDoWhileStatements.ts, 142, 3)) if (j) { } ->j : Symbol(j, Decl(ifDoWhileStatements.ts, 141, 3)) +>j : Symbol(j, Decl(ifDoWhileStatements.ts, 142, 3)) while (j) { } ->j : Symbol(j, Decl(ifDoWhileStatements.ts, 141, 3)) +>j : Symbol(j, Decl(ifDoWhileStatements.ts, 142, 3)) do { }while(j) ->j : Symbol(j, Decl(ifDoWhileStatements.ts, 141, 3)) +>j : Symbol(j, Decl(ifDoWhileStatements.ts, 142, 3)) var k = { x: 1, y: 'a' }; ->k : Symbol(k, Decl(ifDoWhileStatements.ts, 146, 3)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 146, 9)) ->y : Symbol(y, Decl(ifDoWhileStatements.ts, 146, 15)) +>k : Symbol(k, Decl(ifDoWhileStatements.ts, 147, 3)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 147, 9)) +>y : Symbol(y, Decl(ifDoWhileStatements.ts, 147, 15)) if (k) { } ->k : Symbol(k, Decl(ifDoWhileStatements.ts, 146, 3)) +>k : Symbol(k, Decl(ifDoWhileStatements.ts, 147, 3)) while (k) { } ->k : Symbol(k, Decl(ifDoWhileStatements.ts, 146, 3)) +>k : Symbol(k, Decl(ifDoWhileStatements.ts, 147, 3)) do { }while(k) ->k : Symbol(k, Decl(ifDoWhileStatements.ts, 146, 3)) +>k : Symbol(k, Decl(ifDoWhileStatements.ts, 147, 3)) function fn(x?: string): I { return null; } ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) ->x : Symbol(x, Decl(ifDoWhileStatements.ts, 151, 12)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) +>x : Symbol(x, Decl(ifDoWhileStatements.ts, 152, 12)) >I : Symbol(I, Decl(ifDoWhileStatements.ts, 0, 0)) if (fn()) { } ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) while (fn()) { } ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) do { }while(fn()) ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) if (fn) { } ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) while (fn) { } ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) do { }while(fn) ->fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 149, 14)) +>fn : Symbol(fn, Decl(ifDoWhileStatements.ts, 150, 14)) diff --git a/tests/baselines/reference/ifDoWhileStatements.types b/tests/baselines/reference/ifDoWhileStatements.types index 92a9df6a4dd..660eaa4fb63 100644 --- a/tests/baselines/reference/ifDoWhileStatements.types +++ b/tests/baselines/reference/ifDoWhileStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts === + interface I { >I : I diff --git a/tests/baselines/reference/ifElseWithStatements1.errors.txt b/tests/baselines/reference/ifElseWithStatements1.errors.txt index 186cff59241..5dc4d9b0db5 100644 --- a/tests/baselines/reference/ifElseWithStatements1.errors.txt +++ b/tests/baselines/reference/ifElseWithStatements1.errors.txt @@ -1,8 +1,9 @@ -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(3,5): error TS2304: Cannot find name 'f'. +tests/cases/compiler/ifElseWithStatements1.ts(5,5): error TS2304: Cannot find name 'f'. ==== tests/cases/compiler/ifElseWithStatements1.ts (2 errors) ==== + if (true) f(); ~ diff --git a/tests/baselines/reference/ifElseWithStatements1.js b/tests/baselines/reference/ifElseWithStatements1.js index 506e7e6a330..47df08d46ba 100644 --- a/tests/baselines/reference/ifElseWithStatements1.js +++ b/tests/baselines/reference/ifElseWithStatements1.js @@ -1,4 +1,5 @@ //// [ifElseWithStatements1.ts] + if (true) f(); else diff --git a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt index 99819ecad2c..bab58d0e4cf 100644 --- a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt +++ b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt @@ -1,7 +1,8 @@ -tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts(1,10): error TS2354: No best common type exists among return expressions. +tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts(2,10): error TS2354: No best common type exists among return expressions. ==== tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts (1 errors) ==== + function foo() { ~~~ !!! error TS2354: No best common type exists among return expressions. diff --git a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.js b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.js index ba528d4c133..2993a331fee 100644 --- a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.js +++ b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.js @@ -1,4 +1,5 @@ //// [inferredFunctionReturnTypeIsEmptyType.ts] + function foo() { if (true) { return 42; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt index 08aab5b1158..787b95f2297 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.errors.txt @@ -1,8 +1,9 @@ -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(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts(6,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 { ~ diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index b81b6cd1d78..fa9c6e2a8b5 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -1,4 +1,5 @@ //// [inheritanceStaticPropertyOverridingAccessor.ts] + class a { static get x(): () => string { return null;; diff --git a/tests/baselines/reference/interfaceExtendingClass2.errors.txt b/tests/baselines/reference/interfaceExtendingClass2.errors.txt index 3b394d4922a..859cb65410e 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass2.errors.txt @@ -1,10 +1,11 @@ -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(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(12,5): error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(14,13): error TS1131: Property or signature expected. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(15,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(16,5): error TS1128: Declaration or statement expected. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts (4 errors) ==== + class Foo { x: string; y() { } diff --git a/tests/baselines/reference/interfaceExtendingClass2.js b/tests/baselines/reference/interfaceExtendingClass2.js index 6e6605e2459..c4143659125 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.js +++ b/tests/baselines/reference/interfaceExtendingClass2.js @@ -1,4 +1,5 @@ //// [interfaceExtendingClass2.ts] + class Foo { x: string; y() { } diff --git a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt index 7f2542b45a1..dc1cfeabed5 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt +++ b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt @@ -1,11 +1,12 @@ -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(12,16): error TS2304: Cannot find name 'string'. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(5,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(9,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,5): error TS1131: Property or signature expected. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,16): error TS2304: Cannot find name 'string'. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(14,1): error TS1128: Declaration or statement expected. ==== tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts (5 errors) ==== + // interfaces do not permit private members, these are errors interface I { diff --git a/tests/baselines/reference/interfaceWithPrivateMember.js b/tests/baselines/reference/interfaceWithPrivateMember.js index 24c2cf9ecf5..ceb388b1eae 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.js +++ b/tests/baselines/reference/interfaceWithPrivateMember.js @@ -1,4 +1,5 @@ //// [interfaceWithPrivateMember.ts] + // interfaces do not permit private members, these are errors interface I { diff --git a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt index 65fd55b763b..15983bd1fc4 100644 --- a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(9,4): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(28,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(38,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 diff --git a/tests/baselines/reference/invalidDoWhileBreakStatements.js b/tests/baselines/reference/invalidDoWhileBreakStatements.js index 807d58a8fea..4f48a890aa6 100644 --- a/tests/baselines/reference/invalidDoWhileBreakStatements.js +++ b/tests/baselines/reference/invalidDoWhileBreakStatements.js @@ -1,4 +1,5 @@ //// [invalidDoWhileBreakStatements.ts] + // All errors // naked break not allowed diff --git a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt index e9643394d12..3a520209293 100644 --- a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(9,4): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(28,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(38,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 diff --git a/tests/baselines/reference/invalidDoWhileContinueStatements.js b/tests/baselines/reference/invalidDoWhileContinueStatements.js index 21a10a3451b..b77259159a9 100644 --- a/tests/baselines/reference/invalidDoWhileContinueStatements.js +++ b/tests/baselines/reference/invalidDoWhileContinueStatements.js @@ -1,4 +1,5 @@ //// [invalidDoWhileContinueStatements.ts] + // All errors // naked continue not allowed diff --git a/tests/baselines/reference/invalidForBreakStatements.errors.txt b/tests/baselines/reference/invalidForBreakStatements.errors.txt index 50e4013c0ea..57ae1d32c8e 100644 --- a/tests/baselines/reference/invalidForBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForBreakStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(9,9): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(28,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(37,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 diff --git a/tests/baselines/reference/invalidForBreakStatements.js b/tests/baselines/reference/invalidForBreakStatements.js index 5e3430ecb41..50096e16720 100644 --- a/tests/baselines/reference/invalidForBreakStatements.js +++ b/tests/baselines/reference/invalidForBreakStatements.js @@ -1,4 +1,5 @@ //// [invalidForBreakStatements.ts] + // All errors // naked break not allowed diff --git a/tests/baselines/reference/invalidForContinueStatements.errors.txt b/tests/baselines/reference/invalidForContinueStatements.errors.txt index 3af47370df1..9ebfae57e9f 100644 --- a/tests/baselines/reference/invalidForContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForContinueStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(9,9): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(28,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(37,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 diff --git a/tests/baselines/reference/invalidForContinueStatements.js b/tests/baselines/reference/invalidForContinueStatements.js index 2db1ce69ede..7a3513bb2a3 100644 --- a/tests/baselines/reference/invalidForContinueStatements.js +++ b/tests/baselines/reference/invalidForContinueStatements.js @@ -1,4 +1,5 @@ //// [invalidForContinueStatements.ts] + // All errors // naked continue not allowed diff --git a/tests/baselines/reference/invalidForInBreakStatements.errors.txt b/tests/baselines/reference/invalidForInBreakStatements.errors.txt index d83304ab1c6..b1f5d64f973 100644 --- a/tests/baselines/reference/invalidForInBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForInBreakStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(9,19): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(28,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(38,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 diff --git a/tests/baselines/reference/invalidForInBreakStatements.js b/tests/baselines/reference/invalidForInBreakStatements.js index 1784b9a57a6..11517f2a020 100644 --- a/tests/baselines/reference/invalidForInBreakStatements.js +++ b/tests/baselines/reference/invalidForInBreakStatements.js @@ -1,4 +1,5 @@ //// [invalidForInBreakStatements.ts] + // All errors // naked break not allowed diff --git a/tests/baselines/reference/invalidForInContinueStatements.errors.txt b/tests/baselines/reference/invalidForInContinueStatements.errors.txt index 7353a22d9cd..f20d9c6e81c 100644 --- a/tests/baselines/reference/invalidForInContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForInContinueStatements.errors.txt @@ -1,12 +1,13 @@ -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(5,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(9,19): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(28,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(38,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 diff --git a/tests/baselines/reference/invalidForInContinueStatements.js b/tests/baselines/reference/invalidForInContinueStatements.js index 94020d00f2b..5eb0e10bf53 100644 --- a/tests/baselines/reference/invalidForInContinueStatements.js +++ b/tests/baselines/reference/invalidForInContinueStatements.js @@ -1,4 +1,5 @@ //// [invalidForInContinueStatements.ts] + // All errors // naked continue not allowed diff --git a/tests/baselines/reference/invalidReturnStatements.errors.txt b/tests/baselines/reference/invalidReturnStatements.errors.txt index 780166e07c2..6fbe961cd54 100644 --- a/tests/baselines/reference/invalidReturnStatements.errors.txt +++ b/tests/baselines/reference/invalidReturnStatements.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/statements/returnStatements/invalidReturnStatements.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/conformance/statements/returnStatements/invalidReturnStatements.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/conformance/statements/returnStatements/invalidReturnStatements.ts(4,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/conformance/statements/returnStatements/invalidReturnStatements.ts(5,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/conformance/statements/returnStatements/invalidReturnStatements.ts(2,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(3,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(4,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(5,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(16,29): error TS2322: Type '{ id: number; }' is not assignable to type 'D'. Property 'name' is missing in type '{ id: number; }'. tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(18,29): error TS2322: Type 'C' is not assignable to type 'D'. @@ -12,16 +12,16 @@ tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(1 // all the following should be error function fn1(): number { } ~~~~~~ -!!! error TS2355: 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. function fn2(): string { } ~~~~~~ -!!! error TS2355: 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. function fn3(): boolean { } ~~~~~~~ -!!! error TS2355: 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. function fn4(): Date { } ~~~~ -!!! error TS2355: 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. function fn7(): any { } // should be valid: any includes void interface I { id: number } diff --git a/tests/baselines/reference/invalidThrowStatement.errors.txt b/tests/baselines/reference/invalidThrowStatement.errors.txt index b30549a217c..3002bce2f1f 100644 --- a/tests/baselines/reference/invalidThrowStatement.errors.txt +++ b/tests/baselines/reference/invalidThrowStatement.errors.txt @@ -1,8 +1,9 @@ -tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts(1,6): error TS1109: Expression expected. -tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts(2,6): error TS1109: Expression expected. +tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts(4,1): error TS1128: Declaration or statement expected. ==== tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts (2 errors) ==== + throw; ~ !!! error TS1109: Expression expected. diff --git a/tests/baselines/reference/invalidThrowStatement.js b/tests/baselines/reference/invalidThrowStatement.js index 4b794ab3d51..674dacf5c17 100644 --- a/tests/baselines/reference/invalidThrowStatement.js +++ b/tests/baselines/reference/invalidThrowStatement.js @@ -1,4 +1,5 @@ //// [invalidThrowStatement.ts] + throw; export throw null; diff --git a/tests/baselines/reference/invalidWhileBreakStatements.errors.txt b/tests/baselines/reference/invalidWhileBreakStatements.errors.txt index 54adc2856d7..7d4f86b3e9d 100644 --- a/tests/baselines/reference/invalidWhileBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidWhileBreakStatements.errors.txt @@ -1,12 +1,14 @@ tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. +tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(7,1): error TS7028: Unused label. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(8,14): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(11,1): error TS7027: Unreachable code detected. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. -==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (6 errors) ==== +==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (8 errors) ==== // All errors // naked break not allowed @@ -16,12 +18,16 @@ tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.t // non-existent label ONE: + ~~~ +!!! error TS7028: Unused label. while (true) break TWO; ~~~~~~~~~~ !!! error TS1116: A 'break' statement can only jump to a label of an enclosing statement. // break from inside function TWO: + ~~~ +!!! error TS7027: Unreachable code detected. while (true){ var x = () => { break TWO; diff --git a/tests/baselines/reference/invalidWhileContinueStatements.errors.txt b/tests/baselines/reference/invalidWhileContinueStatements.errors.txt index 462b244efd4..e7a9ed13c40 100644 --- a/tests/baselines/reference/invalidWhileContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidWhileContinueStatements.errors.txt @@ -1,12 +1,13 @@ -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(8,14): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(5,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(9,14): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(15,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(22,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(28,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(38,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. ==== tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts (6 errors) ==== + // All errors // naked continue not allowed diff --git a/tests/baselines/reference/invalidWhileContinueStatements.js b/tests/baselines/reference/invalidWhileContinueStatements.js index b8234bf9604..16350e9b561 100644 --- a/tests/baselines/reference/invalidWhileContinueStatements.js +++ b/tests/baselines/reference/invalidWhileContinueStatements.js @@ -1,4 +1,5 @@ //// [invalidWhileContinueStatements.ts] + // All errors // naked continue not allowed diff --git a/tests/baselines/reference/letAndVarRedeclaration.errors.txt b/tests/baselines/reference/letAndVarRedeclaration.errors.txt index 48704f61040..50a916e8d90 100644 --- a/tests/baselines/reference/letAndVarRedeclaration.errors.txt +++ b/tests/baselines/reference/letAndVarRedeclaration.errors.txt @@ -1,28 +1,29 @@ -tests/cases/compiler/letAndVarRedeclaration.ts(2,5): error TS2451: Cannot redeclare block-scoped variable 'e0'. tests/cases/compiler/letAndVarRedeclaration.ts(3,5): error TS2451: Cannot redeclare block-scoped variable 'e0'. -tests/cases/compiler/letAndVarRedeclaration.ts(4,10): error TS2451: Cannot redeclare block-scoped variable 'e0'. -tests/cases/compiler/letAndVarRedeclaration.ts(7,9): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(4,5): error TS2451: Cannot redeclare block-scoped variable 'e0'. +tests/cases/compiler/letAndVarRedeclaration.ts(5,10): error TS2451: Cannot redeclare block-scoped variable 'e0'. tests/cases/compiler/letAndVarRedeclaration.ts(8,9): error TS2451: Cannot redeclare block-scoped variable 'x1'. -tests/cases/compiler/letAndVarRedeclaration.ts(9,14): error TS2451: Cannot redeclare block-scoped variable 'x1'. -tests/cases/compiler/letAndVarRedeclaration.ts(13,9): error TS2451: Cannot redeclare block-scoped variable 'x'. -tests/cases/compiler/letAndVarRedeclaration.ts(15,13): error TS2451: Cannot redeclare block-scoped variable 'x'. -tests/cases/compiler/letAndVarRedeclaration.ts(18,18): error TS2451: Cannot redeclare block-scoped variable 'x'. -tests/cases/compiler/letAndVarRedeclaration.ts(23,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(9,9): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(10,14): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(14,9): error TS2451: Cannot redeclare block-scoped variable 'x'. +tests/cases/compiler/letAndVarRedeclaration.ts(16,13): error TS2451: Cannot redeclare block-scoped variable 'x'. +tests/cases/compiler/letAndVarRedeclaration.ts(19,18): error TS2451: Cannot redeclare block-scoped variable 'x'. tests/cases/compiler/letAndVarRedeclaration.ts(24,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. -tests/cases/compiler/letAndVarRedeclaration.ts(25,14): error TS2451: Cannot redeclare block-scoped variable 'x2'. -tests/cases/compiler/letAndVarRedeclaration.ts(29,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. -tests/cases/compiler/letAndVarRedeclaration.ts(31,13): error TS2451: Cannot redeclare block-scoped variable 'x2'. -tests/cases/compiler/letAndVarRedeclaration.ts(34,18): error TS2451: Cannot redeclare block-scoped variable 'x2'. -tests/cases/compiler/letAndVarRedeclaration.ts(38,5): error TS2451: Cannot redeclare block-scoped variable 'x11'. -tests/cases/compiler/letAndVarRedeclaration.ts(39,10): error TS2451: Cannot redeclare block-scoped variable 'x11'. -tests/cases/compiler/letAndVarRedeclaration.ts(43,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. -tests/cases/compiler/letAndVarRedeclaration.ts(44,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. -tests/cases/compiler/letAndVarRedeclaration.ts(49,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. -tests/cases/compiler/letAndVarRedeclaration.ts(50,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(25,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(26,14): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(30,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(32,13): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(35,18): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(39,5): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(40,10): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(44,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(45,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(50,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(51,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. ==== tests/cases/compiler/letAndVarRedeclaration.ts (21 errors) ==== + let e0 ~~ !!! error TS2451: Cannot redeclare block-scoped variable 'e0'. diff --git a/tests/baselines/reference/letAndVarRedeclaration.js b/tests/baselines/reference/letAndVarRedeclaration.js index fd4bfe67cac..eb4dfc9c0e8 100644 --- a/tests/baselines/reference/letAndVarRedeclaration.js +++ b/tests/baselines/reference/letAndVarRedeclaration.js @@ -1,5 +1,6 @@ //// [letAndVarRedeclaration.ts] + let e0 var e0; function e0() { } diff --git a/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt b/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt index 1ece1f31433..e46554ec0e6 100644 --- a/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt +++ b/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt @@ -1,16 +1,17 @@ -tests/cases/compiler/letDeclarations-invalidContexts.ts(4,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(6,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(9,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(12,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. -tests/cases/compiler/letDeclarations-invalidContexts.ts(20,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(23,5): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(26,12): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(29,29): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(5,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(7,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(10,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(13,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(17,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/compiler/letDeclarations-invalidContexts.ts(21,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(24,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(27,12): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(30,29): error TS1157: 'let' declarations can only be declared inside a block. ==== tests/cases/compiler/letDeclarations-invalidContexts.ts (9 errors) ==== + // Errors, let must be defined inside a block if (true) let l1 = 0; diff --git a/tests/baselines/reference/letDeclarations-invalidContexts.js b/tests/baselines/reference/letDeclarations-invalidContexts.js index f8c3bb04bdb..4c3be1faed8 100644 --- a/tests/baselines/reference/letDeclarations-invalidContexts.js +++ b/tests/baselines/reference/letDeclarations-invalidContexts.js @@ -1,5 +1,6 @@ //// [letDeclarations-invalidContexts.ts] + // Errors, let must be defined inside a block if (true) let l1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes.errors.txt b/tests/baselines/reference/letDeclarations-scopes.errors.txt index 5c89ea98049..1b10903af7c 100644 --- a/tests/baselines/reference/letDeclarations-scopes.errors.txt +++ b/tests/baselines/reference/letDeclarations-scopes.errors.txt @@ -1,8 +1,9 @@ -tests/cases/compiler/letDeclarations-scopes.ts(28,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/compiler/letDeclarations-scopes.ts(29,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. ==== tests/cases/compiler/letDeclarations-scopes.ts (1 errors) ==== + // global let l = "string"; diff --git a/tests/baselines/reference/letDeclarations-scopes.js b/tests/baselines/reference/letDeclarations-scopes.js index d0489820d0b..3fc5976b4b7 100644 --- a/tests/baselines/reference/letDeclarations-scopes.js +++ b/tests/baselines/reference/letDeclarations-scopes.js @@ -1,5 +1,6 @@ //// [letDeclarations-scopes.ts] + // global let l = "string"; diff --git a/tests/baselines/reference/letDeclarations-validContexts.errors.txt b/tests/baselines/reference/letDeclarations-validContexts.errors.txt index 3f3b7a2634f..acec026daf0 100644 --- a/tests/baselines/reference/letDeclarations-validContexts.errors.txt +++ b/tests/baselines/reference/letDeclarations-validContexts.errors.txt @@ -1,9 +1,10 @@ -tests/cases/compiler/letDeclarations-validContexts.ts(20,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/compiler/letDeclarations-validContexts.ts(21,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. ==== tests/cases/compiler/letDeclarations-validContexts.ts (1 errors) ==== + // Control flow statements with blocks if (true) { let l1 = 0; diff --git a/tests/baselines/reference/letDeclarations-validContexts.js b/tests/baselines/reference/letDeclarations-validContexts.js index b11a1922383..1859a0215bb 100644 --- a/tests/baselines/reference/letDeclarations-validContexts.js +++ b/tests/baselines/reference/letDeclarations-validContexts.js @@ -1,6 +1,7 @@ //// [letDeclarations-validContexts.ts] + // Control flow statements with blocks if (true) { let l1 = 0; diff --git a/tests/baselines/reference/localTypes4.errors.txt b/tests/baselines/reference/localTypes4.errors.txt index cad9d30c933..4d08644ea89 100644 --- a/tests/baselines/reference/localTypes4.errors.txt +++ b/tests/baselines/reference/localTypes4.errors.txt @@ -1,10 +1,11 @@ -tests/cases/conformance/types/localTypes/localTypes4.ts(10,19): error TS2304: Cannot find name 'T'. -tests/cases/conformance/types/localTypes/localTypes4.ts(10,23): error TS2304: Cannot find name 'T'. -tests/cases/conformance/types/localTypes/localTypes4.ts(18,16): error TS2300: Duplicate identifier 'T'. -tests/cases/conformance/types/localTypes/localTypes4.ts(19,19): error TS2300: Duplicate identifier 'T'. +tests/cases/conformance/types/localTypes/localTypes4.ts(11,19): error TS2304: Cannot find name 'T'. +tests/cases/conformance/types/localTypes/localTypes4.ts(11,23): error TS2304: Cannot find name 'T'. +tests/cases/conformance/types/localTypes/localTypes4.ts(19,16): error TS2300: Duplicate identifier 'T'. +tests/cases/conformance/types/localTypes/localTypes4.ts(20,19): error TS2300: Duplicate identifier 'T'. ==== tests/cases/conformance/types/localTypes/localTypes4.ts (4 errors) ==== + function f1() { // Type parameters are in scope in parameters and return types function f(x: T): T { diff --git a/tests/baselines/reference/localTypes4.js b/tests/baselines/reference/localTypes4.js index 8f51761a65a..3b81175d2b6 100644 --- a/tests/baselines/reference/localTypes4.js +++ b/tests/baselines/reference/localTypes4.js @@ -1,4 +1,5 @@ //// [localTypes4.ts] + function f1() { // Type parameters are in scope in parameters and return types function f(x: T): T { diff --git a/tests/baselines/reference/methodInAmbientClass1.errors.txt b/tests/baselines/reference/methodInAmbientClass1.errors.txt index 2badd839270..c931cc0101c 100644 --- a/tests/baselines/reference/methodInAmbientClass1.errors.txt +++ b/tests/baselines/reference/methodInAmbientClass1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/methodInAmbientClass1.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/methodInAmbientClass1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1183: An implementation cannot be declared in ambient contexts. @@ -6,7 +6,7 @@ tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1183: An implementa declare class Foo { fn(): boolean { ~~~~~~~ -!!! error TS2355: 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. ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. } diff --git a/tests/baselines/reference/missingReturnStatement.errors.txt b/tests/baselines/reference/missingReturnStatement.errors.txt index c7cedd793de..8926d22be3d 100644 --- a/tests/baselines/reference/missingReturnStatement.errors.txt +++ b/tests/baselines/reference/missingReturnStatement.errors.txt @@ -1,4 +1,4 @@ -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(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ==== tests/cases/compiler/missingReturnStatement.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/missingReturnStatement.ts(3,22): error TS2355: A function w export class Bug { public foo():string { ~~~~~~ -!!! error TS2355: 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. } } } diff --git a/tests/baselines/reference/missingReturnStatement1.errors.txt b/tests/baselines/reference/missingReturnStatement1.errors.txt index de471f90ac4..9d3cf78411e 100644 --- a/tests/baselines/reference/missingReturnStatement1.errors.txt +++ b/tests/baselines/reference/missingReturnStatement1.errors.txt @@ -1,11 +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(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ==== tests/cases/compiler/missingReturnStatement1.ts (1 errors) ==== class Foo { foo(): number { ~~~~~~ -!!! error TS2355: 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. //return 4; } } diff --git a/tests/baselines/reference/multiLineErrors.errors.txt b/tests/baselines/reference/multiLineErrors.errors.txt index 23a6278b4fb..70366aeabed 100644 --- a/tests/baselines/reference/multiLineErrors.errors.txt +++ b/tests/baselines/reference/multiLineErrors.errors.txt @@ -1,4 +1,4 @@ -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(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. 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; }'. @@ -17,7 +17,7 @@ tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not as ~~~~~~~~~~~~~~ } ~ -!!! error TS2355: 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. { var x = 4; var y = 10; diff --git a/tests/baselines/reference/null.js b/tests/baselines/reference/null.js index 499d6901847..ee897643fb1 100644 --- a/tests/baselines/reference/null.js +++ b/tests/baselines/reference/null.js @@ -1,4 +1,5 @@ //// [null.ts] + var x=null; var y=3+x; var z=3+null; diff --git a/tests/baselines/reference/null.symbols b/tests/baselines/reference/null.symbols index 148cd1586b2..bd3d835995b 100644 --- a/tests/baselines/reference/null.symbols +++ b/tests/baselines/reference/null.symbols @@ -1,44 +1,45 @@ === tests/cases/compiler/null.ts === + var x=null; ->x : Symbol(x, Decl(null.ts, 0, 3)) +>x : Symbol(x, Decl(null.ts, 1, 3)) var y=3+x; ->y : Symbol(y, Decl(null.ts, 1, 3)) ->x : Symbol(x, Decl(null.ts, 0, 3)) +>y : Symbol(y, Decl(null.ts, 2, 3)) +>x : Symbol(x, Decl(null.ts, 1, 3)) var z=3+null; ->z : Symbol(z, Decl(null.ts, 2, 3)) +>z : Symbol(z, Decl(null.ts, 3, 3)) class C { ->C : Symbol(C, Decl(null.ts, 2, 13)) +>C : Symbol(C, Decl(null.ts, 3, 13)) } function f() { ->f : Symbol(f, Decl(null.ts, 4, 1)) +>f : Symbol(f, Decl(null.ts, 5, 1)) return null; return new C(); ->C : Symbol(C, Decl(null.ts, 2, 13)) +>C : Symbol(C, Decl(null.ts, 3, 13)) } function g() { ->g : Symbol(g, Decl(null.ts, 8, 1)) +>g : Symbol(g, Decl(null.ts, 9, 1)) return null; return 3; } interface I { ->I : Symbol(I, Decl(null.ts, 12, 1)) +>I : Symbol(I, Decl(null.ts, 13, 1)) x:any; ->x : Symbol(x, Decl(null.ts, 13, 13)) +>x : Symbol(x, Decl(null.ts, 14, 13)) y:number; ->y : Symbol(y, Decl(null.ts, 14, 10)) +>y : Symbol(y, Decl(null.ts, 15, 10)) } var w:I={x:null,y:3}; ->w : Symbol(w, Decl(null.ts, 17, 3)) ->I : Symbol(I, Decl(null.ts, 12, 1)) ->x : Symbol(x, Decl(null.ts, 17, 9)) ->y : Symbol(y, Decl(null.ts, 17, 16)) +>w : Symbol(w, Decl(null.ts, 18, 3)) +>I : Symbol(I, Decl(null.ts, 13, 1)) +>x : Symbol(x, Decl(null.ts, 18, 9)) +>y : Symbol(y, Decl(null.ts, 18, 16)) diff --git a/tests/baselines/reference/null.types b/tests/baselines/reference/null.types index 7df551b1bde..6fd8b423f13 100644 --- a/tests/baselines/reference/null.types +++ b/tests/baselines/reference/null.types @@ -1,4 +1,5 @@ === tests/cases/compiler/null.ts === + var x=null; >x : any >null : null diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt index e939725ea6e..be2bea5e241 100644 --- a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS2378: A 'get' accessor must return a value. ==== tests/cases/compiler/objectLiteralMemberWithModifiers2.ts (2 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS2378: A ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralWithSemicolons5.errors.txt b/tests/baselines/reference/objectLiteralWithSemicolons5.errors.txt index 7373c3d535d..5a24f29252c 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons5.errors.txt +++ b/tests/baselines/reference/objectLiteralWithSemicolons5.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,20): error TS1005: ',' expected. tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,25): error TS2304: Cannot find name 'b'. tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,26): error TS1005: ',' expected. -tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,32): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,32): error TS2378: A 'get' accessor must return a value. tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,41): error TS1005: ',' expected. @@ -14,6 +14,6 @@ tests/cases/compiler/objectLiteralWithSemicolons5.ts(1,41): error TS1005: ',' ex ~ !!! error TS1005: ',' expected. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~ !!! error TS1005: ',' expected. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt index 079951880ab..a78e0c8abcf 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt @@ -1,8 +1,9 @@ -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(1,37): error TS1005: ';' expected. +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,37): error TS1005: ';' expected. ==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ==== + var f: (x: 'hi') => number = ('hi') => { return 1; }; ~~~~~~~~~~~~~~~~~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js index 48e52ba0967..aa5c8701f28 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js @@ -1,4 +1,5 @@ //// [overloadOnConstAsTypeAnnotation.ts] + var f: (x: 'hi') => number = ('hi') => { return 1; }; //// [overloadOnConstAsTypeAnnotation.js] diff --git a/tests/baselines/reference/parser10.1.1-8gs.errors.txt b/tests/baselines/reference/parser10.1.1-8gs.errors.txt index 185665d23da..3426ccab8da 100644 --- a/tests/baselines/reference/parser10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/parser10.1.1-8gs.errors.txt @@ -1,8 +1,9 @@ -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(17,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,7): error TS2304: Cannot find name 'NotEarlyError'. +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(18,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode ==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.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 diff --git a/tests/baselines/reference/parser10.1.1-8gs.js b/tests/baselines/reference/parser10.1.1-8gs.js index e7d342cf1f1..fb3b96f6baf 100644 --- a/tests/baselines/reference/parser10.1.1-8gs.js +++ b/tests/baselines/reference/parser10.1.1-8gs.js @@ -1,4 +1,5 @@ //// [parser10.1.1-8gs.ts] + /// 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 diff --git a/tests/baselines/reference/parser768531.js b/tests/baselines/reference/parser768531.js index 26e22117717..462db3742b3 100644 --- a/tests/baselines/reference/parser768531.js +++ b/tests/baselines/reference/parser768531.js @@ -1,4 +1,5 @@ //// [parser768531.ts] + {a: 3} /x/ diff --git a/tests/baselines/reference/parser768531.symbols b/tests/baselines/reference/parser768531.symbols index 2da2298c8e2..f180922c7e0 100644 --- a/tests/baselines/reference/parser768531.symbols +++ b/tests/baselines/reference/parser768531.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts === -{a: 3} + +No type information for this code.{a: 3} No type information for this code./x/ No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser768531.types b/tests/baselines/reference/parser768531.types index f1bcedefae9..434535b5cc9 100644 --- a/tests/baselines/reference/parser768531.types +++ b/tests/baselines/reference/parser768531.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts === + {a: 3} >a : any >3 : number diff --git a/tests/baselines/reference/parserAccessors1.errors.txt b/tests/baselines/reference/parserAccessors1.errors.txt index 8c5033da0c4..2ef8d4e37ab 100644 --- a/tests/baselines/reference/parserAccessors1.errors.txt +++ b/tests/baselines/reference/parserAccessors1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors1.ts(2,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors1.ts(2,9): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors1.ts (1 errors) ==== class C { get Foo() { } ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserAccessors10.errors.txt b/tests/baselines/reference/parserAccessors10.errors.txt index a5228f47443..d6a2b99eaca 100644 --- a/tests/baselines/reference/parserAccessors10.errors.txt +++ b/tests/baselines/reference/parserAccessors10.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,14): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,14): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts (1 errors) ==== var v = { public get foo() { } ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. }; \ No newline at end of file diff --git a/tests/baselines/reference/parserAccessors3.errors.txt b/tests/baselines/reference/parserAccessors3.errors.txt index 2987b606451..5411cd544eb 100644 --- a/tests/baselines/reference/parserAccessors3.errors.txt +++ b/tests/baselines/reference/parserAccessors3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors3.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors3.ts(1,15): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors3.ts (1 errors) ==== var v = { get Foo() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value. \ No newline at end of file diff --git a/tests/baselines/reference/parserAccessors7.errors.txt b/tests/baselines/reference/parserAccessors7.errors.txt index 857833a7673..3938280e6d5 100644 --- a/tests/baselines/reference/parserAccessors7.errors.txt +++ b/tests/baselines/reference/parserAccessors7.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors7.ts(1,15): error TS1054: A 'get' accessor cannot have parameters. -tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors7.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors7.ts(1,15): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors7.ts (2 errors) ==== @@ -7,4 +7,4 @@ tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors7.ts(1,15): ~~~ !!! error TS1054: A 'get' accessor cannot have parameters. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName4.errors.txt b/tests/baselines/reference/parserComputedPropertyName4.errors.txt index bfc78b162fd..3430e75b82f 100644 --- a/tests/baselines/reference/parserComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName5.errors.txt b/tests/baselines/reference/parserComputedPropertyName5.errors.txt index 07cc6f3a9f0..09c38ecbef5 100644 --- a/tests/baselines/reference/parserComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (2 errors) ==== var v = { public get [e]() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES3Accessors1.errors.txt b/tests/baselines/reference/parserES3Accessors1.errors.txt index 5e2ca9f97bc..9c6dbf0e76f 100644 --- a/tests/baselines/reference/parserES3Accessors1.errors.txt +++ b/tests/baselines/reference/parserES3Accessors1.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors1.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors1.ts(2,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors1.ts(2,9): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors1.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors1.ts(2,9) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES3Accessors3.errors.txt b/tests/baselines/reference/parserES3Accessors3.errors.txt index 6d262e2a855..70ab3f2072e 100644 --- a/tests/baselines/reference/parserES3Accessors3.errors.txt +++ b/tests/baselines/reference/parserES3Accessors3.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors3.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors3.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors3.ts(1,15): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors3.ts (2 errors) ==== @@ -7,4 +7,4 @@ tests/cases/conformance/parser/ecmascript3/Accessors/parserES3Accessors3.ts(1,15 ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index cfb12152c94..854bb364842 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js index cac70523022..36c505b0a12 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.js +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -3,6 +3,6 @@ for (const v of X) { } //// [parserES5ForOfStatement10.js] -for (var _i = 0; _i < X.length; _i++) { - var v = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var v = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js index 40e4ca68d6b..e3bac1584fc 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.js +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -3,6 +3,6 @@ for (const [a, b] of X) { } //// [parserES5ForOfStatement11.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a[0], b = _a[1]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js index f877ebdb757..2a43ca2dea3 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.js +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -3,6 +3,6 @@ for (const {a, b} of X) { } //// [parserES5ForOfStatement12.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a.a, b = _a.b; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js index 45199480518..2f1f280090f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.js +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -3,6 +3,6 @@ for (let {a, b} of X) { } //// [parserES5ForOfStatement13.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a.a, b = _a.b; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js index d05fdb96e57..cb753328937 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.js +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -3,6 +3,6 @@ for (let [a, b] of X) { } //// [parserES5ForOfStatement14.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a[0], b = _a[1]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js index 0af74961145..c7c4db351a6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.js +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -3,6 +3,6 @@ for (var [a, b] of X) { } //// [parserES5ForOfStatement15.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a[0], b = _a[1]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js index 1e7c6e005a8..149b6ce3df7 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.js +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -3,6 +3,6 @@ for (var {a, b} of X) { } //// [parserES5ForOfStatement16.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i], a = _a.a, b = _a.b; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js index 905ba9c1d1e..0427adb52d8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.js +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -2,6 +2,6 @@ for (var of of of) { } //// [parserES5ForOfStatement18.js] -for (var _i = 0; _i < of.length; _i++) { - var of = of[_i]; +for (var _i = 0, of_1 = of; _i < of_1.length; _i++) { + var of = of_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js index 287602dfb9c..43b557d9c8f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.js +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -3,6 +3,6 @@ for (var of X) { } //// [parserES5ForOfStatement2.js] -for (var _i = 0; _i < X.length; _i++) { - var _a = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var _a = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js index dcdffbc3cf0..e5d7ebcac21 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.js +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -2,6 +2,6 @@ for (var of of) { } //// [parserES5ForOfStatement21.js] -for (var _i = 0; _i < of.length; _i++) { - var _a = of[_i]; +for (var _i = 0, of_1 = of; _i < of_1.length; _i++) { + var _a = of_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js index a99e96a23b8..953a59fb9b8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.js +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -3,6 +3,6 @@ for (var a, b of X) { } //// [parserES5ForOfStatement3.js] -for (var _i = 0; _i < X.length; _i++) { - var a = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var a = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js index f1558005f20..8ad35187e51 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.js +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -3,6 +3,6 @@ for (var a = 1 of X) { } //// [parserES5ForOfStatement4.js] -for (var _i = 0; _i < X.length; _i++) { - var a = 1 = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var a = 1 = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js index 328b2fba0a7..3138b05e499 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.js +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -3,6 +3,6 @@ for (var a: number of X) { } //// [parserES5ForOfStatement5.js] -for (var _i = 0; _i < X.length; _i++) { - var a = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var a = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js index 15747b93ba9..75454de208e 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.js +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -3,6 +3,6 @@ for (var a = 1, b = 2 of X) { } //// [parserES5ForOfStatement6.js] -for (var _i = 0; _i < X.length; _i++) { - var a = 1 = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var a = 1 = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js index 29e4de8787f..ef3a02e45eb 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.js +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -3,6 +3,6 @@ for (var a: number = 1, b: string = "" of X) { } //// [parserES5ForOfStatement7.js] -for (var _i = 0; _i < X.length; _i++) { - var a = 1 = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var a = 1 = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js index 5c449fc6433..7aa61972601 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.js +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -3,6 +3,6 @@ for (var v of X) { } //// [parserES5ForOfStatement8.js] -for (var _i = 0; _i < X.length; _i++) { - var v = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var v = X_1[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js index 6b63d58a88a..8202d2812c1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.js +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -3,6 +3,6 @@ for (let v of X) { } //// [parserES5ForOfStatement9.js] -for (var _i = 0; _i < X.length; _i++) { - var v = X[_i]; +for (var _i = 0, X_1 = X; _i < X_1.length; _i++) { + var v = X_1[_i]; } diff --git a/tests/baselines/reference/parserErrorRecovery_Block3.errors.txt b/tests/baselines/reference/parserErrorRecovery_Block3.errors.txt index 9d391e39007..e6033d05215 100644 --- a/tests/baselines/reference/parserErrorRecovery_Block3.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_Block3.errors.txt @@ -1,18 +1,18 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts(2,18): 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/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts(2,18): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts(4,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts(4,18): 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/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts(4,18): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block3.ts (3 errors) ==== class C { private a(): boolean { ~~~~~~~ -!!! error TS2355: 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. private b(): boolean { ~~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~ -!!! error TS2355: 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. } } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt index 4b8be3e17ad..05b31b7af8e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.errors.txt @@ -1,13 +1,16 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(2,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(3,1): error TS7027: Unreachable code detected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts(4,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement1.ts (3 errors) ==== return foo; } ~ !!! error TS1128: Declaration or statement expected. return bar; + ~~~~~~ +!!! error TS7027: Unreachable code detected. } ~ !!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserGetAccessorWithTypeParameters1.errors.txt b/tests/baselines/reference/parserGetAccessorWithTypeParameters1.errors.txt index 0cf731cb516..09502f6b888 100644 --- a/tests/baselines/reference/parserGetAccessorWithTypeParameters1.errors.txt +++ b/tests/baselines/reference/parserGetAccessorWithTypeParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Accessors/parserGetAccessorWithTypeParameters1.ts(2,7): error TS1094: An accessor cannot have type parameters. -tests/cases/conformance/parser/ecmascript5/Accessors/parserGetAccessorWithTypeParameters1.ts(2,7): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/Accessors/parserGetAccessorWithTypeParameters1.ts(2,7): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/Accessors/parserGetAccessorWithTypeParameters1.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/Accessors/parserGetAccessorWithTypePa ~~~ !!! error TS1094: An accessor cannot have type parameters. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserLabeledStatement1.d.errors.txt b/tests/baselines/reference/parserLabeledStatement1.d.errors.txt index 11de61548a3..2ce51b0bb4c 100644 --- a/tests/baselines/reference/parserLabeledStatement1.d.errors.txt +++ b/tests/baselines/reference/parserLabeledStatement1.d.errors.txt @@ -1,11 +1,14 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts(2,3): error TS2304: Cannot find name 'bar'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserLabeledStatement1.d.ts (3 errors) ==== foo: ~~~ !!! error TS1036: Statements are not allowed in ambient contexts. + ~~~ +!!! error TS7028: Unused label. bar(); ~~~ !!! error TS2304: Cannot find name 'bar'. \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessor1.errors.txt b/tests/baselines/reference/parserMemberAccessor1.errors.txt index aa7cdcdafa3..2a3fd7d7028 100644 --- a/tests/baselines/reference/parserMemberAccessor1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessor1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessor1.ts(2,7): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessor1.ts(2,7): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessor1.ts (1 errors) ==== class C { get foo() { } ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. set foo(a) { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration1.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration1.errors.txt index ac96e7d94b7..c2db31a5398 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration1.ts(2,7): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration1.ts(2,7): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration1.ts (1 errors) ==== class C { get a() { } ~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt index 9a04674d6d7..ece110db165 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,5): error TS1031: 'export' modifier cannot appear on a class element. -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,16): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb ~~~~~~ !!! error TS1031: 'export' modifier cannot appear on a class element. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration12.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration12.errors.txt index 0d14a2adab8..a4ea29518d1 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration12.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration12.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration12.ts(2,8): error TS1054: A 'get' accessor cannot have parameters. -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration12.ts(2,8): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration12.ts(2,8): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration12.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb ~~~ !!! error TS1054: A 'get' accessor cannot have parameters. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration2.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration2.errors.txt index 69e87dff659..7b66bee844f 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration2.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration2.ts(2,7): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration2.ts(2,7): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration2.ts (1 errors) ==== class C { get "b"() { } ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration3.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration3.errors.txt index 93a1a5d14e1..a37fe230f76 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration3.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration3.ts(2,7): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration3.ts(2,7): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration3.ts (1 errors) ==== class C { get 0() { } ~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration7.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration7.errors.txt index b7f67da49b7..2b0bd40a4f2 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration7.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration7.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration7.ts(2,12): error TS1028: Accessibility modifier already seen. -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration7.ts(2,23): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration7.ts(2,23): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration7.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb ~~~~~~ !!! error TS1028: Accessibility modifier already seen. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration8.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration8.errors.txt index e5a39c149f6..67ba09b8c72 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration8.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration8.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration8.ts(2,12): error TS1030: 'static' modifier already seen. -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration8.ts(2,23): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration8.ts(2,23): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration8.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb ~~~~~~ !!! error TS1030: 'static' modifier already seen. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration9.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration9.errors.txt index 2da32a5807b..31d001aeafc 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration9.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration9.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration9.ts(2,12): error TS1029: 'public' modifier must precede 'static' modifier. -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration9.ts(2,23): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration9.ts(2,23): error TS2378: A 'get' accessor must return a value. ==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration9.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb ~~~~~~ !!! error TS1029: 'public' modifier must precede 'static' modifier. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +!!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserParameterList5.errors.txt b/tests/baselines/reference/parserParameterList5.errors.txt index 231a5bbb162..5f0899fa1a2 100644 --- a/tests/baselines/reference/parserParameterList5.errors.txt +++ b/tests/baselines/reference/parserParameterList5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.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/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.ts(1,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.ts(1,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.ts(1,29): error TS2304: Cannot find name 'C'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.t ==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList5.ts (3 errors) ==== function A(): (public B) => C { ~~~~~~~~~~~~~~~ -!!! error TS2355: 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. ~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. ~ diff --git a/tests/baselines/reference/parser_breakTarget3.js b/tests/baselines/reference/parser_breakTarget3.js index 0eceba87bf8..91ba9fb5993 100644 --- a/tests/baselines/reference/parser_breakTarget3.js +++ b/tests/baselines/reference/parser_breakTarget3.js @@ -1,4 +1,5 @@ //// [parser_breakTarget3.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/parser_breakTarget3.symbols b/tests/baselines/reference/parser_breakTarget3.symbols index 99ec413987a..35184471d4d 100644 --- a/tests/baselines/reference/parser_breakTarget3.symbols +++ b/tests/baselines/reference/parser_breakTarget3.symbols @@ -1,5 +1,6 @@ === tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. break target1; diff --git a/tests/baselines/reference/parser_breakTarget3.types b/tests/baselines/reference/parser_breakTarget3.types index 7cdcb74d7da..b1ce9f8d94d 100644 --- a/tests/baselines/reference/parser_breakTarget3.types +++ b/tests/baselines/reference/parser_breakTarget3.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/parser_breakTarget4.js b/tests/baselines/reference/parser_breakTarget4.js index c6cadb5efa1..4516cf3e8f9 100644 --- a/tests/baselines/reference/parser_breakTarget4.js +++ b/tests/baselines/reference/parser_breakTarget4.js @@ -1,4 +1,5 @@ //// [parser_breakTarget4.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/parser_breakTarget4.symbols b/tests/baselines/reference/parser_breakTarget4.symbols index 042df67d9b2..f4d4b2e4bff 100644 --- a/tests/baselines/reference/parser_breakTarget4.symbols +++ b/tests/baselines/reference/parser_breakTarget4.symbols @@ -1,5 +1,6 @@ === tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. break target2; diff --git a/tests/baselines/reference/parser_breakTarget4.types b/tests/baselines/reference/parser_breakTarget4.types index 7315175800e..04bb129c919 100644 --- a/tests/baselines/reference/parser_breakTarget4.types +++ b/tests/baselines/reference/parser_breakTarget4.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/parser_breakTarget5.errors.txt b/tests/baselines/reference/parser_breakTarget5.errors.txt index 8221cbebb4c..5943649c97b 100644 --- a/tests/baselines/reference/parser_breakTarget5.errors.txt +++ b/tests/baselines/reference/parser_breakTarget5.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. -==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget5.ts (2 errors) ==== target: + ~~~~~~ +!!! error TS7028: Unused label. while (true) { function f() { while (true) { diff --git a/tests/baselines/reference/parser_continueNotInIterationStatement4.errors.txt b/tests/baselines/reference/parser_continueNotInIterationStatement4.errors.txt index efade17a52a..94392259568 100644 --- a/tests/baselines/reference/parser_continueNotInIterationStatement4.errors.txt +++ b/tests/baselines/reference/parser_continueNotInIterationStatement4.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts(4,5): error TS1107: Jump target cannot cross function boundary. -==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueNotInIterationStatement4.ts (2 errors) ==== TWO: + ~~~ +!!! error TS7028: Unused label. while (true){ var x = () => { continue TWO; diff --git a/tests/baselines/reference/parser_continueTarget3.js b/tests/baselines/reference/parser_continueTarget3.js index 76a98a0e204..ea1559346de 100644 --- a/tests/baselines/reference/parser_continueTarget3.js +++ b/tests/baselines/reference/parser_continueTarget3.js @@ -1,4 +1,5 @@ //// [parser_continueTarget3.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/parser_continueTarget3.symbols b/tests/baselines/reference/parser_continueTarget3.symbols index 2038671d215..c522444ca1a 100644 --- a/tests/baselines/reference/parser_continueTarget3.symbols +++ b/tests/baselines/reference/parser_continueTarget3.symbols @@ -1,5 +1,6 @@ === tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. continue target1; diff --git a/tests/baselines/reference/parser_continueTarget3.types b/tests/baselines/reference/parser_continueTarget3.types index 33c931c7959..fd8aedc357f 100644 --- a/tests/baselines/reference/parser_continueTarget3.types +++ b/tests/baselines/reference/parser_continueTarget3.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/parser_continueTarget4.js b/tests/baselines/reference/parser_continueTarget4.js index 795cab2e2ad..9ccaaac27e7 100644 --- a/tests/baselines/reference/parser_continueTarget4.js +++ b/tests/baselines/reference/parser_continueTarget4.js @@ -1,4 +1,5 @@ //// [parser_continueTarget4.ts] + target1: target2: while (true) { diff --git a/tests/baselines/reference/parser_continueTarget4.symbols b/tests/baselines/reference/parser_continueTarget4.symbols index 2b47099715e..b7e770f9bf9 100644 --- a/tests/baselines/reference/parser_continueTarget4.symbols +++ b/tests/baselines/reference/parser_continueTarget4.symbols @@ -1,5 +1,6 @@ === tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts === -target1: + +No type information for this code.target1: No type information for this code.target2: No type information for this code.while (true) { No type information for this code. continue target2; diff --git a/tests/baselines/reference/parser_continueTarget4.types b/tests/baselines/reference/parser_continueTarget4.types index cb0367283ce..be1e5458f4b 100644 --- a/tests/baselines/reference/parser_continueTarget4.types +++ b/tests/baselines/reference/parser_continueTarget4.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts === + target1: >target1 : any diff --git a/tests/baselines/reference/parser_continueTarget5.errors.txt b/tests/baselines/reference/parser_continueTarget5.errors.txt index ffeee7a07b3..b9b1f2edb94 100644 --- a/tests/baselines/reference/parser_continueTarget5.errors.txt +++ b/tests/baselines/reference/parser_continueTarget5.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts(5,7): error TS1107: Jump target cannot cross function boundary. -==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget5.ts (2 errors) ==== target: + ~~~~~~ +!!! error TS7028: Unused label. while (true) { function f() { while (true) { diff --git a/tests/baselines/reference/parser_duplicateLabel1.errors.txt b/tests/baselines/reference/parser_duplicateLabel1.errors.txt index 4733a240e36..a4319aaa7b9 100644 --- a/tests/baselines/reference/parser_duplicateLabel1.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel1.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target' -==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts (2 errors) ==== target: + ~~~~~~ +!!! error TS7028: Unused label. target: ~~~~~~ !!! error TS1114: Duplicate label 'target' diff --git a/tests/baselines/reference/parser_duplicateLabel2.errors.txt b/tests/baselines/reference/parser_duplicateLabel2.errors.txt index 92078593e47..123949fa5aa 100644 --- a/tests/baselines/reference/parser_duplicateLabel2.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel2.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(1,1): error TS7028: Unused label. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target' -==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts (2 errors) ==== target: + ~~~~~~ +!!! error TS7028: Unused label. while (true) { target: ~~~~~~ diff --git a/tests/baselines/reference/parser_duplicateLabel3.js b/tests/baselines/reference/parser_duplicateLabel3.js index 9bd6c56356a..c2ea2769f18 100644 --- a/tests/baselines/reference/parser_duplicateLabel3.js +++ b/tests/baselines/reference/parser_duplicateLabel3.js @@ -1,4 +1,5 @@ //// [parser_duplicateLabel3.ts] + target: while (true) { function f() { diff --git a/tests/baselines/reference/parser_duplicateLabel3.symbols b/tests/baselines/reference/parser_duplicateLabel3.symbols index 20627a0e2b8..7e238eb2916 100644 --- a/tests/baselines/reference/parser_duplicateLabel3.symbols +++ b/tests/baselines/reference/parser_duplicateLabel3.symbols @@ -1,8 +1,9 @@ === tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts === + target: while (true) { function f() { ->f : Symbol(f, Decl(parser_duplicateLabel3.ts, 1, 14)) +>f : Symbol(f, Decl(parser_duplicateLabel3.ts, 2, 14)) target: while (true) { diff --git a/tests/baselines/reference/parser_duplicateLabel3.types b/tests/baselines/reference/parser_duplicateLabel3.types index 05cfe708161..88ea435bf3e 100644 --- a/tests/baselines/reference/parser_duplicateLabel3.types +++ b/tests/baselines/reference/parser_duplicateLabel3.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts === + target: >target : any diff --git a/tests/baselines/reference/parser_duplicateLabel4.js b/tests/baselines/reference/parser_duplicateLabel4.js index 569a9bcd102..a9491314426 100644 --- a/tests/baselines/reference/parser_duplicateLabel4.js +++ b/tests/baselines/reference/parser_duplicateLabel4.js @@ -1,4 +1,5 @@ //// [parser_duplicateLabel4.ts] + target: while (true) { } diff --git a/tests/baselines/reference/parser_duplicateLabel4.symbols b/tests/baselines/reference/parser_duplicateLabel4.symbols index 564531bf71b..e7123de1600 100644 --- a/tests/baselines/reference/parser_duplicateLabel4.symbols +++ b/tests/baselines/reference/parser_duplicateLabel4.symbols @@ -1,5 +1,6 @@ === tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts === -target: + +No type information for this code.target: No type information for this code.while (true) { No type information for this code.} No type information for this code. diff --git a/tests/baselines/reference/parser_duplicateLabel4.types b/tests/baselines/reference/parser_duplicateLabel4.types index d09529301ca..b70dd12c695 100644 --- a/tests/baselines/reference/parser_duplicateLabel4.types +++ b/tests/baselines/reference/parser_duplicateLabel4.types @@ -1,4 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts === + target: >target : any diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt index bc6229815f5..0f148b6a20e 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt @@ -1,7 +1,19 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(3,12): error TS4050: Return type of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(7,49): error TS7027: Unreachable code detected. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(9,5): error TS4053: Return type of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(10,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(13,49): error TS7027: Unreachable code detected. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(15,12): error TS4050: Return type of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(19,49): error TS7027: Unreachable code detected. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(21,5): error TS4053: Return type of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(22,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(25,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(34,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(37,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(40,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(46,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(49,49): error TS7027: Unreachable code detected. +tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(52,49): error TS7027: Unreachable code detected. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(56,17): error TS4058: Return type of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(62,17): error TS4058: Return type of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(70,12): error TS4050: Return type of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. @@ -12,7 +24,7 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(83,17): error tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error TS4058: Return type of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts (12 errors) ==== +==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts (24 errors) ==== import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod() { // Error @@ -22,14 +34,20 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error } private static myPrivateStaticMethod() { return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } myPublicMethod() { // Error ~~~~~~~~~~~~~~ !!! error TS4053: Return type of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } private myPrivateMethod() { return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } static myPublicStaticMethod1() { // Error ~~~~~~~~~~~~~~~~~~~~~ @@ -38,14 +56,20 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error } private static myPrivateStaticMethod1() { return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } myPublicMethod1() { // Error ~~~~~~~~~~~~~~~ !!! error TS4053: Return type of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } private myPrivateMethod1() { return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } } @@ -55,24 +79,36 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error } private static myPrivateStaticMethod() { return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } myPublicMethod() { return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } private myPrivateMethod() { return exporter.createExportedWidget1();; + ~ +!!! error TS7027: Unreachable code detected. } static myPublicStaticMethod1() { return exporter.createExportedWidget3(); } private static myPrivateStaticMethod1() { return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } myPublicMethod1() { return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } private myPrivateMethod1() { return exporter.createExportedWidget3();; + ~ +!!! error TS7027: Unreachable code detected. } } diff --git a/tests/baselines/reference/reachabilityChecks1.errors.txt b/tests/baselines/reference/reachabilityChecks1.errors.txt new file mode 100644 index 00000000000..18a453969a1 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks1.errors.txt @@ -0,0 +1,99 @@ +tests/cases/compiler/reachabilityChecks1.ts(3,1): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(7,5): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(19,5): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(31,5): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(48,5): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(61,5): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks1.ts(70,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/reachabilityChecks1.ts (7 errors) ==== + + while (true); + var x = 1; + ~~~ +!!! error TS7027: Unreachable code detected. + + module A { + while (true); + let x; + ~~~ +!!! error TS7027: Unreachable code detected. + } + + module A1 { + do {} while(true); + module A { + interface F {} + } + } + + module A2 { + while (true); + module A { + ~~~~~~ +!!! error TS7027: Unreachable code detected. + var x = 1; + } + } + + module A3 { + while (true); + type T = string; + } + + module A4 { + while (true); + module A { + ~~~~~~ +!!! error TS7027: Unreachable code detected. + const enum E { X } + } + } + + function f1(x) { + if (x) { + return; + } + else { + throw new Error("123"); + } + var x; + } + + function f2() { + return; + class A { + ~~~~~ +!!! error TS7027: Unreachable code detected. + } + } + + module B { + for (; ;); + module C { + } + } + + function f3() { + do { + } while (true); + enum E { + ~~~~ +!!! error TS7027: Unreachable code detected. + X = 1 + } + } + + function f4() { + if (true) { + throw new Error(); + } + const enum E { + ~~~~~ +!!! error TS7027: Unreachable code detected. + X = 1 + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks1.js b/tests/baselines/reference/reachabilityChecks1.js new file mode 100644 index 00000000000..dcbfbe89de4 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks1.js @@ -0,0 +1,156 @@ +//// [reachabilityChecks1.ts] + +while (true); +var x = 1; + +module A { + while (true); + let x; +} + +module A1 { + do {} while(true); + module A { + interface F {} + } +} + +module A2 { + while (true); + module A { + var x = 1; + } +} + +module A3 { + while (true); + type T = string; +} + +module A4 { + while (true); + module A { + const enum E { X } + } +} + +function f1(x) { + if (x) { + return; + } + else { + throw new Error("123"); + } + var x; +} + +function f2() { + return; + class A { + } +} + +module B { + for (; ;); + module C { + } +} + +function f3() { + do { + } while (true); + enum E { + X = 1 + } +} + +function f4() { + if (true) { + throw new Error(); + } + const enum E { + X = 1 + } +} + + + +//// [reachabilityChecks1.js] +while (true) + ; +var x = 1; +var A; +(function (A) { + while (true) + ; + var x; +})(A || (A = {})); +var A1; +(function (A1) { + do { } while (true); +})(A1 || (A1 = {})); +var A2; +(function (A2) { + while (true) + ; + var A; + (function (A) { + var x = 1; + })(A || (A = {})); +})(A2 || (A2 = {})); +var A3; +(function (A3) { + while (true) + ; +})(A3 || (A3 = {})); +var A4; +(function (A4) { + while (true) + ; + var A; + (function (A) { + var E; + (function (E) { + E[E["X"] = 0] = "X"; + })(E || (E = {})); + })(A || (A = {})); +})(A4 || (A4 = {})); +function f1(x) { + if (x) { + return; + } + else { + throw new Error("123"); + } + var x; +} +function f2() { + return; + var A = (function () { + function A() { + } + return A; + })(); +} +var B; +(function (B) { + for (;;) + ; +})(B || (B = {})); +function f3() { + do { + } while (true); + var E; + (function (E) { + E[E["X"] = 1] = "X"; + })(E || (E = {})); +} +function f4() { + if (true) { + throw new Error(); + } + var E; + (function (E) { + E[E["X"] = 1] = "X"; + })(E || (E = {})); +} diff --git a/tests/baselines/reference/reachabilityChecks2.errors.txt b/tests/baselines/reference/reachabilityChecks2.errors.txt new file mode 100644 index 00000000000..cd48f84f8e1 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks2.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/reachabilityChecks2.ts(5,1): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/reachabilityChecks2.ts (1 errors) ==== + + while (true) { } + const enum E { X } + + module A4 { + ~~~~~~ +!!! error TS7027: Unreachable code detected. + while (true); + module A { + const enum E { X } + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks2.js b/tests/baselines/reference/reachabilityChecks2.js new file mode 100644 index 00000000000..a17b51b4ca6 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks2.js @@ -0,0 +1,21 @@ +//// [reachabilityChecks2.ts] + +while (true) { } +const enum E { X } + +module A4 { + while (true); + module A { + const enum E { X } + } +} + + + +//// [reachabilityChecks2.js] +while (true) { } +var A4; +(function (A4) { + while (true) + ; +})(A4 || (A4 = {})); diff --git a/tests/baselines/reference/reachabilityChecks3.errors.txt b/tests/baselines/reference/reachabilityChecks3.errors.txt new file mode 100644 index 00000000000..1114f245f44 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks3.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/reachabilityChecks3.ts(3,1): error TS7028: Unused label. +tests/cases/compiler/reachabilityChecks3.ts(12,5): error TS7028: Unused label. +tests/cases/compiler/reachabilityChecks3.ts(15,17): error TS7028: Unused label. + + +==== tests/cases/compiler/reachabilityChecks3.ts (3 errors) ==== + + let x = 1; + loop: while (true) { + ~~~~ +!!! error TS7028: Unused label. + if (x == 100) { + break; + } + else { + x++; + } + } + { + x: 100 + ~ +!!! error TS7028: Unused label. + } + + var y = () => { f: 1 } + ~ +!!! error TS7028: Unused label. \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks3.js b/tests/baselines/reference/reachabilityChecks3.js new file mode 100644 index 00000000000..dd22453938d --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks3.js @@ -0,0 +1,31 @@ +//// [reachabilityChecks3.ts] + +let x = 1; +loop: while (true) { + if (x == 100) { + break; + } + else { + x++; + } +} +{ + x: 100 +} + +var y = () => { f: 1 } + +//// [reachabilityChecks3.js] +var x = 1; +loop: while (true) { + if (x == 100) { + break; + } + else { + x++; + } +} +{ + x: 100; +} +var y = function () { f: 1; }; diff --git a/tests/baselines/reference/reachabilityChecks4.errors.txt b/tests/baselines/reference/reachabilityChecks4.errors.txt new file mode 100644 index 00000000000..ba9519462e7 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks4.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/reachabilityChecks4.ts(7,9): error TS7029: Fallthrough case in switch. + + +==== tests/cases/compiler/reachabilityChecks4.ts (1 errors) ==== + + function foo(x, y) { + switch (x) { + case 1: + case 2: + return 1; + case 3: + ~~~~ +!!! error TS7029: Fallthrough case in switch. + if (y) { + return 2; + } + case 4: + return 3; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks4.js b/tests/baselines/reference/reachabilityChecks4.js new file mode 100644 index 00000000000..588644c5a05 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks4.js @@ -0,0 +1,30 @@ +//// [reachabilityChecks4.ts] + +function foo(x, y) { + switch (x) { + case 1: + case 2: + return 1; + case 3: + if (y) { + return 2; + } + case 4: + return 3; + } +} + +//// [reachabilityChecks4.js] +function foo(x, y) { + switch (x) { + case 1: + case 2: + return 1; + case 3: + if (y) { + return 2; + } + case 4: + return 3; + } +} diff --git a/tests/baselines/reference/reachabilityChecks5.errors.txt b/tests/baselines/reference/reachabilityChecks5.errors.txt new file mode 100644 index 00000000000..147dbe264a3 --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks5.errors.txt @@ -0,0 +1,162 @@ +tests/cases/compiler/reachabilityChecks5.ts(6,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(19,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/compiler/reachabilityChecks5.ts(31,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(41,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(52,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(80,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(86,13): error TS7027: Unreachable code detected. +tests/cases/compiler/reachabilityChecks5.ts(94,17): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(116,18): error TS7030: Not all code paths return a value. +tests/cases/compiler/reachabilityChecks5.ts(123,13): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/reachabilityChecks5.ts (10 errors) ==== + + function f0(x): number { + while (true); + } + + function f1(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + if (x) { + return 1 + } + } + + function f2(x): number { + while (x) { + throw new Error(); + } + return 1; + } + + function f3(x): number { + ~~~~~~ +!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. + while (x) { + throw new Error(); + } + } + + function f3_1 (x): number { + while (x) { + } + throw new Error(); + } + + function f4(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + if (x) { + return 1; + } + } + catch (e) { + } + } + + function f5(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + if (x) { + return 1; + } + } + catch (e) { + return 2; + } + } + + function f6(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + if (x) { + return 1; + } + else + { + throw new Error(); + } + } + catch (e) { + } + } + + function f7(x): number { + try { + if (x) { + return 1; + } + else { + throw new Error(); + } + } + catch (e) { + return 1; + } + } + + function f8(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + if (true) { + x++; + } + else { + return 1; + ~~~~~~ +!!! error TS7027: Unreachable code detected. + } + } + catch (e) { + return 1; + } + } + + function f9(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + try { + while (false) { + return 1; + } + } + catch (e) { + return 1; + } + } + + function f10(x): number { + try { + do { + x++; + } while (true); + } + catch (e) { + return 1; + } + } + + function f11(x): number { + ~~~~~~ +!!! error TS7030: Not all code paths return a value. + test: + try { + do { + do { + break test; + } while (true); + x++; + ~ +!!! error TS7027: Unreachable code detected. + } while (true); + } + catch (e) { + return 1; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks5.js b/tests/baselines/reference/reachabilityChecks5.js new file mode 100644 index 00000000000..a6c507ac87b --- /dev/null +++ b/tests/baselines/reference/reachabilityChecks5.js @@ -0,0 +1,247 @@ +//// [reachabilityChecks5.ts] + +function f0(x): number { + while (true); +} + +function f1(x): number { + if (x) { + return 1 + } +} + +function f2(x): number { + while (x) { + throw new Error(); + } + return 1; +} + +function f3(x): number { + while (x) { + throw new Error(); + } +} + +function f3_1 (x): number { + while (x) { + } + throw new Error(); +} + +function f4(x): number { + try { + if (x) { + return 1; + } + } + catch (e) { + } +} + +function f5(x): number { + try { + if (x) { + return 1; + } + } + catch (e) { + return 2; + } +} + +function f6(x): number { + try { + if (x) { + return 1; + } + else + { + throw new Error(); + } + } + catch (e) { + } +} + +function f7(x): number { + try { + if (x) { + return 1; + } + else { + throw new Error(); + } + } + catch (e) { + return 1; + } +} + +function f8(x): number { + try { + if (true) { + x++; + } + else { + return 1; + } + } + catch (e) { + return 1; + } +} + +function f9(x): number { + try { + while (false) { + return 1; + } + } + catch (e) { + return 1; + } +} + +function f10(x): number { + try { + do { + x++; + } while (true); + } + catch (e) { + return 1; + } +} + +function f11(x): number { + test: + try { + do { + do { + break test; + } while (true); + x++; + } while (true); + } + catch (e) { + return 1; + } +} + +//// [reachabilityChecks5.js] +function f0(x) { + while (true) + ; +} +function f1(x) { + if (x) { + return 1; + } +} +function f2(x) { + while (x) { + throw new Error(); + } + return 1; +} +function f3(x) { + while (x) { + throw new Error(); + } +} +function f3_1(x) { + while (x) { + } + throw new Error(); +} +function f4(x) { + try { + if (x) { + return 1; + } + } + catch (e) { + } +} +function f5(x) { + try { + if (x) { + return 1; + } + } + catch (e) { + return 2; + } +} +function f6(x) { + try { + if (x) { + return 1; + } + else { + throw new Error(); + } + } + catch (e) { + } +} +function f7(x) { + try { + if (x) { + return 1; + } + else { + throw new Error(); + } + } + catch (e) { + return 1; + } +} +function f8(x) { + try { + if (true) { + x++; + } + else { + return 1; + } + } + catch (e) { + return 1; + } +} +function f9(x) { + try { + while (false) { + return 1; + } + } + catch (e) { + return 1; + } +} +function f10(x) { + try { + do { + x++; + } while (true); + } + catch (e) { + return 1; + } +} +function f11(x) { + test: try { + do { + do { + break test; + } while (true); + x++; + } while (true); + } + catch (e) { + return 1; + } +} diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index c69549403c4..8d5303c0669 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/recursiveFunctionTypes.ts(1,35): error TS2322: Type 'number tests/cases/compiler/recursiveFunctionTypes.ts(3,5): error TS2322: Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(4,5): error TS2322: Type '() => typeof fn' is not assignable to type '() => number'. Type '() => typeof fn' is not assignable to type 'number'. -tests/cases/compiler/recursiveFunctionTypes.ts(11,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/recursiveFunctionTypes.ts(12,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/recursiveFunctionTypes.ts(11,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. +tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type 'number' is not assignable to type '() => any'. @@ -34,10 +34,10 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of function f2(): typeof g2 { } ~~~~~~~~~ -!!! error TS2355: 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. function g2(): typeof f2 { } ~~~~~~~~~ -!!! error TS2355: 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. interface I { } function f3(): I { return f3; } diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt index b02d0819a3f..88ecb379e5e 100644 --- a/tests/baselines/reference/recursiveLetConst.errors.txt +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/recursiveLetConst.ts(3,12): error TS2448: Block-scoped vari tests/cases/compiler/recursiveLetConst.ts(4,11): error TS2448: Block-scoped variable 'y' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(5,14): error TS2448: Block-scoped variable 'y1' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(6,14): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(7,1): error TS7027: Unreachable code detected. tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration. @@ -10,7 +11,7 @@ tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped var tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped variable 'x2' used before its declaration. -==== tests/cases/compiler/recursiveLetConst.ts (10 errors) ==== +==== tests/cases/compiler/recursiveLetConst.ts (11 errors) ==== 'use strict' let x = x + 1; ~ @@ -28,6 +29,8 @@ tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped var ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let [v] = v; ;) { } + ~~~ +!!! error TS7027: Unreachable code detected. ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let v in v) { } diff --git a/tests/baselines/reference/recursiveMods.js b/tests/baselines/reference/recursiveMods.js index 36d2712e040..f913ddec012 100644 --- a/tests/baselines/reference/recursiveMods.js +++ b/tests/baselines/reference/recursiveMods.js @@ -1,4 +1,5 @@ //// [recursiveMods.ts] + export module Foo { export class C {} } diff --git a/tests/baselines/reference/recursiveMods.symbols b/tests/baselines/reference/recursiveMods.symbols index 1e7e8fa1c84..5f6d6f87721 100644 --- a/tests/baselines/reference/recursiveMods.symbols +++ b/tests/baselines/reference/recursiveMods.symbols @@ -1,44 +1,45 @@ === tests/cases/compiler/recursiveMods.ts === + export module Foo { ->Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 3, 1)) export class C {} ->C : Symbol(C, Decl(recursiveMods.ts, 0, 19)) +>C : Symbol(C, Decl(recursiveMods.ts, 1, 19)) } export module Foo { ->Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(recursiveMods.ts, 0, 0), Decl(recursiveMods.ts, 3, 1)) function Bar() : C { ->Bar : Symbol(Bar, Decl(recursiveMods.ts, 4, 19)) ->C : Symbol(C, Decl(recursiveMods.ts, 0, 19)) +>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19)) +>C : Symbol(C, Decl(recursiveMods.ts, 1, 19)) if (true) { return Bar();} ->Bar : Symbol(Bar, Decl(recursiveMods.ts, 4, 19)) +>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19)) return new C(); ->C : Symbol(C, Decl(recursiveMods.ts, 0, 19)) +>C : Symbol(C, Decl(recursiveMods.ts, 1, 19)) } function Baz() : C { ->Baz : Symbol(Baz, Decl(recursiveMods.ts, 9, 2)) ->C : Symbol(C, Decl(recursiveMods.ts, 0, 19)) +>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2)) +>C : Symbol(C, Decl(recursiveMods.ts, 1, 19)) var c = Baz(); ->c : Symbol(c, Decl(recursiveMods.ts, 12, 5)) ->Baz : Symbol(Baz, Decl(recursiveMods.ts, 9, 2)) +>c : Symbol(c, Decl(recursiveMods.ts, 13, 5)) +>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2)) return Bar(); ->Bar : Symbol(Bar, Decl(recursiveMods.ts, 4, 19)) +>Bar : Symbol(Bar, Decl(recursiveMods.ts, 5, 19)) } function Gar() { ->Gar : Symbol(Gar, Decl(recursiveMods.ts, 14, 2)) +>Gar : Symbol(Gar, Decl(recursiveMods.ts, 15, 2)) var c : C = Baz(); ->c : Symbol(c, Decl(recursiveMods.ts, 17, 5)) ->C : Symbol(C, Decl(recursiveMods.ts, 0, 19)) ->Baz : Symbol(Baz, Decl(recursiveMods.ts, 9, 2)) +>c : Symbol(c, Decl(recursiveMods.ts, 18, 5)) +>C : Symbol(C, Decl(recursiveMods.ts, 1, 19)) +>Baz : Symbol(Baz, Decl(recursiveMods.ts, 10, 2)) return; } diff --git a/tests/baselines/reference/recursiveMods.types b/tests/baselines/reference/recursiveMods.types index d7f28f84975..d4db816daf7 100644 --- a/tests/baselines/reference/recursiveMods.types +++ b/tests/baselines/reference/recursiveMods.types @@ -1,4 +1,5 @@ === tests/cases/compiler/recursiveMods.ts === + export module Foo { >Foo : typeof Foo diff --git a/tests/baselines/reference/recursiveNamedLambdaCall.errors.txt b/tests/baselines/reference/recursiveNamedLambdaCall.errors.txt index 7729d1e780f..04ddc371ac7 100644 --- a/tests/baselines/reference/recursiveNamedLambdaCall.errors.txt +++ b/tests/baselines/reference/recursiveNamedLambdaCall.errors.txt @@ -1,11 +1,12 @@ tests/cases/compiler/recursiveNamedLambdaCall.ts(3,8): error TS2304: Cannot find name 'top'. tests/cases/compiler/recursiveNamedLambdaCall.ts(3,15): error TS2304: Cannot find name 'top'. +tests/cases/compiler/recursiveNamedLambdaCall.ts(7,6): error TS7027: Unreachable code detected. tests/cases/compiler/recursiveNamedLambdaCall.ts(8,7): error TS2304: Cannot find name 'top'. tests/cases/compiler/recursiveNamedLambdaCall.ts(10,14): error TS2304: Cannot find name 'setTimeout'. tests/cases/compiler/recursiveNamedLambdaCall.ts(14,6): error TS2304: Cannot find name 'detach'. -==== tests/cases/compiler/recursiveNamedLambdaCall.ts (5 errors) ==== +==== tests/cases/compiler/recursiveNamedLambdaCall.ts (6 errors) ==== var promise = function( obj ) { if ( top && top.doScroll ) { @@ -17,6 +18,8 @@ tests/cases/compiler/recursiveNamedLambdaCall.ts(14,6): error TS2304: Cannot fin if ( false ) { try { + ~~~ +!!! error TS7027: Unreachable code detected. top.doScroll("left"); ~~~ !!! error TS2304: Cannot find name 'top'. diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index 090b2d0d43e..d6e2d04073d 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -14,6 +14,7 @@ tests/cases/compiler/reservedWords2.ts(5,9): error TS2300: Duplicate identifier tests/cases/compiler/reservedWords2.ts(5,10): error TS1003: Identifier expected. tests/cases/compiler/reservedWords2.ts(5,18): error TS1005: '=>' expected. tests/cases/compiler/reservedWords2.ts(6,1): error TS2304: Cannot find name 'module'. +tests/cases/compiler/reservedWords2.ts(6,1): error TS7027: Unreachable code detected. tests/cases/compiler/reservedWords2.ts(6,8): error TS1005: ';' expected. tests/cases/compiler/reservedWords2.ts(7,11): error TS2300: Duplicate identifier '(Missing)'. tests/cases/compiler/reservedWords2.ts(7,11): error TS1005: ':' expected. @@ -31,7 +32,7 @@ tests/cases/compiler/reservedWords2.ts(10,5): error TS2300: Duplicate identifier tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected. -==== tests/cases/compiler/reservedWords2.ts (31 errors) ==== +==== tests/cases/compiler/reservedWords2.ts (32 errors) ==== import while = require("dfdf"); ~~~~~~ !!! error TS1148: Cannot compile modules unless the '--module' flag is provided. @@ -70,6 +71,8 @@ tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected. module void {} ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~~~~~~ +!!! error TS7027: Unreachable code detected. ~~~~ !!! error TS1005: ';' expected. var {while, return} = { while: 1, return: 2 }; diff --git a/tests/baselines/reference/returnStatement1.js b/tests/baselines/reference/returnStatement1.js index c4ccc3cadde..3f5c5561b2a 100644 --- a/tests/baselines/reference/returnStatement1.js +++ b/tests/baselines/reference/returnStatement1.js @@ -1,4 +1,5 @@ //// [returnStatement1.ts] + function f() { return function (s) { var x = s; diff --git a/tests/baselines/reference/returnStatement1.symbols b/tests/baselines/reference/returnStatement1.symbols index acec9f76003..6727cba0df5 100644 --- a/tests/baselines/reference/returnStatement1.symbols +++ b/tests/baselines/reference/returnStatement1.symbols @@ -1,13 +1,14 @@ === tests/cases/compiler/returnStatement1.ts === + function f() { >f : Symbol(f, Decl(returnStatement1.ts, 0, 0)) return function (s) { ->s : Symbol(s, Decl(returnStatement1.ts, 1, 21)) +>s : Symbol(s, Decl(returnStatement1.ts, 2, 21)) var x = s; ->x : Symbol(x, Decl(returnStatement1.ts, 2, 11)) ->s : Symbol(s, Decl(returnStatement1.ts, 1, 21)) +>x : Symbol(x, Decl(returnStatement1.ts, 3, 11)) +>s : Symbol(s, Decl(returnStatement1.ts, 2, 21)) }; ("harmless extra line"); diff --git a/tests/baselines/reference/returnStatement1.types b/tests/baselines/reference/returnStatement1.types index ff30148af5a..b7e166ffa75 100644 --- a/tests/baselines/reference/returnStatement1.types +++ b/tests/baselines/reference/returnStatement1.types @@ -1,4 +1,5 @@ === tests/cases/compiler/returnStatement1.ts === + function f() { >f : () => (s: any) => void diff --git a/tests/baselines/reference/returnTypeParameter.errors.txt b/tests/baselines/reference/returnTypeParameter.errors.txt index 11c0888f47c..1bd9f6a63f6 100644 --- a/tests/baselines/reference/returnTypeParameter.errors.txt +++ b/tests/baselines/reference/returnTypeParameter.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/returnTypeParameter.ts(1,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/returnTypeParameter.ts(1,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/returnTypeParameter.ts(2,34): error TS2304: Cannot find name 'T'. ==== tests/cases/compiler/returnTypeParameter.ts (2 errors) ==== function f(a: T): T { } // error, no return statement ~ -!!! error TS2355: 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. function f2(a: T): T { return T; } // bug was that this satisfied the return statement requirement ~ !!! error TS2304: Cannot find name 'T'. \ No newline at end of file diff --git a/tests/baselines/reference/scanner10.1.1-8gs.errors.txt b/tests/baselines/reference/scanner10.1.1-8gs.errors.txt index 54cd92dc0ca..23d89cdf7ff 100644 --- a/tests/baselines/reference/scanner10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/scanner10.1.1-8gs.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'. +tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,1): error TS7027: Unreachable code detected. tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (2 errors) ==== +==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (3 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 @@ -22,6 +23,8 @@ tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS ~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'NotEarlyError'. var public = 1; + ~~~ +!!! error TS7027: Unreachable code detected. ~~~~~~ !!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode \ No newline at end of file diff --git a/tests/baselines/reference/setterWithReturn.errors.txt b/tests/baselines/reference/setterWithReturn.errors.txt index 481116327b8..6aed49105b8 100644 --- a/tests/baselines/reference/setterWithReturn.errors.txt +++ b/tests/baselines/reference/setterWithReturn.errors.txt @@ -1,9 +1,10 @@ tests/cases/compiler/setterWithReturn.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/setterWithReturn.ts(4,20): error TS2408: Setters cannot return a value. +tests/cases/compiler/setterWithReturn.ts(7,13): error TS7027: Unreachable code detected. tests/cases/compiler/setterWithReturn.ts(7,20): error TS2408: Setters cannot return a value. -==== tests/cases/compiler/setterWithReturn.ts (3 errors) ==== +==== tests/cases/compiler/setterWithReturn.ts (4 errors) ==== class C234 { public set p1(arg1) { ~~ @@ -15,6 +16,8 @@ tests/cases/compiler/setterWithReturn.ts(7,20): error TS2408: Setters cannot ret } else { return 0; + ~~~~~~ +!!! error TS7027: Unreachable code detected. ~ !!! error TS2408: Setters cannot return a value. } diff --git a/tests/baselines/reference/sourceMapValidationFor.errors.txt b/tests/baselines/reference/sourceMapValidationFor.errors.txt index 7fe75d640d2..6949d7545ed 100644 --- a/tests/baselines/reference/sourceMapValidationFor.errors.txt +++ b/tests/baselines/reference/sourceMapValidationFor.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/sourceMapValidationFor.ts(2,5): error TS2304: Cannot find name 'WScript'. tests/cases/compiler/sourceMapValidationFor.ts(6,5): error TS2304: Cannot find name 'WScript'. +tests/cases/compiler/sourceMapValidationFor.ts(20,1): error TS7027: Unreachable code detected. -==== tests/cases/compiler/sourceMapValidationFor.ts (2 errors) ==== +==== tests/cases/compiler/sourceMapValidationFor.ts (3 errors) ==== for (var i = 0; i < 10; i++) { WScript.Echo("i: " + i); ~~~~~~~ @@ -27,6 +28,8 @@ tests/cases/compiler/sourceMapValidationFor.ts(6,5): error TS2304: Cannot find n for (var k = 0;; k++) { } for (k = 0;; k++) + ~~~ +!!! error TS7027: Unreachable code detected. { } for (; k < 10; k++) { diff --git a/tests/baselines/reference/sourceMapValidationLabeled.js b/tests/baselines/reference/sourceMapValidationLabeled.js index 7aabc47ea4e..50669b870ab 100644 --- a/tests/baselines/reference/sourceMapValidationLabeled.js +++ b/tests/baselines/reference/sourceMapValidationLabeled.js @@ -1,4 +1,5 @@ //// [sourceMapValidationLabeled.ts] + x: var b = 10; diff --git a/tests/baselines/reference/sourceMapValidationLabeled.js.map b/tests/baselines/reference/sourceMapValidationLabeled.js.map index d1219f9896f..206ac95b951 100644 --- a/tests/baselines/reference/sourceMapValidationLabeled.js.map +++ b/tests/baselines/reference/sourceMapValidationLabeled.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationLabeled.js.map] -{"version":3,"file":"sourceMapValidationLabeled.js","sourceRoot":"","sources":["sourceMapValidationLabeled.ts"],"names":[],"mappings":"AAAA,CAAC,EACD,IAAI,CAAC,GAAG,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationLabeled.js","sourceRoot":"","sources":["sourceMapValidationLabeled.ts"],"names":[],"mappings":"AACA,CAAC,EACD,IAAI,CAAC,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationLabeled.sourcemap.txt b/tests/baselines/reference/sourceMapValidationLabeled.sourcemap.txt index 007208c78f9..7cf1bf896ca 100644 --- a/tests/baselines/reference/sourceMapValidationLabeled.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationLabeled.sourcemap.txt @@ -18,7 +18,8 @@ sourceFile:sourceMapValidationLabeled.ts 7 > ^^ 8 > ^ 9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > +1 > + > 2 >x 3 > : > @@ -27,13 +28,13 @@ sourceFile:sourceMapValidationLabeled.ts 6 > = 7 > 10 8 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) -3 >Emitted(1, 4) Source(2, 1) + SourceIndex(0) -4 >Emitted(1, 8) Source(2, 5) + SourceIndex(0) -5 >Emitted(1, 9) Source(2, 6) + SourceIndex(0) -6 >Emitted(1, 12) Source(2, 9) + SourceIndex(0) -7 >Emitted(1, 14) Source(2, 11) + SourceIndex(0) -8 >Emitted(1, 15) Source(2, 12) + SourceIndex(0) +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(2, 2) + SourceIndex(0) +3 >Emitted(1, 4) Source(3, 1) + SourceIndex(0) +4 >Emitted(1, 8) Source(3, 5) + SourceIndex(0) +5 >Emitted(1, 9) Source(3, 6) + SourceIndex(0) +6 >Emitted(1, 12) Source(3, 9) + SourceIndex(0) +7 >Emitted(1, 14) Source(3, 11) + SourceIndex(0) +8 >Emitted(1, 15) Source(3, 12) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationLabeled.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationLabeled.symbols b/tests/baselines/reference/sourceMapValidationLabeled.symbols index 2a3c4f5606c..bf9abc593b3 100644 --- a/tests/baselines/reference/sourceMapValidationLabeled.symbols +++ b/tests/baselines/reference/sourceMapValidationLabeled.symbols @@ -1,5 +1,6 @@ === tests/cases/compiler/sourceMapValidationLabeled.ts === + x: var b = 10; ->b : Symbol(b, Decl(sourceMapValidationLabeled.ts, 1, 3)) +>b : Symbol(b, Decl(sourceMapValidationLabeled.ts, 2, 3)) diff --git a/tests/baselines/reference/sourceMapValidationLabeled.types b/tests/baselines/reference/sourceMapValidationLabeled.types index 3058869cb0b..7af624ac93b 100644 --- a/tests/baselines/reference/sourceMapValidationLabeled.types +++ b/tests/baselines/reference/sourceMapValidationLabeled.types @@ -1,4 +1,5 @@ === tests/cases/compiler/sourceMapValidationLabeled.ts === + x: >x : any diff --git a/tests/baselines/reference/switchBreakStatements.js b/tests/baselines/reference/switchBreakStatements.js index 534f025e2f5..d7fa279248c 100644 --- a/tests/baselines/reference/switchBreakStatements.js +++ b/tests/baselines/reference/switchBreakStatements.js @@ -1,4 +1,5 @@ //// [switchBreakStatements.ts] + switch ('') { case 'a': break; diff --git a/tests/baselines/reference/switchBreakStatements.symbols b/tests/baselines/reference/switchBreakStatements.symbols index 22626241881..dde7ca028cc 100644 --- a/tests/baselines/reference/switchBreakStatements.symbols +++ b/tests/baselines/reference/switchBreakStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts === + switch ('') { case 'a': break; @@ -48,7 +49,7 @@ switch ('') { switch ('') { case 'a': var fn = function () { } ->fn : Symbol(fn, Decl(switchBreakStatements.ts, 48, 35)) +>fn : Symbol(fn, Decl(switchBreakStatements.ts, 49, 35)) break EIGHT; } diff --git a/tests/baselines/reference/switchBreakStatements.types b/tests/baselines/reference/switchBreakStatements.types index c8847a5dc34..0364d878d5a 100644 --- a/tests/baselines/reference/switchBreakStatements.types +++ b/tests/baselines/reference/switchBreakStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts === + switch ('') { >'' : string diff --git a/tests/baselines/reference/thisTypeErrors2.errors.txt b/tests/baselines/reference/thisTypeErrors2.errors.txt new file mode 100644 index 00000000000..783325f4ef3 --- /dev/null +++ b/tests/baselines/reference/thisTypeErrors2.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/types/thisType/thisTypeErrors2.ts(2,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +tests/cases/conformance/types/thisType/thisTypeErrors2.ts(9,38): error TS2526: A 'this' type is available only in a non-static member of a class or interface. + + +==== tests/cases/conformance/types/thisType/thisTypeErrors2.ts (2 errors) ==== + class Base { + constructor(a: this) { + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + } + } + class Generic { + } + class Derived { + n: number; + constructor(public host: Generic) { + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + let self: this = this; + this.n = 12; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeErrors2.js b/tests/baselines/reference/thisTypeErrors2.js new file mode 100644 index 00000000000..f48d0874e53 --- /dev/null +++ b/tests/baselines/reference/thisTypeErrors2.js @@ -0,0 +1,35 @@ +//// [thisTypeErrors2.ts] +class Base { + constructor(a: this) { + } +} +class Generic { +} +class Derived { + n: number; + constructor(public host: Generic) { + let self: this = this; + this.n = 12; + } +} + + +//// [thisTypeErrors2.js] +var Base = (function () { + function Base(a) { + } + return Base; +})(); +var Generic = (function () { + function Generic() { + } + return Generic; +})(); +var Derived = (function () { + function Derived(host) { + this.host = host; + var self = this; + this.n = 12; + } + return Derived; +})(); diff --git a/tests/baselines/reference/thisTypeInClasses.errors.txt b/tests/baselines/reference/thisTypeInClasses.errors.txt new file mode 100644 index 00000000000..db2ae1b5793 --- /dev/null +++ b/tests/baselines/reference/thisTypeInClasses.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/types/thisType/thisTypeInClasses.ts(4,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface. + + +==== tests/cases/conformance/types/thisType/thisTypeInClasses.ts (1 errors) ==== + class C1 { + x: this; + f(x: this): this { return undefined; } + constructor(x: this) { } + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + } + + class C2 { + [x: string]: this; + } + + interface Foo { + x: T; + y: this; + } + + class C3 { + a: this[]; + b: [this, this]; + c: this | Date; + d: this & Date; + e: (((this))); + f: (x: this) => this; + g: new (x: this) => this; + h: Foo; + i: Foo this)>; + j: (x: any) => x is this; + } + + declare class C4 { + x: this; + f(x: this): this; + } + + class C5 { + foo() { + let f1 = (x: this): this => this; + let f2 = (x: this) => this; + let f3 = (x: this) => (y: this) => this; + let f4 = (x: this) => { + let g = (y: this) => { + return () => this; + } + return g(this); + } + } + bar() { + let x1 = undefined; + let x2 = undefined as this; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/throwInEnclosingStatements.js b/tests/baselines/reference/throwInEnclosingStatements.js index 0b072434f33..4d9200776e7 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.js +++ b/tests/baselines/reference/throwInEnclosingStatements.js @@ -1,4 +1,5 @@ //// [throwInEnclosingStatements.ts] + function fn(x) { throw x; } diff --git a/tests/baselines/reference/throwInEnclosingStatements.symbols b/tests/baselines/reference/throwInEnclosingStatements.symbols index 007894047de..42053c60efa 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.symbols +++ b/tests/baselines/reference/throwInEnclosingStatements.symbols @@ -1,91 +1,92 @@ === tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts === + function fn(x) { >fn : Symbol(fn, Decl(throwInEnclosingStatements.ts, 0, 0)) ->x : Symbol(x, Decl(throwInEnclosingStatements.ts, 0, 12)) +>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 1, 12)) throw x; ->x : Symbol(x, Decl(throwInEnclosingStatements.ts, 0, 12)) +>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 1, 12)) } (x: T) => { throw x; } ->T : Symbol(T, Decl(throwInEnclosingStatements.ts, 4, 1)) ->x : Symbol(x, Decl(throwInEnclosingStatements.ts, 4, 4)) ->T : Symbol(T, Decl(throwInEnclosingStatements.ts, 4, 1)) ->x : Symbol(x, Decl(throwInEnclosingStatements.ts, 4, 4)) +>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 5, 1)) +>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 5, 4)) +>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 5, 1)) +>x : Symbol(x, Decl(throwInEnclosingStatements.ts, 5, 4)) var y: string; ->y : Symbol(y, Decl(throwInEnclosingStatements.ts, 6, 3)) +>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3)) switch (y) { ->y : Symbol(y, Decl(throwInEnclosingStatements.ts, 6, 3)) +>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3)) case 'a': throw y; ->y : Symbol(y, Decl(throwInEnclosingStatements.ts, 6, 3)) +>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3)) default: throw y; ->y : Symbol(y, Decl(throwInEnclosingStatements.ts, 6, 3)) +>y : Symbol(y, Decl(throwInEnclosingStatements.ts, 7, 3)) } var z = 0; ->z : Symbol(z, Decl(throwInEnclosingStatements.ts, 14, 3)) +>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3)) while (z < 10) { ->z : Symbol(z, Decl(throwInEnclosingStatements.ts, 14, 3)) +>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3)) throw z; ->z : Symbol(z, Decl(throwInEnclosingStatements.ts, 14, 3)) +>z : Symbol(z, Decl(throwInEnclosingStatements.ts, 15, 3)) } for (var i = 0; ;) { throw i; } ->i : Symbol(i, Decl(throwInEnclosingStatements.ts, 19, 8)) ->i : Symbol(i, Decl(throwInEnclosingStatements.ts, 19, 8)) +>i : Symbol(i, Decl(throwInEnclosingStatements.ts, 20, 8)) +>i : Symbol(i, Decl(throwInEnclosingStatements.ts, 20, 8)) for (var idx in {}) { throw idx; } ->idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 21, 8)) ->idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 21, 8)) +>idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 22, 8)) +>idx : Symbol(idx, Decl(throwInEnclosingStatements.ts, 22, 8)) do { throw null; }while(true) var j = 0; ->j : Symbol(j, Decl(throwInEnclosingStatements.ts, 25, 3)) +>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3)) while (j < 0) { throw j; } ->j : Symbol(j, Decl(throwInEnclosingStatements.ts, 25, 3)) ->j : Symbol(j, Decl(throwInEnclosingStatements.ts, 25, 3)) +>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3)) +>j : Symbol(j, Decl(throwInEnclosingStatements.ts, 26, 3)) class C { ->C : Symbol(C, Decl(throwInEnclosingStatements.ts, 26, 26)) ->T : Symbol(T, Decl(throwInEnclosingStatements.ts, 28, 8)) +>C : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26)) +>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8)) private value: T; ->value : Symbol(value, Decl(throwInEnclosingStatements.ts, 28, 12)) ->T : Symbol(T, Decl(throwInEnclosingStatements.ts, 28, 8)) +>value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) +>T : Symbol(T, Decl(throwInEnclosingStatements.ts, 29, 8)) biz() { ->biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 29, 21)) +>biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 30, 21)) throw this.value; ->this.value : Symbol(value, Decl(throwInEnclosingStatements.ts, 28, 12)) ->this : Symbol(C, Decl(throwInEnclosingStatements.ts, 26, 26)) ->value : Symbol(value, Decl(throwInEnclosingStatements.ts, 28, 12)) +>this.value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) +>this : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26)) +>value : Symbol(value, Decl(throwInEnclosingStatements.ts, 29, 12)) } constructor() { throw this; ->this : Symbol(C, Decl(throwInEnclosingStatements.ts, 26, 26)) +>this : Symbol(C, Decl(throwInEnclosingStatements.ts, 27, 26)) } } var aa = { ->aa : Symbol(aa, Decl(throwInEnclosingStatements.ts, 39, 3)) +>aa : Symbol(aa, Decl(throwInEnclosingStatements.ts, 40, 3)) id:12, ->id : Symbol(id, Decl(throwInEnclosingStatements.ts, 39, 10)) +>id : Symbol(id, Decl(throwInEnclosingStatements.ts, 40, 10)) biz() { ->biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 40, 10)) +>biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 41, 10)) throw this; } diff --git a/tests/baselines/reference/throwInEnclosingStatements.types b/tests/baselines/reference/throwInEnclosingStatements.types index bcff8653d52..568fd800e35 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.types +++ b/tests/baselines/reference/throwInEnclosingStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts === + function fn(x) { >fn : (x: any) => void >x : any diff --git a/tests/baselines/reference/throwStatements.js b/tests/baselines/reference/throwStatements.js index 83663d08cc4..556ebc55e37 100644 --- a/tests/baselines/reference/throwStatements.js +++ b/tests/baselines/reference/throwStatements.js @@ -1,4 +1,5 @@ //// [throwStatements.ts] + // all legal interface I { diff --git a/tests/baselines/reference/throwStatements.symbols b/tests/baselines/reference/throwStatements.symbols index 508bdcb9f3f..adf9cb461cf 100644 --- a/tests/baselines/reference/throwStatements.symbols +++ b/tests/baselines/reference/throwStatements.symbols @@ -1,184 +1,185 @@ === tests/cases/conformance/statements/throwStatements/throwStatements.ts === + // all legal interface I { >I : Symbol(I, Decl(throwStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(throwStatements.ts, 2, 13)) +>id : Symbol(id, Decl(throwStatements.ts, 3, 13)) } class C implements I { ->C : Symbol(C, Decl(throwStatements.ts, 4, 1)) +>C : Symbol(C, Decl(throwStatements.ts, 5, 1)) >I : Symbol(I, Decl(throwStatements.ts, 0, 0)) id: number; ->id : Symbol(id, Decl(throwStatements.ts, 6, 22)) +>id : Symbol(id, Decl(throwStatements.ts, 7, 22)) } class D{ ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) ->T : Symbol(T, Decl(throwStatements.ts, 10, 8)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) +>T : Symbol(T, Decl(throwStatements.ts, 11, 8)) source: T; ->source : Symbol(source, Decl(throwStatements.ts, 10, 11)) ->T : Symbol(T, Decl(throwStatements.ts, 10, 8)) +>source : Symbol(source, Decl(throwStatements.ts, 11, 11)) +>T : Symbol(T, Decl(throwStatements.ts, 11, 8)) recurse: D; ->recurse : Symbol(recurse, Decl(throwStatements.ts, 11, 14)) ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) ->T : Symbol(T, Decl(throwStatements.ts, 10, 8)) +>recurse : Symbol(recurse, Decl(throwStatements.ts, 12, 14)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) +>T : Symbol(T, Decl(throwStatements.ts, 11, 8)) wrapped: D> ->wrapped : Symbol(wrapped, Decl(throwStatements.ts, 12, 18)) ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) ->T : Symbol(T, Decl(throwStatements.ts, 10, 8)) +>wrapped : Symbol(wrapped, Decl(throwStatements.ts, 13, 18)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) +>T : Symbol(T, Decl(throwStatements.ts, 11, 8)) } function F(x: string): number { return 42; } ->F : Symbol(F, Decl(throwStatements.ts, 14, 1)) ->x : Symbol(x, Decl(throwStatements.ts, 16, 11)) +>F : Symbol(F, Decl(throwStatements.ts, 15, 1)) +>x : Symbol(x, Decl(throwStatements.ts, 17, 11)) module M { ->M : Symbol(M, Decl(throwStatements.ts, 16, 44)) +>M : Symbol(M, Decl(throwStatements.ts, 17, 44)) export class A { ->A : Symbol(A, Decl(throwStatements.ts, 18, 10)) +>A : Symbol(A, Decl(throwStatements.ts, 19, 10)) name: string; ->name : Symbol(name, Decl(throwStatements.ts, 19, 20)) +>name : Symbol(name, Decl(throwStatements.ts, 20, 20)) } export function F2(x: number): string { return x.toString(); } ->F2 : Symbol(F2, Decl(throwStatements.ts, 21, 5)) ->x : Symbol(x, Decl(throwStatements.ts, 23, 23)) +>F2 : Symbol(F2, Decl(throwStatements.ts, 22, 5)) +>x : Symbol(x, Decl(throwStatements.ts, 24, 23)) >x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(throwStatements.ts, 23, 23)) +>x : Symbol(x, Decl(throwStatements.ts, 24, 23)) >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) } var aNumber = 9.9; ->aNumber : Symbol(aNumber, Decl(throwStatements.ts, 26, 3)) +>aNumber : Symbol(aNumber, Decl(throwStatements.ts, 27, 3)) throw aNumber; ->aNumber : Symbol(aNumber, Decl(throwStatements.ts, 26, 3)) +>aNumber : Symbol(aNumber, Decl(throwStatements.ts, 27, 3)) var aString = 'this is a string'; ->aString : Symbol(aString, Decl(throwStatements.ts, 28, 3)) +>aString : Symbol(aString, Decl(throwStatements.ts, 29, 3)) throw aString; ->aString : Symbol(aString, Decl(throwStatements.ts, 28, 3)) +>aString : Symbol(aString, Decl(throwStatements.ts, 29, 3)) var aDate = new Date(12); ->aDate : Symbol(aDate, Decl(throwStatements.ts, 30, 3)) +>aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw aDate; ->aDate : Symbol(aDate, Decl(throwStatements.ts, 30, 3)) +>aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) var anObject = new Object(); ->anObject : Symbol(anObject, Decl(throwStatements.ts, 32, 3)) +>anObject : Symbol(anObject, Decl(throwStatements.ts, 33, 3)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw anObject; ->anObject : Symbol(anObject, Decl(throwStatements.ts, 32, 3)) +>anObject : Symbol(anObject, Decl(throwStatements.ts, 33, 3)) var anAny = null; ->anAny : Symbol(anAny, Decl(throwStatements.ts, 35, 3)) +>anAny : Symbol(anAny, Decl(throwStatements.ts, 36, 3)) throw anAny; ->anAny : Symbol(anAny, Decl(throwStatements.ts, 35, 3)) +>anAny : Symbol(anAny, Decl(throwStatements.ts, 36, 3)) var anOtherAny = new C(); ->anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 37, 3)) ->C : Symbol(C, Decl(throwStatements.ts, 4, 1)) +>anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 38, 3)) +>C : Symbol(C, Decl(throwStatements.ts, 5, 1)) throw anOtherAny; ->anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 37, 3)) +>anOtherAny : Symbol(anOtherAny, Decl(throwStatements.ts, 38, 3)) var anUndefined = undefined; ->anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 39, 3)) +>anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 40, 3)) >undefined : Symbol(undefined) throw anUndefined; ->anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 39, 3)) +>anUndefined : Symbol(anUndefined, Decl(throwStatements.ts, 40, 3)) var aClass = new C(); ->aClass : Symbol(aClass, Decl(throwStatements.ts, 42, 3)) ->C : Symbol(C, Decl(throwStatements.ts, 4, 1)) +>aClass : Symbol(aClass, Decl(throwStatements.ts, 43, 3)) +>C : Symbol(C, Decl(throwStatements.ts, 5, 1)) throw aClass; ->aClass : Symbol(aClass, Decl(throwStatements.ts, 42, 3)) +>aClass : Symbol(aClass, Decl(throwStatements.ts, 43, 3)) var aGenericClass = new D(); ->aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 44, 3)) ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) +>aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 45, 3)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) throw aGenericClass; ->aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 44, 3)) +>aGenericClass : Symbol(aGenericClass, Decl(throwStatements.ts, 45, 3)) var anObjectLiteral = { id: 12 }; ->anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 46, 3)) ->id : Symbol(id, Decl(throwStatements.ts, 46, 23)) +>anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 47, 3)) +>id : Symbol(id, Decl(throwStatements.ts, 47, 23)) throw anObjectLiteral; ->anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 46, 3)) +>anObjectLiteral : Symbol(anObjectLiteral, Decl(throwStatements.ts, 47, 3)) var aFunction = F; ->aFunction : Symbol(aFunction, Decl(throwStatements.ts, 49, 3)) ->F : Symbol(F, Decl(throwStatements.ts, 14, 1)) +>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3)) +>F : Symbol(F, Decl(throwStatements.ts, 15, 1)) throw aFunction; ->aFunction : Symbol(aFunction, Decl(throwStatements.ts, 49, 3)) +>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3)) throw aFunction(''); ->aFunction : Symbol(aFunction, Decl(throwStatements.ts, 49, 3)) +>aFunction : Symbol(aFunction, Decl(throwStatements.ts, 50, 3)) var aLambda = (x) => 2; ->aLambda : Symbol(aLambda, Decl(throwStatements.ts, 52, 3)) ->x : Symbol(x, Decl(throwStatements.ts, 52, 15)) +>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3)) +>x : Symbol(x, Decl(throwStatements.ts, 53, 15)) throw aLambda; ->aLambda : Symbol(aLambda, Decl(throwStatements.ts, 52, 3)) +>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3)) throw aLambda(1); ->aLambda : Symbol(aLambda, Decl(throwStatements.ts, 52, 3)) +>aLambda : Symbol(aLambda, Decl(throwStatements.ts, 53, 3)) var aModule = M; ->aModule : Symbol(aModule, Decl(throwStatements.ts, 56, 3)) ->M : Symbol(M, Decl(throwStatements.ts, 16, 44)) +>aModule : Symbol(aModule, Decl(throwStatements.ts, 57, 3)) +>M : Symbol(M, Decl(throwStatements.ts, 17, 44)) throw aModule; ->aModule : Symbol(aModule, Decl(throwStatements.ts, 56, 3)) +>aModule : Symbol(aModule, Decl(throwStatements.ts, 57, 3)) throw typeof M; ->M : Symbol(M, Decl(throwStatements.ts, 16, 44)) +>M : Symbol(M, Decl(throwStatements.ts, 17, 44)) var aClassInModule = new M.A(); ->aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 59, 3)) ->M.A : Symbol(M.A, Decl(throwStatements.ts, 18, 10)) ->M : Symbol(M, Decl(throwStatements.ts, 16, 44)) ->A : Symbol(M.A, Decl(throwStatements.ts, 18, 10)) +>aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 60, 3)) +>M.A : Symbol(M.A, Decl(throwStatements.ts, 19, 10)) +>M : Symbol(M, Decl(throwStatements.ts, 17, 44)) +>A : Symbol(M.A, Decl(throwStatements.ts, 19, 10)) throw aClassInModule; ->aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 59, 3)) +>aClassInModule : Symbol(aClassInModule, Decl(throwStatements.ts, 60, 3)) var aFunctionInModule = M.F2; ->aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 61, 3)) ->M.F2 : Symbol(M.F2, Decl(throwStatements.ts, 21, 5)) ->M : Symbol(M, Decl(throwStatements.ts, 16, 44)) ->F2 : Symbol(M.F2, Decl(throwStatements.ts, 21, 5)) +>aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 62, 3)) +>M.F2 : Symbol(M.F2, Decl(throwStatements.ts, 22, 5)) +>M : Symbol(M, Decl(throwStatements.ts, 17, 44)) +>F2 : Symbol(M.F2, Decl(throwStatements.ts, 22, 5)) throw aFunctionInModule; ->aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 61, 3)) +>aFunctionInModule : Symbol(aFunctionInModule, Decl(throwStatements.ts, 62, 3)) // no initializer or annotation, so this is an 'any' var x; ->x : Symbol(x, Decl(throwStatements.ts, 65, 3)) +>x : Symbol(x, Decl(throwStatements.ts, 66, 3)) throw x; ->x : Symbol(x, Decl(throwStatements.ts, 65, 3)) +>x : Symbol(x, Decl(throwStatements.ts, 66, 3)) // literals throw 0.0; @@ -190,13 +191,13 @@ throw undefined; throw 'a string'; throw function () { return 'a string' }; throw (x:T) => 42; ->T : Symbol(T, Decl(throwStatements.ts, 75, 7)) ->x : Symbol(x, Decl(throwStatements.ts, 75, 10)) ->T : Symbol(T, Decl(throwStatements.ts, 75, 7)) +>T : Symbol(T, Decl(throwStatements.ts, 76, 7)) +>x : Symbol(x, Decl(throwStatements.ts, 76, 10)) +>T : Symbol(T, Decl(throwStatements.ts, 76, 7)) throw { x: 12, y: 13 }; ->x : Symbol(x, Decl(throwStatements.ts, 76, 7)) ->y : Symbol(y, Decl(throwStatements.ts, 76, 14)) +>x : Symbol(x, Decl(throwStatements.ts, 77, 7)) +>y : Symbol(y, Decl(throwStatements.ts, 77, 14)) throw []; throw ['a', ['b']]; @@ -205,11 +206,11 @@ throw new Date(); >Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw new C(); ->C : Symbol(C, Decl(throwStatements.ts, 4, 1)) +>C : Symbol(C, Decl(throwStatements.ts, 5, 1)) throw new Object(); >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw new D(); ->D : Symbol(D, Decl(throwStatements.ts, 8, 1)) +>D : Symbol(D, Decl(throwStatements.ts, 9, 1)) diff --git a/tests/baselines/reference/throwStatements.types b/tests/baselines/reference/throwStatements.types index 3d365a1b65a..5023513ee53 100644 --- a/tests/baselines/reference/throwStatements.types +++ b/tests/baselines/reference/throwStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/throwStatements/throwStatements.ts === + // all legal interface I { diff --git a/tests/baselines/reference/throwWithoutNewLine2.errors.txt b/tests/baselines/reference/throwWithoutNewLine2.errors.txt index 6930d240e7b..83f4e4cc246 100644 --- a/tests/baselines/reference/throwWithoutNewLine2.errors.txt +++ b/tests/baselines/reference/throwWithoutNewLine2.errors.txt @@ -1,11 +1,14 @@ tests/cases/compiler/throwWithoutNewLine2.ts(1,6): error TS1142: Line break not permitted here. tests/cases/compiler/throwWithoutNewLine2.ts(2,1): error TS2304: Cannot find name 'a'. +tests/cases/compiler/throwWithoutNewLine2.ts(2,1): error TS7027: Unreachable code detected. -==== tests/cases/compiler/throwWithoutNewLine2.ts (2 errors) ==== +==== tests/cases/compiler/throwWithoutNewLine2.ts (3 errors) ==== throw !!! error TS1142: Line break not permitted here. a; ~ -!!! error TS2304: Cannot find name 'a'. \ No newline at end of file +!!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS7027: Unreachable code detected. \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index a1427dc2526..92d9d21f0cc 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -9,6 +9,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(38,51) Property 'propA' is missing in type 'B'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(42,56): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(46,56): error TS2322: Type 'T[]' is not assignable to type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(50,1): error TS7027: Unreachable code detected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(60,7): error TS2339: Property 'propB' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(65,7): error TS2339: Property 'propB' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(70,7): error TS2339: Property 'propB' does not exist on type 'A'. @@ -39,7 +40,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(133,34 tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern. -==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (32 errors) ==== +==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (33 errors) ==== class A { propA: number; @@ -111,6 +112,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 } let a: A; + ~~~ +!!! error TS7027: Unreachable code detected. let b: B; declare function isB(p1): p1 is B; diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt index 6112b61ceb6..0139c96b3f9 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(46,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(47,32): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(48,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(68,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(69,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(70,1): error TS7028: Unused label. -==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (6 errors) ==== // typeof operator on any type var ANY: any; @@ -78,8 +81,14 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator var x: any[]; var r: () => any; z: typeof ANY; + ~ +!!! error TS7028: Unused label. x: typeof ANY2; + ~ +!!! error TS7028: Unused label. r: typeof foo; + ~ +!!! error TS7028: Unused label. z: typeof objA.a; z: typeof A.foo; z: typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index c0538b78b14..b9db33b11a4 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -1,4 +1,5 @@ //// [typeofOperatorWithBooleanType.ts] + // typeof operator on boolean type var BOOLEAN: boolean; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.symbols b/tests/baselines/reference/typeofOperatorWithBooleanType.symbols index 39276e61625..0167a14ae03 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.symbols +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.symbols @@ -1,130 +1,131 @@ === tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts === + // typeof operator on boolean type var BOOLEAN: boolean; ->BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3)) +>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3)) function foo(): boolean { return true; } ->foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21)) +>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21)) class A { ->A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40)) +>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40)) public a: boolean; ->a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) +>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) static foo() { return false; } ->foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22)) +>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) } module M { ->M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1)) +>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1)) export var n: boolean; ->n : Symbol(n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) +>n : Symbol(n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) } var objA = new A(); ->objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3)) ->A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40)) +>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3)) +>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40)) // boolean type var var ResultIsString1 = typeof BOOLEAN; ->ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithBooleanType.ts, 16, 3)) ->BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3)) +>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithBooleanType.ts, 17, 3)) +>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3)) // boolean type literal var ResultIsString2 = typeof true; ->ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithBooleanType.ts, 19, 3)) +>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithBooleanType.ts, 20, 3)) var ResultIsString3 = typeof { x: true, y: false }; ->ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithBooleanType.ts, 20, 3)) ->x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 20, 30)) ->y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 20, 39)) +>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithBooleanType.ts, 21, 3)) +>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 21, 30)) +>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 21, 39)) // boolean type expressions var ResultIsString4 = typeof objA.a; ->ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithBooleanType.ts, 23, 3)) ->objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) +>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithBooleanType.ts, 24, 3)) +>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) +>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3)) +>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) var ResultIsString5 = typeof M.n; ->ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithBooleanType.ts, 24, 3)) ->M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) ->M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) +>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithBooleanType.ts, 25, 3)) +>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) +>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1)) +>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) var ResultIsString6 = typeof foo(); ->ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithBooleanType.ts, 25, 3)) ->foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21)) +>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithBooleanType.ts, 26, 3)) +>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21)) var ResultIsString7 = typeof A.foo(); ->ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithBooleanType.ts, 26, 3)) ->A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22)) ->A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40)) ->foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22)) +>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithBooleanType.ts, 27, 3)) +>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) +>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40)) +>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) // multiple typeof operator var ResultIsString8 = typeof typeof BOOLEAN; ->ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithBooleanType.ts, 29, 3)) ->BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3)) +>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithBooleanType.ts, 30, 3)) +>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3)) // miss assignment operators typeof true; typeof BOOLEAN; ->BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3)) +>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3)) typeof foo(); ->foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21)) +>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21)) typeof true, false; typeof objA.a; ->objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) +>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) +>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3)) +>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) typeof M.n; ->M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) ->M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) +>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) +>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1)) +>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) // use typeof in type query var z: boolean; ->z : Symbol(z, Decl(typeofOperatorWithBooleanType.ts, 40, 3)) +>z : Symbol(z, Decl(typeofOperatorWithBooleanType.ts, 41, 3)) var x: boolean[]; ->x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 41, 3)) +>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 42, 3)) var r: () => boolean; ->r : Symbol(r, Decl(typeofOperatorWithBooleanType.ts, 42, 3)) +>r : Symbol(r, Decl(typeofOperatorWithBooleanType.ts, 43, 3)) z: typeof BOOLEAN; ->BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3)) +>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 2, 3)) r: typeof foo; ->foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21)) +>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 2, 21)) var y = { a: true, b: false}; ->y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 45, 3)) ->a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9)) ->b : Symbol(b, Decl(typeofOperatorWithBooleanType.ts, 45, 18)) +>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3)) +>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9)) +>b : Symbol(b, Decl(typeofOperatorWithBooleanType.ts, 46, 18)) z: typeof y.a; ->y.a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9)) ->y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 45, 3)) ->a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9)) +>y.a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9)) +>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 46, 3)) +>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 46, 9)) z: typeof objA.a; ->objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9)) +>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) +>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 14, 3)) +>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 6, 9)) z: typeof A.foo; ->A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22)) ->A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40)) ->foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22)) +>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) +>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 4, 40)) +>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 7, 22)) z: typeof M.n; ->M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) ->M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14)) +>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) +>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 9, 1)) +>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 11, 14)) diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.types b/tests/baselines/reference/typeofOperatorWithBooleanType.types index 06cd7466a18..043307cfb00 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.types +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.types @@ -1,4 +1,5 @@ === tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts === + // typeof operator on boolean type var BOOLEAN: boolean; >BOOLEAN : boolean diff --git a/tests/baselines/reference/typeofOperatorWithEnumType.js b/tests/baselines/reference/typeofOperatorWithEnumType.js index 2e2963b0955..2ce32668186 100644 --- a/tests/baselines/reference/typeofOperatorWithEnumType.js +++ b/tests/baselines/reference/typeofOperatorWithEnumType.js @@ -1,4 +1,5 @@ //// [typeofOperatorWithEnumType.ts] + // typeof operator on enum type enum ENUM { }; diff --git a/tests/baselines/reference/typeofOperatorWithEnumType.symbols b/tests/baselines/reference/typeofOperatorWithEnumType.symbols index 3ae150ece03..a8e3d6d351f 100644 --- a/tests/baselines/reference/typeofOperatorWithEnumType.symbols +++ b/tests/baselines/reference/typeofOperatorWithEnumType.symbols @@ -1,69 +1,70 @@ === tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts === + // typeof operator on enum type enum ENUM { }; >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) enum ENUM1 { A, B, "" }; ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) ->A : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 3, 12)) ->B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 3, 15)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) +>A : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 4, 12)) +>B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15)) // enum type var var ResultIsString1 = typeof ENUM; ->ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithEnumType.ts, 6, 3)) +>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithEnumType.ts, 7, 3)) >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) var ResultIsString2 = typeof ENUM1; ->ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithEnumType.ts, 7, 3)) ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) +>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithEnumType.ts, 8, 3)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) // enum type expressions var ResultIsString3 = typeof ENUM1["A"]; ->ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithEnumType.ts, 10, 3)) ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) ->"A" : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 3, 12)) +>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithEnumType.ts, 11, 3)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) +>"A" : Symbol(ENUM1.A, Decl(typeofOperatorWithEnumType.ts, 4, 12)) var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]); ->ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithEnumType.ts, 11, 3)) +>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithEnumType.ts, 12, 3)) >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) ->"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 3, 15)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) +>"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15)) // multiple typeof operators var ResultIsString5 = typeof typeof ENUM; ->ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithEnumType.ts, 14, 3)) +>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithEnumType.ts, 15, 3)) >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) var ResultIsString6 = typeof typeof typeof (ENUM[0] + ENUM1.B); ->ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithEnumType.ts, 15, 3)) +>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithEnumType.ts, 16, 3)) >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) ->ENUM1.B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 3, 15)) ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) ->B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 3, 15)) +>ENUM1.B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) +>B : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15)) // miss assignment operators typeof ENUM; >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) typeof ENUM1; ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) typeof ENUM1["B"]; ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) ->"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 3, 15)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) +>"B" : Symbol(ENUM1.B, Decl(typeofOperatorWithEnumType.ts, 4, 15)) typeof ENUM, ENUM1; >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) // use typeof in type query enum z { }; ->z : Symbol(z, Decl(typeofOperatorWithEnumType.ts, 21, 19)) +>z : Symbol(z, Decl(typeofOperatorWithEnumType.ts, 22, 19)) z: typeof ENUM; >ENUM : Symbol(ENUM, Decl(typeofOperatorWithEnumType.ts, 0, 0)) z: typeof ENUM1; ->ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 2, 14)) +>ENUM1 : Symbol(ENUM1, Decl(typeofOperatorWithEnumType.ts, 3, 14)) diff --git a/tests/baselines/reference/typeofOperatorWithEnumType.types b/tests/baselines/reference/typeofOperatorWithEnumType.types index 82bf699a22f..f9224811393 100644 --- a/tests/baselines/reference/typeofOperatorWithEnumType.types +++ b/tests/baselines/reference/typeofOperatorWithEnumType.types @@ -1,4 +1,5 @@ === tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts === + // typeof operator on enum type enum ENUM { }; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.errors.txt b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt new file mode 100644 index 00000000000..37b2cafab37 --- /dev/null +++ b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt @@ -0,0 +1,69 @@ +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(50,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(51,1): error TS7028: Unused label. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts(52,1): error TS7028: Unused label. + + +==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts (3 errors) ==== + // typeof operator on string type + var STRING: string; + var STRING1: string[] = ["", "abc"]; + + function foo(): string { return "abc"; } + + class A { + public a: string; + static foo() { return ""; } + } + module M { + export var n: string; + } + + var objA = new A(); + + // string type var + var ResultIsString1 = typeof STRING; + var ResultIsString2 = typeof STRING1; + + // string type literal + var ResultIsString3 = typeof ""; + var ResultIsString4 = typeof { x: "", y: "" }; + var ResultIsString5 = typeof { x: "", y: (s: string) => { return s; } }; + + // string type expressions + var ResultIsString6 = typeof objA.a; + var ResultIsString7 = typeof M.n; + var ResultIsString8 = typeof STRING1[0]; + var ResultIsString9 = typeof foo(); + var ResultIsString10 = typeof A.foo(); + var ResultIsString11 = typeof (STRING + STRING); + var ResultIsString12 = typeof STRING.charAt(0); + + // multiple typeof operators + var ResultIsString13 = typeof typeof STRING; + var ResultIsString14 = typeof typeof typeof (STRING + STRING); + + // miss assignment operators + typeof ""; + typeof STRING; + typeof STRING1; + typeof foo(); + typeof objA.a, M.n; + + // use typeof in type query + var z: string; + var x: string[]; + var r: () => string; + z: typeof STRING; + ~ +!!! error TS7028: Unused label. + x: typeof STRING1; + ~ +!!! error TS7028: Unused label. + r: typeof foo; + ~ +!!! error TS7028: Unused label. + var y = { a: "", b: "" }; + z: typeof y.a; + z: typeof objA.a; + z: typeof A.foo; + z: typeof M.n; \ No newline at end of file diff --git a/tests/baselines/reference/typeofOperatorWithStringType.symbols b/tests/baselines/reference/typeofOperatorWithStringType.symbols deleted file mode 100644 index 090e0958e60..00000000000 --- a/tests/baselines/reference/typeofOperatorWithStringType.symbols +++ /dev/null @@ -1,167 +0,0 @@ -=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts === -// typeof operator on string type -var STRING: string; ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -var STRING1: string[] = ["", "abc"]; ->STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3)) - -function foo(): string { return "abc"; } ->foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36)) - -class A { ->A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40)) - - public a: string; ->a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 6, 9)) - - static foo() { return ""; } ->foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21)) -} -module M { ->M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1)) - - export var n: string; ->n : Symbol(n, Decl(typeofOperatorWithStringType.ts, 11, 14)) -} - -var objA = new A(); ->objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3)) ->A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40)) - -// string type var -var ResultIsString1 = typeof STRING; ->ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithStringType.ts, 17, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -var ResultIsString2 = typeof STRING1; ->ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithStringType.ts, 18, 3)) ->STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3)) - -// string type literal -var ResultIsString3 = typeof ""; ->ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithStringType.ts, 21, 3)) - -var ResultIsString4 = typeof { x: "", y: "" }; ->ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithStringType.ts, 22, 3)) ->x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 22, 30)) ->y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 22, 37)) - -var ResultIsString5 = typeof { x: "", y: (s: string) => { return s; } }; ->ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithStringType.ts, 23, 3)) ->x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 23, 30)) ->y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 23, 37)) ->s : Symbol(s, Decl(typeofOperatorWithStringType.ts, 23, 42)) ->s : Symbol(s, Decl(typeofOperatorWithStringType.ts, 23, 42)) - -// string type expressions -var ResultIsString6 = typeof objA.a; ->ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithStringType.ts, 26, 3)) ->objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) - -var ResultIsString7 = typeof M.n; ->ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithStringType.ts, 27, 3)) ->M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) ->M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) - -var ResultIsString8 = typeof STRING1[0]; ->ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithStringType.ts, 28, 3)) ->STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3)) - -var ResultIsString9 = typeof foo(); ->ResultIsString9 : Symbol(ResultIsString9, Decl(typeofOperatorWithStringType.ts, 29, 3)) ->foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36)) - -var ResultIsString10 = typeof A.foo(); ->ResultIsString10 : Symbol(ResultIsString10, Decl(typeofOperatorWithStringType.ts, 30, 3)) ->A.foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21)) ->A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40)) ->foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21)) - -var ResultIsString11 = typeof (STRING + STRING); ->ResultIsString11 : Symbol(ResultIsString11, Decl(typeofOperatorWithStringType.ts, 31, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -var ResultIsString12 = typeof STRING.charAt(0); ->ResultIsString12 : Symbol(ResultIsString12, Decl(typeofOperatorWithStringType.ts, 32, 3)) ->STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) ->charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --)) - -// multiple typeof operators -var ResultIsString13 = typeof typeof STRING; ->ResultIsString13 : Symbol(ResultIsString13, Decl(typeofOperatorWithStringType.ts, 35, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -var ResultIsString14 = typeof typeof typeof (STRING + STRING); ->ResultIsString14 : Symbol(ResultIsString14, Decl(typeofOperatorWithStringType.ts, 36, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -// miss assignment operators -typeof ""; -typeof STRING; ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -typeof STRING1; ->STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3)) - -typeof foo(); ->foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36)) - -typeof objA.a, M.n; ->objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) ->M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) ->M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) - -// use typeof in type query -var z: string; ->z : Symbol(z, Decl(typeofOperatorWithStringType.ts, 46, 3)) - -var x: string[]; ->x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 47, 3)) - -var r: () => string; ->r : Symbol(r, Decl(typeofOperatorWithStringType.ts, 48, 3)) - -z: typeof STRING; ->STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3)) - -x: typeof STRING1; ->STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3)) - -r: typeof foo; ->foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36)) - -var y = { a: "", b: "" }; ->y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 52, 3)) ->a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9)) ->b : Symbol(b, Decl(typeofOperatorWithStringType.ts, 52, 16)) - -z: typeof y.a; ->y.a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9)) ->y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 52, 3)) ->a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9)) - -z: typeof objA.a; ->objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) ->objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3)) ->a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9)) - -z: typeof A.foo; ->A.foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21)) ->A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40)) ->foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21)) - -z: typeof M.n; ->M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) ->M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1)) ->n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14)) - diff --git a/tests/baselines/reference/typeofOperatorWithStringType.types b/tests/baselines/reference/typeofOperatorWithStringType.types deleted file mode 100644 index 3ae657a9951..00000000000 --- a/tests/baselines/reference/typeofOperatorWithStringType.types +++ /dev/null @@ -1,233 +0,0 @@ -=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts === -// typeof operator on string type -var STRING: string; ->STRING : string - -var STRING1: string[] = ["", "abc"]; ->STRING1 : string[] ->["", "abc"] : string[] ->"" : string ->"abc" : string - -function foo(): string { return "abc"; } ->foo : () => string ->"abc" : string - -class A { ->A : A - - public a: string; ->a : string - - static foo() { return ""; } ->foo : () => string ->"" : string -} -module M { ->M : typeof M - - export var n: string; ->n : string -} - -var objA = new A(); ->objA : A ->new A() : A ->A : typeof A - -// string type var -var ResultIsString1 = typeof STRING; ->ResultIsString1 : string ->typeof STRING : string ->STRING : string - -var ResultIsString2 = typeof STRING1; ->ResultIsString2 : string ->typeof STRING1 : string ->STRING1 : string[] - -// string type literal -var ResultIsString3 = typeof ""; ->ResultIsString3 : string ->typeof "" : string ->"" : string - -var ResultIsString4 = typeof { x: "", y: "" }; ->ResultIsString4 : string ->typeof { x: "", y: "" } : string ->{ x: "", y: "" } : { x: string; y: string; } ->x : string ->"" : string ->y : string ->"" : string - -var ResultIsString5 = typeof { x: "", y: (s: string) => { return s; } }; ->ResultIsString5 : string ->typeof { x: "", y: (s: string) => { return s; } } : string ->{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } ->x : string ->"" : string ->y : (s: string) => string ->(s: string) => { return s; } : (s: string) => string ->s : string ->s : string - -// string type expressions -var ResultIsString6 = typeof objA.a; ->ResultIsString6 : string ->typeof objA.a : string ->objA.a : string ->objA : A ->a : string - -var ResultIsString7 = typeof M.n; ->ResultIsString7 : string ->typeof M.n : string ->M.n : string ->M : typeof M ->n : string - -var ResultIsString8 = typeof STRING1[0]; ->ResultIsString8 : string ->typeof STRING1[0] : string ->STRING1[0] : string ->STRING1 : string[] ->0 : number - -var ResultIsString9 = typeof foo(); ->ResultIsString9 : string ->typeof foo() : string ->foo() : string ->foo : () => string - -var ResultIsString10 = typeof A.foo(); ->ResultIsString10 : string ->typeof A.foo() : string ->A.foo() : string ->A.foo : () => string ->A : typeof A ->foo : () => string - -var ResultIsString11 = typeof (STRING + STRING); ->ResultIsString11 : string ->typeof (STRING + STRING) : string ->(STRING + STRING) : string ->STRING + STRING : string ->STRING : string ->STRING : string - -var ResultIsString12 = typeof STRING.charAt(0); ->ResultIsString12 : string ->typeof STRING.charAt(0) : string ->STRING.charAt(0) : string ->STRING.charAt : (pos: number) => string ->STRING : string ->charAt : (pos: number) => string ->0 : number - -// multiple typeof operators -var ResultIsString13 = typeof typeof STRING; ->ResultIsString13 : string ->typeof typeof STRING : string ->typeof STRING : string ->STRING : string - -var ResultIsString14 = typeof typeof typeof (STRING + STRING); ->ResultIsString14 : string ->typeof typeof typeof (STRING + STRING) : string ->typeof typeof (STRING + STRING) : string ->typeof (STRING + STRING) : string ->(STRING + STRING) : string ->STRING + STRING : string ->STRING : string ->STRING : string - -// miss assignment operators -typeof ""; ->typeof "" : string ->"" : string - -typeof STRING; ->typeof STRING : string ->STRING : string - -typeof STRING1; ->typeof STRING1 : string ->STRING1 : string[] - -typeof foo(); ->typeof foo() : string ->foo() : string ->foo : () => string - -typeof objA.a, M.n; ->typeof objA.a, M.n : string ->typeof objA.a : string ->objA.a : string ->objA : A ->a : string ->M.n : string ->M : typeof M ->n : string - -// use typeof in type query -var z: string; ->z : string - -var x: string[]; ->x : string[] - -var r: () => string; ->r : () => string - -z: typeof STRING; ->z : any ->typeof STRING : string ->STRING : string - -x: typeof STRING1; ->x : any ->typeof STRING1 : string ->STRING1 : string[] - -r: typeof foo; ->r : any ->typeof foo : string ->foo : () => string - -var y = { a: "", b: "" }; ->y : { a: string; b: string; } ->{ a: "", b: "" } : { a: string; b: string; } ->a : string ->"" : string ->b : string ->"" : string - -z: typeof y.a; ->z : any ->typeof y.a : string ->y.a : string ->y : { a: string; b: string; } ->a : string - -z: typeof objA.a; ->z : any ->typeof objA.a : string ->objA.a : string ->objA : A ->a : string - -z: typeof A.foo; ->z : any ->typeof A.foo : string ->A.foo : () => string ->A : typeof A ->foo : () => string - -z: typeof M.n; ->z : any ->typeof M.n : string ->M.n : string ->M : typeof M ->n : string - diff --git a/tests/baselines/reference/undeclaredVarEmit.errors.txt b/tests/baselines/reference/undeclaredVarEmit.errors.txt index af6298b61d2..a95323aa362 100644 --- a/tests/baselines/reference/undeclaredVarEmit.errors.txt +++ b/tests/baselines/reference/undeclaredVarEmit.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/undeclaredVarEmit.ts(1,1): error TS7028: Unused label. tests/cases/compiler/undeclaredVarEmit.ts(1,4): error TS2304: Cannot find name 'number'. -==== tests/cases/compiler/undeclaredVarEmit.ts (1 errors) ==== +==== tests/cases/compiler/undeclaredVarEmit.ts (2 errors) ==== f: number; + ~ +!!! error TS7028: Unused label. ~~~~~~ !!! error TS2304: Cannot find name 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/validMultipleVariableDeclarations.errors.txt new file mode 100644 index 00000000000..8f751e9efee --- /dev/null +++ b/tests/baselines/reference/validMultipleVariableDeclarations.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts(9,1): error TS7027: Unreachable code detected. + + +==== tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts (1 errors) ==== + // all expected to be valid + + var x: number; + var x = 2; + if (true) { + var x = 3; + for (var x = 0; ;) { } + } + var x = undefined; + ~~~ +!!! error TS7027: Unreachable code detected. + + // new declaration space, making redeclaring x as a string valid + function declSpace() { + var x = 'this is a string'; + } + + interface Point { x: number; y: number; } + + var p: Point; + var p = { x: 1, y: 2 }; + var p: Point = { x: 0, y: undefined }; + var p = { x: 1, y: undefined }; + var p: { x: number; y: number; } = { x: 1, y: 2 }; + var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; + var p: typeof p; + + var fn = function (s: string) { return 42; } + var fn = (s: string) => 3; + var fn: (s: string) => number; + var fn: { (s: string): number }; + var fn = <(s: string) => number> null; + var fn: typeof fn; + + var a: string[]; + var a = ['a', 'b'] + var a = []; + var a: string[] = []; + var a = new Array(); + var a: typeof a; + \ No newline at end of file diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.symbols b/tests/baselines/reference/validMultipleVariableDeclarations.symbols deleted file mode 100644 index 1c3a1feb75c..00000000000 --- a/tests/baselines/reference/validMultipleVariableDeclarations.symbols +++ /dev/null @@ -1,118 +0,0 @@ -=== tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts === -// all expected to be valid - -var x: number; ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 2, 3), Decl(validMultipleVariableDeclarations.ts, 3, 3), Decl(validMultipleVariableDeclarations.ts, 5, 7), Decl(validMultipleVariableDeclarations.ts, 6, 12), Decl(validMultipleVariableDeclarations.ts, 8, 3)) - -var x = 2; ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 2, 3), Decl(validMultipleVariableDeclarations.ts, 3, 3), Decl(validMultipleVariableDeclarations.ts, 5, 7), Decl(validMultipleVariableDeclarations.ts, 6, 12), Decl(validMultipleVariableDeclarations.ts, 8, 3)) - -if (true) { - var x = 3; ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 2, 3), Decl(validMultipleVariableDeclarations.ts, 3, 3), Decl(validMultipleVariableDeclarations.ts, 5, 7), Decl(validMultipleVariableDeclarations.ts, 6, 12), Decl(validMultipleVariableDeclarations.ts, 8, 3)) - - for (var x = 0; ;) { } ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 2, 3), Decl(validMultipleVariableDeclarations.ts, 3, 3), Decl(validMultipleVariableDeclarations.ts, 5, 7), Decl(validMultipleVariableDeclarations.ts, 6, 12), Decl(validMultipleVariableDeclarations.ts, 8, 3)) -} -var x = undefined; ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 2, 3), Decl(validMultipleVariableDeclarations.ts, 3, 3), Decl(validMultipleVariableDeclarations.ts, 5, 7), Decl(validMultipleVariableDeclarations.ts, 6, 12), Decl(validMultipleVariableDeclarations.ts, 8, 3)) ->undefined : Symbol(undefined) - -// new declaration space, making redeclaring x as a string valid -function declSpace() { ->declSpace : Symbol(declSpace, Decl(validMultipleVariableDeclarations.ts, 8, 26)) - - var x = 'this is a string'; ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 12, 7)) -} - -interface Point { x: number; y: number; } ->Point : Symbol(Point, Decl(validMultipleVariableDeclarations.ts, 13, 1)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 15, 17)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 15, 28)) - -var p: Point; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->Point : Symbol(Point, Decl(validMultipleVariableDeclarations.ts, 13, 1)) - -var p = { x: 1, y: 2 }; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 18, 9)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 18, 15)) - -var p: Point = { x: 0, y: undefined }; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->Point : Symbol(Point, Decl(validMultipleVariableDeclarations.ts, 13, 1)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 19, 16)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 19, 22)) ->undefined : Symbol(undefined) - -var p = { x: 1, y: undefined }; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 20, 9)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 20, 15)) ->undefined : Symbol(undefined) - -var p: { x: number; y: number; } = { x: 1, y: 2 }; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 21, 8)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 21, 19)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 21, 36)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 21, 42)) - -var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 22, 10)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 22, 21)) ->x : Symbol(x, Decl(validMultipleVariableDeclarations.ts, 22, 36)) ->y : Symbol(y, Decl(validMultipleVariableDeclarations.ts, 22, 42)) ->undefined : Symbol(undefined) - -var p: typeof p; ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) ->p : Symbol(p, Decl(validMultipleVariableDeclarations.ts, 17, 3), Decl(validMultipleVariableDeclarations.ts, 18, 3), Decl(validMultipleVariableDeclarations.ts, 19, 3), Decl(validMultipleVariableDeclarations.ts, 20, 3), Decl(validMultipleVariableDeclarations.ts, 21, 3), Decl(validMultipleVariableDeclarations.ts, 22, 3), Decl(validMultipleVariableDeclarations.ts, 23, 3)) - -var fn = function (s: string) { return 42; } ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->s : Symbol(s, Decl(validMultipleVariableDeclarations.ts, 25, 19)) - -var fn = (s: string) => 3; ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->s : Symbol(s, Decl(validMultipleVariableDeclarations.ts, 26, 10)) - -var fn: (s: string) => number; ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->s : Symbol(s, Decl(validMultipleVariableDeclarations.ts, 27, 9)) - -var fn: { (s: string): number }; ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->s : Symbol(s, Decl(validMultipleVariableDeclarations.ts, 28, 11)) - -var fn = <(s: string) => number> null; ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->s : Symbol(s, Decl(validMultipleVariableDeclarations.ts, 29, 11)) - -var fn: typeof fn; ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) ->fn : Symbol(fn, Decl(validMultipleVariableDeclarations.ts, 25, 3), Decl(validMultipleVariableDeclarations.ts, 26, 3), Decl(validMultipleVariableDeclarations.ts, 27, 3), Decl(validMultipleVariableDeclarations.ts, 28, 3), Decl(validMultipleVariableDeclarations.ts, 29, 3), Decl(validMultipleVariableDeclarations.ts, 30, 3)) - -var a: string[]; ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) - -var a = ['a', 'b'] ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) - -var a = []; ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) - -var a: string[] = []; ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) - -var a = new Array(); ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -var a: typeof a; ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) ->a : Symbol(a, Decl(validMultipleVariableDeclarations.ts, 32, 3), Decl(validMultipleVariableDeclarations.ts, 33, 3), Decl(validMultipleVariableDeclarations.ts, 34, 3), Decl(validMultipleVariableDeclarations.ts, 35, 3), Decl(validMultipleVariableDeclarations.ts, 36, 3), Decl(validMultipleVariableDeclarations.ts, 37, 3)) - diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.types b/tests/baselines/reference/validMultipleVariableDeclarations.types deleted file mode 100644 index 966128350b0..00000000000 --- a/tests/baselines/reference/validMultipleVariableDeclarations.types +++ /dev/null @@ -1,152 +0,0 @@ -=== tests/cases/conformance/statements/VariableStatements/validMultipleVariableDeclarations.ts === -// all expected to be valid - -var x: number; ->x : number - -var x = 2; ->x : number ->2 : number - -if (true) { ->true : boolean - - var x = 3; ->x : number ->3 : number - - for (var x = 0; ;) { } ->x : number ->0 : number -} -var x = undefined; ->x : number ->undefined : number ->undefined : undefined - -// new declaration space, making redeclaring x as a string valid -function declSpace() { ->declSpace : () => void - - var x = 'this is a string'; ->x : string ->'this is a string' : string -} - -interface Point { x: number; y: number; } ->Point : Point ->x : number ->y : number - -var p: Point; ->p : Point ->Point : Point - -var p = { x: 1, y: 2 }; ->p : Point ->{ x: 1, y: 2 } : { x: number; y: number; } ->x : number ->1 : number ->y : number ->2 : number - -var p: Point = { x: 0, y: undefined }; ->p : Point ->Point : Point ->{ x: 0, y: undefined } : { x: number; y: undefined; } ->x : number ->0 : number ->y : undefined ->undefined : undefined - -var p = { x: 1, y: undefined }; ->p : Point ->{ x: 1, y: undefined } : { x: number; y: number; } ->x : number ->1 : number ->y : number ->undefined : number ->undefined : undefined - -var p: { x: number; y: number; } = { x: 1, y: 2 }; ->p : Point ->x : number ->y : number ->{ x: 1, y: 2 } : { x: number; y: number; } ->x : number ->1 : number ->y : number ->2 : number - -var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ->p : Point -><{ x: number; y: number; }>{ x: 0, y: undefined } : { x: number; y: number; } ->x : number ->y : number ->{ x: 0, y: undefined } : { x: number; y: undefined; } ->x : number ->0 : number ->y : undefined ->undefined : undefined - -var p: typeof p; ->p : Point ->p : Point - -var fn = function (s: string) { return 42; } ->fn : (s: string) => number ->function (s: string) { return 42; } : (s: string) => number ->s : string ->42 : number - -var fn = (s: string) => 3; ->fn : (s: string) => number ->(s: string) => 3 : (s: string) => number ->s : string ->3 : number - -var fn: (s: string) => number; ->fn : (s: string) => number ->s : string - -var fn: { (s: string): number }; ->fn : (s: string) => number ->s : string - -var fn = <(s: string) => number> null; ->fn : (s: string) => number -><(s: string) => number> null : (s: string) => number ->s : string ->null : null - -var fn: typeof fn; ->fn : (s: string) => number ->fn : (s: string) => number - -var a: string[]; ->a : string[] - -var a = ['a', 'b'] ->a : string[] ->['a', 'b'] : string[] ->'a' : string ->'b' : string - -var a = []; ->a : string[] ->[] : string[] ->[] : undefined[] - -var a: string[] = []; ->a : string[] ->[] : undefined[] - -var a = new Array(); ->a : string[] ->new Array() : string[] ->Array : ArrayConstructor - -var a: typeof a; ->a : string[] ->a : string[] - diff --git a/tests/baselines/reference/whileBreakStatements.js b/tests/baselines/reference/whileBreakStatements.js index 818be39a242..15dffe3e582 100644 --- a/tests/baselines/reference/whileBreakStatements.js +++ b/tests/baselines/reference/whileBreakStatements.js @@ -1,4 +1,5 @@ //// [whileBreakStatements.ts] + while(true) { break; } diff --git a/tests/baselines/reference/whileBreakStatements.symbols b/tests/baselines/reference/whileBreakStatements.symbols index 2ac7721621d..022fe9a12a8 100644 --- a/tests/baselines/reference/whileBreakStatements.symbols +++ b/tests/baselines/reference/whileBreakStatements.symbols @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts === + while(true) { break; } @@ -38,7 +39,7 @@ while (true) EIGHT: while (true) { var fn = function () { } ->fn : Symbol(fn, Decl(whileBreakStatements.ts, 38, 7)) +>fn : Symbol(fn, Decl(whileBreakStatements.ts, 39, 7)) break EIGHT; } diff --git a/tests/baselines/reference/whileBreakStatements.types b/tests/baselines/reference/whileBreakStatements.types index e7ca0a5322f..a31d1e9b40e 100644 --- a/tests/baselines/reference/whileBreakStatements.types +++ b/tests/baselines/reference/whileBreakStatements.types @@ -1,4 +1,5 @@ === tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts === + while(true) { >true : boolean diff --git a/tests/baselines/reference/whileContinueStatements.errors.txt b/tests/baselines/reference/whileContinueStatements.errors.txt new file mode 100644 index 00000000000..c2009b02600 --- /dev/null +++ b/tests/baselines/reference/whileContinueStatements.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts(5,1): error TS7027: Unreachable code detected. + + +==== tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts (1 errors) ==== + while(true) { + continue; + } + + while (true) { + ~~~~~ +!!! error TS7027: Unreachable code detected. + if (true) { + continue; + } + } + + ONE: + + while (true) { + continue ONE; + } + + TWO: + THREE: + while (true) { + continue THREE; + } + + FOUR: + while (true) { + FIVE: + while (true) { + continue FOUR; + } + } + + while (true) { + SIX: + while (true) + continue SIX; + } + + SEVEN: + while (true) + while (true) + while (true) + continue SEVEN; + + EIGHT: + while (true) { + var fn = function () { } + continue EIGHT; + } + + NINE: + while (true) { + if (true) { continue NINE; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/whileContinueStatements.symbols b/tests/baselines/reference/whileContinueStatements.symbols deleted file mode 100644 index 67508556f70..00000000000 --- a/tests/baselines/reference/whileContinueStatements.symbols +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts === -while(true) { - continue; -} - -while (true) { - if (true) { - continue; - } -} - -ONE: - -while (true) { - continue ONE; -} - -TWO: -THREE: -while (true) { - continue THREE; -} - -FOUR: -while (true) { - FIVE: - while (true) { - continue FOUR; - } -} - -while (true) { - SIX: - while (true) - continue SIX; -} - -SEVEN: -while (true) - while (true) - while (true) - continue SEVEN; - -EIGHT: -while (true) { - var fn = function () { } ->fn : Symbol(fn, Decl(whileContinueStatements.ts, 44, 7)) - - continue EIGHT; -} - -NINE: -while (true) { - if (true) { continue NINE; } -} - diff --git a/tests/baselines/reference/whileContinueStatements.types b/tests/baselines/reference/whileContinueStatements.types deleted file mode 100644 index 6bf371cde9e..00000000000 --- a/tests/baselines/reference/whileContinueStatements.types +++ /dev/null @@ -1,110 +0,0 @@ -=== tests/cases/conformance/statements/continueStatements/whileContinueStatements.ts === -while(true) { ->true : boolean - - continue; -} - -while (true) { ->true : boolean - - if (true) { ->true : boolean - - continue; - } -} - -ONE: ->ONE : any - -while (true) { ->true : boolean - - continue ONE; ->ONE : any -} - -TWO: ->TWO : any - -THREE: ->THREE : any - -while (true) { ->true : boolean - - continue THREE; ->THREE : any -} - -FOUR: ->FOUR : any - -while (true) { ->true : boolean - - FIVE: ->FIVE : any - - while (true) { ->true : boolean - - continue FOUR; ->FOUR : any - } -} - -while (true) { ->true : boolean - - SIX: ->SIX : any - - while (true) ->true : boolean - - continue SIX; ->SIX : any -} - -SEVEN: ->SEVEN : any - -while (true) ->true : boolean - - while (true) ->true : boolean - - while (true) ->true : boolean - - continue SEVEN; ->SEVEN : any - -EIGHT: ->EIGHT : any - -while (true) { ->true : boolean - - var fn = function () { } ->fn : () => void ->function () { } : () => void - - continue EIGHT; ->EIGHT : any -} - -NINE: ->NINE : any - -while (true) { ->true : boolean - - if (true) { continue NINE; } ->true : boolean ->NINE : any -} - diff --git a/tests/cases/compiler/bestCommonTypeReturnStatement.ts b/tests/cases/compiler/bestCommonTypeReturnStatement.ts index aff173664f6..cb481147f9b 100644 --- a/tests/cases/compiler/bestCommonTypeReturnStatement.ts +++ b/tests/cases/compiler/bestCommonTypeReturnStatement.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + interface IPromise { then(successCallback: (promiseValue: T) => any, errorCallback?: (reason: any) => any): IPromise; } diff --git a/tests/cases/compiler/breakTarget3.ts b/tests/cases/compiler/breakTarget3.ts index 9cef599692c..64a9357706f 100644 --- a/tests/cases/compiler/breakTarget3.ts +++ b/tests/cases/compiler/breakTarget3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/compiler/breakTarget4.ts b/tests/cases/compiler/breakTarget4.ts index 2c3eadca7db..3e00bca659b 100644 --- a/tests/cases/compiler/breakTarget4.ts +++ b/tests/cases/compiler/breakTarget4.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/compiler/breakTarget5.ts b/tests/cases/compiler/breakTarget5.ts index a05ee1cf879..f0bceb5015f 100644 --- a/tests/cases/compiler/breakTarget5.ts +++ b/tests/cases/compiler/breakTarget5.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: while (true) { function f() { diff --git a/tests/cases/compiler/capturedLetConstInLoop9.ts b/tests/cases/compiler/capturedLetConstInLoop9.ts index 8163a75c20b..4b67349690d 100644 --- a/tests/cases/compiler/capturedLetConstInLoop9.ts +++ b/tests/cases/compiler/capturedLetConstInLoop9.ts @@ -74,9 +74,8 @@ function foo() { break l0; } - return 100; - () => b + return 100; } diff --git a/tests/cases/compiler/capturedLetConstInLoop9_ES6.ts b/tests/cases/compiler/capturedLetConstInLoop9_ES6.ts index e11cf6d344a..25c696ff7e6 100644 --- a/tests/cases/compiler/capturedLetConstInLoop9_ES6.ts +++ b/tests/cases/compiler/capturedLetConstInLoop9_ES6.ts @@ -75,10 +75,8 @@ function foo() { if (b === 2) { break l0; } - - return 100; - () => b + return 100; } diff --git a/tests/cases/compiler/commentEmitAtEndOfFile1.ts b/tests/cases/compiler/commentEmitAtEndOfFile1.ts index b1b863890d5..5713ef006e5 100644 --- a/tests/cases/compiler/commentEmitAtEndOfFile1.ts +++ b/tests/cases/compiler/commentEmitAtEndOfFile1.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + // test var f = '' // test #2 diff --git a/tests/cases/compiler/commentsAtEndOfFile1.ts b/tests/cases/compiler/commentsAtEndOfFile1.ts index 8e37b2361a5..04c90b3433a 100644 --- a/tests/cases/compiler/commentsAtEndOfFile1.ts +++ b/tests/cases/compiler/commentsAtEndOfFile1.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + Input: ; //Testing two diff --git a/tests/cases/compiler/conditionalExpressions2.ts b/tests/cases/compiler/conditionalExpressions2.ts index 6f2f097f6de..ece002d7778 100644 --- a/tests/cases/compiler/conditionalExpressions2.ts +++ b/tests/cases/compiler/conditionalExpressions2.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + var a = false ? 1 : null; var b = false ? undefined : 0; var c = false ? 1 : 0; diff --git a/tests/cases/compiler/constDeclarations-invalidContexts.ts b/tests/cases/compiler/constDeclarations-invalidContexts.ts index b5093180990..6d21ee31ec2 100644 --- a/tests/cases/compiler/constDeclarations-invalidContexts.ts +++ b/tests/cases/compiler/constDeclarations-invalidContexts.ts @@ -1,3 +1,4 @@ +// @allowUnreachableCode: true // @target: ES6 // Errors, const must be defined inside a block diff --git a/tests/cases/compiler/constDeclarations-validContexts.ts b/tests/cases/compiler/constDeclarations-validContexts.ts index ffde8e45d6f..63af6d16959 100644 --- a/tests/cases/compiler/constDeclarations-validContexts.ts +++ b/tests/cases/compiler/constDeclarations-validContexts.ts @@ -1,3 +1,4 @@ +// @allowUnreachableCode: true // @target: ES6 diff --git a/tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts b/tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts index a93628e5494..63e0fc30141 100644 --- a/tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts +++ b/tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + declare module "fs" { export class File { constructor(filename: string); diff --git a/tests/cases/compiler/continueNotInIterationStatement4.ts b/tests/cases/compiler/continueNotInIterationStatement4.ts index 5996eb4323a..218cb151df3 100644 --- a/tests/cases/compiler/continueNotInIterationStatement4.ts +++ b/tests/cases/compiler/continueNotInIterationStatement4.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + TWO: while (true){ var x = () => { diff --git a/tests/cases/compiler/continueTarget3.ts b/tests/cases/compiler/continueTarget3.ts index 26bea241a7a..a7b47ff071b 100644 --- a/tests/cases/compiler/continueTarget3.ts +++ b/tests/cases/compiler/continueTarget3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/compiler/continueTarget4.ts b/tests/cases/compiler/continueTarget4.ts index e00c222aa9c..5ba2bd69b11 100644 --- a/tests/cases/compiler/continueTarget4.ts +++ b/tests/cases/compiler/continueTarget4.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/compiler/continueTarget5.ts b/tests/cases/compiler/continueTarget5.ts index dd3a806ab2d..5f3d068282b 100644 --- a/tests/cases/compiler/continueTarget5.ts +++ b/tests/cases/compiler/continueTarget5.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: while (true) { function f() { diff --git a/tests/cases/compiler/declarationEmitDetachedComment1.ts b/tests/cases/compiler/declarationEmitDetachedComment1.ts new file mode 100644 index 00000000000..8d49482f3cc --- /dev/null +++ b/tests/cases/compiler/declarationEmitDetachedComment1.ts @@ -0,0 +1,34 @@ +// @target: es5 +// @module: commonjs +// @declaration: true +// @removeComments: false + +// @filename: test1.ts +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { + +} + +// @filename: test2.ts +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { + +} + +// @filename: test3.ts +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { + +} diff --git a/tests/cases/compiler/declarationEmitDetachedComment2.ts b/tests/cases/compiler/declarationEmitDetachedComment2.ts new file mode 100644 index 00000000000..1eed803c625 --- /dev/null +++ b/tests/cases/compiler/declarationEmitDetachedComment2.ts @@ -0,0 +1,34 @@ +// @target: es5 +// @module: commonjs +// @declaration: true +// @removeComments: true + +// @filename: test1.ts +/*! Copyright 2015 MyCompany Inc. */ + +/** + * Hello class + */ +class Hello { + +} + +// @filename: test2.ts +/* A comment at the top of the file. */ + +/** + * Hi class + */ +class Hi { + +} + +// @filename: test3.ts +// A one-line comment at the top of the file. + +/** + * Hola class + */ +class Hola { + +} diff --git a/tests/cases/compiler/downlevelLetConst16.ts b/tests/cases/compiler/downlevelLetConst16.ts index 30a27ba61f4..b30f26b4b82 100644 --- a/tests/cases/compiler/downlevelLetConst16.ts +++ b/tests/cases/compiler/downlevelLetConst16.ts @@ -1,4 +1,6 @@ // @target:es5 +// @allowUnreachableCode: true + 'use strict' declare function use(a: any); diff --git a/tests/cases/compiler/downlevelLetConst17.ts b/tests/cases/compiler/downlevelLetConst17.ts index b581281f679..7cea2031ac5 100644 --- a/tests/cases/compiler/downlevelLetConst17.ts +++ b/tests/cases/compiler/downlevelLetConst17.ts @@ -1,4 +1,5 @@ // @target:es5 +// @allowUnreachableCode: true 'use strict' declare function use(a: any); diff --git a/tests/cases/compiler/downlevelLetConst18.ts b/tests/cases/compiler/downlevelLetConst18.ts index 59f2ee7a46e..61cb2f46cc9 100644 --- a/tests/cases/compiler/downlevelLetConst18.ts +++ b/tests/cases/compiler/downlevelLetConst18.ts @@ -1,4 +1,6 @@ // @target:es5 +// @allowUnreachableCode: true + 'use strict' for (let x; ;) { @@ -6,7 +8,7 @@ for (let x; ;) { } for (let x; ;) { - function foo() { x }; + function foo1() { x }; } for (let x; ;) { diff --git a/tests/cases/compiler/duplicateLabel1.ts b/tests/cases/compiler/duplicateLabel1.ts index c588e7b8183..ff248c64548 100644 --- a/tests/cases/compiler/duplicateLabel1.ts +++ b/tests/cases/compiler/duplicateLabel1.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: target: while (true) { diff --git a/tests/cases/compiler/duplicateLabel2.ts b/tests/cases/compiler/duplicateLabel2.ts index bdb0396a246..5ebf273c118 100644 --- a/tests/cases/compiler/duplicateLabel2.ts +++ b/tests/cases/compiler/duplicateLabel2.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: while (true) { target: diff --git a/tests/cases/compiler/duplicateLabel3.ts b/tests/cases/compiler/duplicateLabel3.ts index d4db9399ed2..d6add980447 100644 --- a/tests/cases/compiler/duplicateLabel3.ts +++ b/tests/cases/compiler/duplicateLabel3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: while (true) { function f() { diff --git a/tests/cases/compiler/duplicateLabel4.ts b/tests/cases/compiler/duplicateLabel4.ts index 2c62180a2ab..bf7ea5c22c6 100644 --- a/tests/cases/compiler/duplicateLabel4.ts +++ b/tests/cases/compiler/duplicateLabel4.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + target: while (true) { } diff --git a/tests/cases/compiler/duplicateLocalVariable1.ts b/tests/cases/compiler/duplicateLocalVariable1.ts index fc20a19c2d9..f6288cfc6ae 100644 --- a/tests/cases/compiler/duplicateLocalVariable1.ts +++ b/tests/cases/compiler/duplicateLocalVariable1.ts @@ -1,4 +1,6 @@ -//@module: commonjs + +// @allowUnreachableCode: true +/ /@module: commonjs //import FileManager = require('filemanager'); //import App = require('app'); diff --git a/tests/cases/compiler/duplicateVariablesByScope.ts b/tests/cases/compiler/duplicateVariablesByScope.ts index 481c1bb950e..dc811130d4f 100644 --- a/tests/cases/compiler/duplicateVariablesByScope.ts +++ b/tests/cases/compiler/duplicateVariablesByScope.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // duplicate local variables are only reported at global scope module M { diff --git a/tests/cases/compiler/es6ClassSuperCodegenBug.ts b/tests/cases/compiler/es6ClassSuperCodegenBug.ts index 7ab8344c815..2e3f306d5d6 100644 --- a/tests/cases/compiler/es6ClassSuperCodegenBug.ts +++ b/tests/cases/compiler/es6ClassSuperCodegenBug.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + class A { constructor(str1:string, str2:string) {} } diff --git a/tests/cases/compiler/escapedIdentifiers.ts b/tests/cases/compiler/escapedIdentifiers.ts index 795aeca2481..c58c59d9b42 100644 --- a/tests/cases/compiler/escapedIdentifiers.ts +++ b/tests/cases/compiler/escapedIdentifiers.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + /* 0 .. \u0030 9 .. \u0039 diff --git a/tests/cases/compiler/for.ts b/tests/cases/compiler/for.ts index e27dab7dbd2..636c7e4a5fc 100644 --- a/tests/cases/compiler/for.ts +++ b/tests/cases/compiler/for.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + for (var i = 0; i < 10; i++) { // ok var x1 = i; } diff --git a/tests/cases/compiler/functionOverloads12.ts b/tests/cases/compiler/functionOverloads12.ts index 3e8a9882d08..48a8af06cc5 100644 --- a/tests/cases/compiler/functionOverloads12.ts +++ b/tests/cases/compiler/functionOverloads12.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function foo():string; function foo():number; function foo():any { if (true) return ""; else return 0;} diff --git a/tests/cases/compiler/functionReturn.ts b/tests/cases/compiler/functionReturn.ts index 8ea0cb8f5a1..897480c64d6 100644 --- a/tests/cases/compiler/functionReturn.ts +++ b/tests/cases/compiler/functionReturn.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function f0(): void { } function f1() { var n: any = f0(); diff --git a/tests/cases/compiler/functionWithNoBestCommonType1.ts b/tests/cases/compiler/functionWithNoBestCommonType1.ts index 11628812925..2d7a1191770 100644 --- a/tests/cases/compiler/functionWithNoBestCommonType1.ts +++ b/tests/cases/compiler/functionWithNoBestCommonType1.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function foo() { return true; return bar(); diff --git a/tests/cases/compiler/functionWithNoBestCommonType2.ts b/tests/cases/compiler/functionWithNoBestCommonType2.ts index 974ccdfe035..6bc3878d834 100644 --- a/tests/cases/compiler/functionWithNoBestCommonType2.ts +++ b/tests/cases/compiler/functionWithNoBestCommonType2.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + var v = function () { return true; return bar(); diff --git a/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts b/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts index 81259fd7c0c..fde615af41d 100644 --- a/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts +++ b/tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // @target: es5 function f1(): string { diff --git a/tests/cases/compiler/ifElseWithStatements1.ts b/tests/cases/compiler/ifElseWithStatements1.ts index a7f337068cb..5ed7f7dd7a3 100644 --- a/tests/cases/compiler/ifElseWithStatements1.ts +++ b/tests/cases/compiler/ifElseWithStatements1.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + if (true) f(); else diff --git a/tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts b/tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts index d150fb1930a..6465e7f1200 100644 --- a/tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts +++ b/tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function foo() { if (true) { return 42; diff --git a/tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts b/tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts index 2620e7d88d4..e325ae4582a 100644 --- a/tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts +++ b/tests/cases/compiler/inheritanceStaticPropertyOverridingAccessor.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + class a { static get x(): () => string { return null;; diff --git a/tests/cases/compiler/letAndVarRedeclaration.ts b/tests/cases/compiler/letAndVarRedeclaration.ts index 1f901ded520..aaf2ce1a68c 100644 --- a/tests/cases/compiler/letAndVarRedeclaration.ts +++ b/tests/cases/compiler/letAndVarRedeclaration.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // @target: es6 let e0 diff --git a/tests/cases/compiler/letDeclarations-invalidContexts.ts b/tests/cases/compiler/letDeclarations-invalidContexts.ts index 4d165ba2cda..cde6c2006bb 100644 --- a/tests/cases/compiler/letDeclarations-invalidContexts.ts +++ b/tests/cases/compiler/letDeclarations-invalidContexts.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // @target: ES6 // Errors, let must be defined inside a block diff --git a/tests/cases/compiler/letDeclarations-scopes.ts b/tests/cases/compiler/letDeclarations-scopes.ts index 93f4ce5b4ed..b050a5e9bd0 100644 --- a/tests/cases/compiler/letDeclarations-scopes.ts +++ b/tests/cases/compiler/letDeclarations-scopes.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // @target: ES6 // global diff --git a/tests/cases/compiler/letDeclarations-validContexts.ts b/tests/cases/compiler/letDeclarations-validContexts.ts index baedfa2644c..2a4022901c1 100644 --- a/tests/cases/compiler/letDeclarations-validContexts.ts +++ b/tests/cases/compiler/letDeclarations-validContexts.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // @target: ES6 diff --git a/tests/cases/compiler/null.ts b/tests/cases/compiler/null.ts index eb88d387bcc..e8fa9a5d687 100644 --- a/tests/cases/compiler/null.ts +++ b/tests/cases/compiler/null.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + var x=null; var y=3+x; var z=3+null; diff --git a/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts b/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts index 21884031aec..12b99fb29ce 100644 --- a/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts +++ b/tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts @@ -1 +1,3 @@ +// @allowUnreachableCode: true + var f: (x: 'hi') => number = ('hi') => { return 1; }; \ No newline at end of file diff --git a/tests/cases/compiler/reachabilityChecks1.ts b/tests/cases/compiler/reachabilityChecks1.ts new file mode 100644 index 00000000000..6430556a203 --- /dev/null +++ b/tests/cases/compiler/reachabilityChecks1.ts @@ -0,0 +1,76 @@ +// @allowUnreachableCode: false +// @preserveConstEnums: true + +while (true); +var x = 1; + +module A { + while (true); + let x; +} + +module A1 { + do {} while(true); + module A { + interface F {} + } +} + +module A2 { + while (true); + module A { + var x = 1; + } +} + +module A3 { + while (true); + type T = string; +} + +module A4 { + while (true); + module A { + const enum E { X } + } +} + +function f1(x) { + if (x) { + return; + } + else { + throw new Error("123"); + } + var x; +} + +function f2() { + return; + class A { + } +} + +module B { + for (; ;); + module C { + } +} + +function f3() { + do { + } while (true); + enum E { + X = 1 + } +} + +function f4() { + if (true) { + throw new Error(); + } + const enum E { + X = 1 + } +} + diff --git a/tests/cases/compiler/reachabilityChecks2.ts b/tests/cases/compiler/reachabilityChecks2.ts new file mode 100644 index 00000000000..5a7a8aaab58 --- /dev/null +++ b/tests/cases/compiler/reachabilityChecks2.ts @@ -0,0 +1,13 @@ +// @allowUnreachableCode: false +// @preserveConstEnums: false + +while (true) { } +const enum E { X } + +module A4 { + while (true); + module A { + const enum E { X } + } +} + diff --git a/tests/cases/compiler/reachabilityChecks3.ts b/tests/cases/compiler/reachabilityChecks3.ts new file mode 100644 index 00000000000..19f57e55b67 --- /dev/null +++ b/tests/cases/compiler/reachabilityChecks3.ts @@ -0,0 +1,16 @@ +// @allowUnusedLabels: false + +let x = 1; +loop: while (true) { + if (x == 100) { + break; + } + else { + x++; + } +} +{ + x: 100 +} + +var y = () => { f: 1 } \ No newline at end of file diff --git a/tests/cases/compiler/reachabilityChecks4.ts b/tests/cases/compiler/reachabilityChecks4.ts new file mode 100644 index 00000000000..f07395ac38e --- /dev/null +++ b/tests/cases/compiler/reachabilityChecks4.ts @@ -0,0 +1,15 @@ +// @noFallthroughCasesInSwitch: true + +function foo(x, y) { + switch (x) { + case 1: + case 2: + return 1; + case 3: + if (y) { + return 2; + } + case 4: + return 3; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/reachabilityChecks5.ts b/tests/cases/compiler/reachabilityChecks5.ts new file mode 100644 index 00000000000..97df11ccb79 --- /dev/null +++ b/tests/cases/compiler/reachabilityChecks5.ts @@ -0,0 +1,131 @@ +// @allowUnreachableCode: false +// @noImplicitReturns: true + +function f0(x): number { + while (true); +} + +function f1(x): number { + if (x) { + return 1 + } +} + +function f2(x): number { + while (x) { + throw new Error(); + } + return 1; +} + +function f3(x): number { + while (x) { + throw new Error(); + } +} + +function f3_1 (x): number { + while (x) { + } + throw new Error(); +} + +function f4(x): number { + try { + if (x) { + return 1; + } + } + catch (e) { + } +} + +function f5(x): number { + try { + if (x) { + return 1; + } + } + catch (e) { + return 2; + } +} + +function f6(x): number { + try { + if (x) { + return 1; + } + else + { + throw new Error(); + } + } + catch (e) { + } +} + +function f7(x): number { + try { + if (x) { + return 1; + } + else { + throw new Error(); + } + } + catch (e) { + return 1; + } +} + +function f8(x): number { + try { + if (true) { + x++; + } + else { + return 1; + } + } + catch (e) { + return 1; + } +} + +function f9(x): number { + try { + while (false) { + return 1; + } + } + catch (e) { + return 1; + } +} + +function f10(x): number { + try { + do { + x++; + } while (true); + } + catch (e) { + return 1; + } +} + +function f11(x): number { + test: + try { + do { + do { + break test; + } while (true); + x++; + } while (true); + } + catch (e) { + return 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/recursiveMods.ts b/tests/cases/compiler/recursiveMods.ts index fa07646ba72..84dbafff558 100644 --- a/tests/cases/compiler/recursiveMods.ts +++ b/tests/cases/compiler/recursiveMods.ts @@ -1,4 +1,6 @@ -//@module: commonjs +// @allowUnreachableCode: true +// @module: commonjs + export module Foo { export class C {} } diff --git a/tests/cases/compiler/returnStatement1.ts b/tests/cases/compiler/returnStatement1.ts index e87635b37d7..06d1bdb9569 100644 --- a/tests/cases/compiler/returnStatement1.ts +++ b/tests/cases/compiler/returnStatement1.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function f() { return function (s) { var x = s; diff --git a/tests/cases/compiler/sourceMapValidationLabeled.ts b/tests/cases/compiler/sourceMapValidationLabeled.ts index 5993e82aacc..e36bdd9a0b3 100644 --- a/tests/cases/compiler/sourceMapValidationLabeled.ts +++ b/tests/cases/compiler/sourceMapValidationLabeled.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true // @sourcemap: true + x: var b = 10; \ No newline at end of file diff --git a/tests/cases/compiler/systemModule8.ts b/tests/cases/compiler/systemModule8.ts index c3e0c7c7437..4490b2a8529 100644 --- a/tests/cases/compiler/systemModule8.ts +++ b/tests/cases/compiler/systemModule8.ts @@ -1,3 +1,4 @@ +// @allowUnreachableCode: true // @module: system export var x; diff --git a/tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts b/tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts index b36f423be21..62311ee75c9 100644 --- a/tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts +++ b/tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + // expected error for all the LHS of compound assignments (arithmetic and addition) var value; diff --git a/tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts b/tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts index cd0fb64e0d2..d6bfd84fd9a 100644 --- a/tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts +++ b/tests/cases/conformance/expressions/contextualTyping/generatedContextualTyping.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + class Base { private p; } class Derived1 extends Base { private m; } class Derived2 extends Base { private n; } diff --git a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts index 00460181c2b..c22ed94087b 100644 --- a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts +++ b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + // typeof operator on boolean type var BOOLEAN: boolean; diff --git a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts index 9abb602db06..57b22e3646c 100644 --- a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts +++ b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithEnumType.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + // typeof operator on enum type enum ENUM { }; diff --git a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithNumberType.ts b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithNumberType.ts index 06ac3e29784..81687e4f860 100644 --- a/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithNumberType.ts +++ b/tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithNumberType.ts @@ -1,3 +1,4 @@ +// @allowUnusedLabels: true // typeof operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; diff --git a/tests/cases/conformance/functions/functionImplementationErrors.ts b/tests/cases/conformance/functions/functionImplementationErrors.ts index ddd3ba0a2c1..0a7c7812932 100644 --- a/tests/cases/conformance/functions/functionImplementationErrors.ts +++ b/tests/cases/conformance/functions/functionImplementationErrors.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { return ''; diff --git a/tests/cases/conformance/functions/functionImplementations.ts b/tests/cases/conformance/functions/functionImplementations.ts index df36a0b4457..3c5adefd2e4 100644 --- a/tests/cases/conformance/functions/functionImplementations.ts +++ b/tests/cases/conformance/functions/functionImplementations.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // FunctionExpression with no return type annotation and no return statement returns void var v: void = function () { } (); diff --git a/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts index 31407b88590..d35002e2f65 100644 --- a/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts +++ b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + class Foo { x: string; y() { } diff --git a/tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts b/tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts index cad137cc88d..62c0153f224 100644 --- a/tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts +++ b/tests/cases/conformance/parser/ecmascript5/Fuzz/parser768531.ts @@ -1,2 +1,4 @@ +// @allowUnusedLabels: true + {a: 3} /x/ \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts index 9cef599692c..64a9357706f 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts index 2c3eadca7db..3e00bca659b 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget4.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts index 26bea241a7a..a7b47ff071b 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts index e00c222aa9c..5ba2bd69b11 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget4.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target1: target2: while (true) { diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts index d4db9399ed2..d6add980447 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel3.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + target: while (true) { function f() { diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts index 2c62180a2ab..bf7ea5c22c6 100644 --- a/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts +++ b/tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel4.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + target: while (true) { } diff --git a/tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts b/tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts index 88476ac4a78..b35204beb48 100644 --- a/tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts +++ b/tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + /// 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 diff --git a/tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts index 49bfaaca13f..cca94947a5d 100644 --- a/tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/doWhileBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + do { break; } while(true) diff --git a/tests/cases/conformance/statements/breakStatements/forBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/forBreakStatements.ts index 20a93db4418..9cf07e1eef7 100644 --- a/tests/cases/conformance/statements/breakStatements/forBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/forBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + for (; ;) { break; } diff --git a/tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts index 5810d522182..ffc99ee904b 100644 --- a/tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/forInBreakStatements.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + for(var x in {}) { break; } diff --git a/tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts index 7c93553a726..d164691db68 100644 --- a/tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked break not allowed diff --git a/tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts index cc21818b80f..142a8f8b3b5 100644 --- a/tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked break not allowed diff --git a/tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts index 9cda003e6f5..db49a13c8f7 100644 --- a/tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked break not allowed diff --git a/tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts index f5ce6ffa52f..3080a6b38a8 100644 --- a/tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/switchBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + switch ('') { case 'a': break; diff --git a/tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts b/tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts index c471e6552b9..e2a836b62a3 100644 --- a/tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts +++ b/tests/cases/conformance/statements/breakStatements/whileBreakStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + while(true) { break; } diff --git a/tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts index d3d999ccb49..4685cc9f046 100644 --- a/tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/doWhileContinueStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + do { continue; } while(true) diff --git a/tests/cases/conformance/statements/continueStatements/forContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/forContinueStatements.ts index 1f8a3fc7b68..9b852df80c7 100644 --- a/tests/cases/conformance/statements/continueStatements/forContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/forContinueStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + for (; ;) { continue; } diff --git a/tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts index 863caec2ccf..b5ccd8189ca 100644 --- a/tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/forInContinueStatements.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + for(var x in {}) { continue; } diff --git a/tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts index 54192212ef7..dcf543ed7e3 100644 --- a/tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked continue not allowed diff --git a/tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts index 751cd9477ad..ba367ef87b7 100644 --- a/tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked continue not allowed diff --git a/tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts index be274005961..861d7e90629 100644 --- a/tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked continue not allowed diff --git a/tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts b/tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts index cf913671315..ef94466ffba 100644 --- a/tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts +++ b/tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts @@ -1,3 +1,6 @@ +// @allowUnusedLabels: true +// @allowUnreachableCode: true + // All errors // naked continue not allowed diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts b/tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts new file mode 100644 index 00000000000..9f646e2c851 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts @@ -0,0 +1,12 @@ +//@target: ES5 + +var array = [1,2,3]; +var sum = 0; + +for (let num of array) { + if (sum === 0) { + array = [4,5,6] + } + + sum += num; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/forStatements/forStatements.ts b/tests/cases/conformance/statements/forStatements/forStatements.ts index 567c49c1098..1e65bdc2932 100644 --- a/tests/cases/conformance/statements/forStatements/forStatements.ts +++ b/tests/cases/conformance/statements/forStatements/forStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + interface I { id: number; } diff --git a/tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts b/tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts index 0c2bb3d40dc..64317b23336 100644 --- a/tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts +++ b/tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + interface I { id: number; } diff --git a/tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts b/tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts index 9f5557e7756..af19fd404df 100644 --- a/tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts +++ b/tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // all expected to be valid for (var x: number; ;) { } diff --git a/tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts b/tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts index f2cd9aa43ee..03f042401d8 100644 --- a/tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts +++ b/tests/cases/conformance/statements/ifDoWhileStatements/ifDoWhileStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + interface I { id: number; } diff --git a/tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts b/tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts index aa382d4ec34..8cc294d01f7 100644 --- a/tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts +++ b/tests/cases/conformance/statements/throwStatements/invalidThrowStatement.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + throw; export throw null; diff --git a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts index 4b9675f9d63..c5875327b50 100644 --- a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts +++ b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function fn(x) { throw x; } diff --git a/tests/cases/conformance/statements/throwStatements/throwStatements.ts b/tests/cases/conformance/statements/throwStatements/throwStatements.ts index 8d155cbc8cf..07c09da93fc 100644 --- a/tests/cases/conformance/statements/throwStatements/throwStatements.ts +++ b/tests/cases/conformance/statements/throwStatements/throwStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // all legal interface I { diff --git a/tests/cases/conformance/types/localTypes/localTypes4.ts b/tests/cases/conformance/types/localTypes/localTypes4.ts index bd31e76a80f..388d5efb637 100644 --- a/tests/cases/conformance/types/localTypes/localTypes4.ts +++ b/tests/cases/conformance/types/localTypes/localTypes4.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + function f1() { // Type parameters are in scope in parameters and return types function f(x: T): T { diff --git a/tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts b/tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts index c249d2e5671..5cb52588644 100644 --- a/tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts +++ b/tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts @@ -1,3 +1,5 @@ +// @allowUnusedLabels: true + // interfaces do not permit private members, these are errors interface I { diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts index 7ea4f414e15..1cc499c7d6e 100644 --- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts +++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // Call signatures without a return type should infer one from the function body (if present) // Simple types diff --git a/tests/cases/conformance/types/thisType/thisTypeErrors2.ts b/tests/cases/conformance/types/thisType/thisTypeErrors2.ts new file mode 100644 index 00000000000..d29e714c4d0 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeErrors2.ts @@ -0,0 +1,13 @@ +class Base { + constructor(a: this) { + } +} +class Generic { +} +class Derived { + n: number; + constructor(public host: Generic) { + let self: this = this; + this.n = 12; + } +} diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts index 9b12363ff08..9864ddab488 100644 --- a/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts +++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // 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 diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts index 41d4fddfbeb..03021bfdd10 100644 --- a/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts +++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts @@ -1,3 +1,5 @@ +// @allowUnreachableCode: true + // return type of a function with multiple returns is the BCT of each return statement // no errors expected here diff --git a/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts b/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts index bcb79811a62..7a52ddc2c32 100644 --- a/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts +++ b/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts @@ -1,4 +1,5 @@ /// +// @allowUnreachableCode: true //// class alpha { static beta() return 5; } } //// /**/ var gamma = alpha.beta() * 5; diff --git a/tests/cases/unittests/tsconfigParsing.ts b/tests/cases/unittests/tsconfigParsing.ts new file mode 100644 index 00000000000..3603d22f314 --- /dev/null +++ b/tests/cases/unittests/tsconfigParsing.ts @@ -0,0 +1,86 @@ +/// +/// + +namespace ts { + describe('parseConfigFileTextToJson', () => { + function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) { + let parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText); + assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject)); + } + + function assertParseError(jsonText: string) { + let parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText); + assert.isTrue(undefined === parsed.config); + assert.isTrue(undefined !== parsed.error); + } + + it("returns empty config for file with only whitespaces", () => { + assertParseResult("", { config : {} }); + assertParseResult(" ", { config : {} }); + }); + + it("returns empty config for file with comments only", () => { + assertParseResult("// Comment", { config: {} }); + assertParseResult("/* Comment*/", { config: {} }); + }); + + it("returns empty config when config is empty object", () => { + assertParseResult("{}", { config: {} }); + }); + + it("returns config object without comments", () => { + assertParseResult( + `{ // Excluded files + "exclude": [ + // Exclude d.ts + "file.d.ts" + ] + }`, { config: { exclude: ["file.d.ts"] } }); + + assertParseResult( + `{ + /* Excluded + Files + */ + "exclude": [ + /* multiline comments can be in the middle of a line */"file.d.ts" + ] + }`, { config: { exclude: ["file.d.ts"] } }); + }); + + it("keeps string content untouched", () => { + assertParseResult( + `{ + "exclude": [ + "xx//file.d.ts" + ] + }`, { config: { exclude: ["xx//file.d.ts"] } }); + assertParseResult( + `{ + "exclude": [ + "xx/*file.d.ts*/" + ] + }`, { config: { exclude: ["xx/*file.d.ts*/"] } }); + }); + + it("handles escaped characters in strings correctly", () => { + assertParseResult( + `{ + "exclude": [ + "xx\\"//files" + ] + }`, { config: { exclude: ["xx\"//files"] } }); + + assertParseResult( + `{ + "exclude": [ + "xx\\\\" // end of line comment + ] + }`, { config: { exclude: ["xx\\"] } }); + }); + + it("returns object with error when json is invalid", () => { + assertParseError("invalid"); + }); + }); +} diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 18a1f05d47b..6ddc18f1344 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -192,7 +192,6 @@ function getRequestOperation(req: http.ServerRequest, filename: string) { } return RequestType.Unknown } - return RequestType.Unknown } function handleRequestOperation(req: http.ServerRequest, res: http.ServerResponse, operation: RequestType, reqPath: string) {