diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index 902962cae51..86e2fa3ad70 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -4766,6 +4766,7 @@ interface PromiseLike { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } /** @@ -4779,6 +4780,7 @@ interface Promise { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index f839a3e3a0b..d6ca7245140 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -4766,6 +4766,7 @@ interface PromiseLike { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } /** @@ -4779,6 +4780,7 @@ interface Promise { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. diff --git a/bin/tsc.js b/bin/tsc.js index 4912544383a..47c6769ae8d 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -431,9 +431,13 @@ var ts; return 3; return 2; } + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -584,10 +588,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1277,6 +1282,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1356,8 +1363,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -1377,7 +1384,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -1410,7 +1417,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -1431,7 +1438,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -3067,6 +3073,9 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + bindDeclaration(node, 1, 107455, false); + } else { bindDeclaration(node, 1, 107454, false); } @@ -3591,9 +3600,6 @@ var ts; case 141: case 143: case 144: - case 163: - case 164: - case 201: return true; } } @@ -4175,6 +4181,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } @@ -5497,13 +5515,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70) { return nextToken() === 77; } @@ -5520,6 +5531,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 || token === 14 @@ -8583,7 +8597,6 @@ var ts; var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); var unknownType = createIntrinsicType(1, "unknown"); - var resolvingType = createIntrinsicType(1, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -8613,6 +8626,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -8832,9 +8847,9 @@ var ts; } else if (location.kind === 228 || (location.kind === 206 && location.name.kind === 8)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -9163,7 +9178,8 @@ var ts; } var symbol; if (name.kind === 65) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -9206,10 +9222,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -10134,14 +10151,28 @@ var ts; }); } } - function getRootDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; } - return node; + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { @@ -10291,7 +10322,7 @@ var ts; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -10311,20 +10342,23 @@ var ts; if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -10345,13 +10379,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137); var setter = ts.getDeclarationOfKind(symbol, 138); var type; @@ -10376,17 +10407,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -10405,7 +10435,10 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + links.type = targetSymbol.flags & 107455 + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -10548,17 +10581,16 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -11097,7 +11129,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -11108,21 +11142,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -11420,7 +11452,13 @@ var ts; } return false; } + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -11428,6 +11466,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -12983,16 +13022,33 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); - if (!prototypeProperty) { - return type; + if (prototypeProperty) { + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; + } } - var targetType = getTypeOfSymbol(prototypeProperty); - if (isTypeSubtypeOf(targetType, type)) { - return targetType; + if (!targetType) { + var constructSignatures; + if (rightType.flags & 2048) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768) { + constructSignatures = getSignaturesOfType(rightType, 1); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } } return type; } @@ -14372,10 +14428,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -15156,7 +15211,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -15632,7 +15687,7 @@ var ts; if (ts.isInAmbientContext(node)) { return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } @@ -15693,7 +15748,7 @@ var ts; // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. - if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 199 && !node.initializer) { @@ -15723,14 +15778,8 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node.kind === 130; - } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130) { + if (ts.getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -15769,7 +15818,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -21224,7 +21273,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -21240,6 +21289,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) { + write(".slice()"); + } } else { var i = pos; @@ -21277,7 +21329,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma); + emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma); } } function emitObjectLiteralBody(node, numElements) { @@ -21603,7 +21655,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -22231,7 +22283,7 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (compilerOptions.module === 4) { + if (compilerOptions.module === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 256) { write("default"); @@ -22569,12 +22621,14 @@ var ts; node.parent.kind === 228; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -23240,15 +23294,6 @@ var ts; scopeEmitEnd(); if (thisNodeIsDecorated) { write(";"); - if (node.name) { - writeLine(); - write("Object.defineProperty("); - emitDeclarationName(node); - write(", \"name\", { value: \""); - emitDeclarationName(node); - write("\", configurable: true });"); - writeLine(); - } } if (isClassExpressionWithStaticProperties) { for (var _a = 0; _a < staticProperties.length; _a++) { @@ -23602,15 +23647,17 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -23632,7 +23679,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -23643,6 +23690,14 @@ var ts; write(";"); } if (languageVersion < 2 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -24229,12 +24284,25 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 + ? local + : local.name; + if (name_21) { + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 || local.kind === 206) { + if (local.kind === 202 || local.kind === 206 || local.kind === 205) { emitDeclarationName(local); } else { @@ -24265,6 +24333,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2) { + return; + } if (node.kind === 201) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -24279,24 +24350,35 @@ var ts; hoistedVars.push(node); return; } - if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 || node.kind === 153) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65) { + var name_22 = node.name; + if (name_22.kind === 65) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -24966,7 +25048,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -25142,14 +25224,14 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -25205,42 +25287,49 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); } @@ -25300,9 +25389,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -25322,10 +25412,7 @@ var ts; var moduleName = nameLiteral.text; if (moduleName) { var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -25415,10 +25502,10 @@ var ts; } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -25556,7 +25643,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", diff --git a/bin/tsserver.js b/bin/tsserver.js index e492912a282..f617ae545f3 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -431,9 +431,13 @@ var ts; return 3; return 2; } + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -584,10 +588,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1277,6 +1282,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1356,8 +1363,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -1377,7 +1384,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -1410,7 +1417,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -1431,7 +1438,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -2795,7 +2801,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -3462,9 +3468,6 @@ var ts; case 141: case 143: case 144: - case 163: - case 164: - case 201: return true; } } @@ -4046,6 +4049,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } @@ -5368,13 +5383,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70) { return nextToken() === 77; } @@ -5391,6 +5399,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 || token === 14 @@ -8736,6 +8747,9 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + bindDeclaration(node, 1, 107455, false); + } else { bindDeclaration(node, 1, 107454, false); } @@ -8967,7 +8981,6 @@ var ts; var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); var unknownType = createIntrinsicType(1, "unknown"); - var resolvingType = createIntrinsicType(1, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -8997,6 +9010,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -9216,9 +9231,9 @@ var ts; } else if (location.kind === 228 || (location.kind === 206 && location.name.kind === 8)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -9547,7 +9562,8 @@ var ts; } var symbol; if (name.kind === 65) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -9590,10 +9606,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -10518,14 +10535,28 @@ var ts; }); } } - function getRootDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; } - return node; + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { @@ -10675,7 +10706,7 @@ var ts; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -10695,20 +10726,23 @@ var ts; if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -10729,13 +10763,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137); var setter = ts.getDeclarationOfKind(symbol, 138); var type; @@ -10760,17 +10791,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -10789,7 +10819,10 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + links.type = targetSymbol.flags & 107455 + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -10932,17 +10965,16 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -11481,7 +11513,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -11492,21 +11526,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -11804,7 +11836,13 @@ var ts; } return false; } + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -11812,6 +11850,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -13367,16 +13406,33 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); - if (!prototypeProperty) { - return type; + if (prototypeProperty) { + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; + } } - var targetType = getTypeOfSymbol(prototypeProperty); - if (isTypeSubtypeOf(targetType, type)) { - return targetType; + if (!targetType) { + var constructSignatures; + if (rightType.flags & 2048) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768) { + constructSignatures = getSignaturesOfType(rightType, 1); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } } return type; } @@ -14756,10 +14812,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -15540,7 +15595,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -16016,7 +16071,7 @@ var ts; if (ts.isInAmbientContext(node)) { return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } @@ -16077,7 +16132,7 @@ var ts; // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. - if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 199 && !node.initializer) { @@ -16107,14 +16162,8 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node.kind === 130; - } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130) { + if (ts.getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -16153,7 +16202,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -21608,7 +21657,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -21624,6 +21673,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) { + write(".slice()"); + } } else { var i = pos; @@ -21661,7 +21713,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma); + emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma); } } function emitObjectLiteralBody(node, numElements) { @@ -21987,7 +22039,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -22615,7 +22667,7 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (compilerOptions.module === 4) { + if (compilerOptions.module === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 256) { write("default"); @@ -22953,12 +23005,14 @@ var ts; node.parent.kind === 228; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -23624,15 +23678,6 @@ var ts; scopeEmitEnd(); if (thisNodeIsDecorated) { write(";"); - if (node.name) { - writeLine(); - write("Object.defineProperty("); - emitDeclarationName(node); - write(", \"name\", { value: \""); - emitDeclarationName(node); - write("\", configurable: true });"); - writeLine(); - } } if (isClassExpressionWithStaticProperties) { for (var _a = 0; _a < staticProperties.length; _a++) { @@ -23986,15 +24031,17 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -24016,7 +24063,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -24027,6 +24074,14 @@ var ts; write(";"); } if (languageVersion < 2 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -24613,12 +24668,25 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 + ? local + : local.name; + if (name_21) { + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 || local.kind === 206) { + if (local.kind === 202 || local.kind === 206 || local.kind === 205) { emitDeclarationName(local); } else { @@ -24649,6 +24717,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2) { + return; + } if (node.kind === 201) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -24663,24 +24734,35 @@ var ts; hoistedVars.push(node); return; } - if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 || node.kind === 153) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65) { + var name_22 = node.name; + if (name_22.kind === 65) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -25350,7 +25432,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -25526,14 +25608,14 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -25589,42 +25671,49 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); } @@ -25684,9 +25773,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -25706,10 +25796,7 @@ var ts; var moduleName = nameLiteral.text; if (moduleName) { var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -25799,10 +25886,10 @@ var ts; } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -26376,10 +26463,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -26390,14 +26477,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -26727,9 +26814,9 @@ var ts; case 199: case 153: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 199) { variableDeclarationNode = variableDeclarationNode.parent; @@ -26739,16 +26826,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -28740,9 +28827,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -31176,8 +31263,9 @@ var ts; })(); ts.CancellationTokenObject = CancellationTokenObject; var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); for (var _i = 0; _i < rootFileNames.length; _i++) { @@ -31189,6 +31277,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -31199,13 +31290,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -31217,8 +31308,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -31719,6 +31812,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { @@ -31748,7 +31842,16 @@ var ts; return ruleProvider; } function synchronizeHostData() { - var hostCache = new HostCache(host); + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } + var hostCache = new HostCache(host, getCanonicalFileName); if (programUpToDate()) { return; } @@ -31758,7 +31861,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -32185,12 +32288,14 @@ var ts; || containingNodeKind === 136 || containingNodeKind === 159 || containingNodeKind === 154 - || containingNodeKind === 170; + || containingNodeKind === 170 + || containingNodeKind === 143; case 16: return containingNodeKind === 158 || containingNodeKind === 136 || containingNodeKind === 159 - || containingNodeKind === 162; + || containingNodeKind === 162 + || containingNodeKind === 150; case 18: return containingNodeKind === 154; case 117: @@ -32284,6 +32389,8 @@ var ts; containingNodeKind === 151; case 20: return containingNodeKind === 152; + case 51: + return containingNodeKind === 153; case 18: return containingNodeKind === 152; case 16: @@ -32326,6 +32433,7 @@ var ts; case 104: case 70: case 110: + case 124: return true; } switch (previousToken.getText()) { @@ -32419,10 +32527,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -34101,17 +34209,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -34120,7 +34228,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -34497,10 +34605,10 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + if (!ts.isTrivia(kind)) { + return; + } if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { pushClassification(start, width, 1); continue; @@ -36854,11 +36962,11 @@ var ts; configFilename = ts.normalizePath(configFilename); var dirPath = ts.getDirectoryPath(configFilename); var rawConfig = ts.readConfigFile(configFilename); - if (!rawConfig) { - return { errorMsg: "tsconfig syntax error" }; + if (rawConfig.error) { + return rawConfig.error; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 3e765a33f01..bcb379ed52f 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1379,6 +1379,7 @@ declare module "typescript" { interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; + getProjectVersion?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): IScriptSnapshot; diff --git a/bin/typescript.js b/bin/typescript.js index ad70519a3fa..4cab75bfcb6 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -1129,9 +1129,18 @@ var ts; return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -1302,10 +1311,14 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + /** + * List of supported extensions in order of file resolution precedence. + */ + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -2020,6 +2033,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2099,8 +2114,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -2120,7 +2135,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -2153,7 +2168,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -2174,7 +2189,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -3977,6 +3991,18 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + } else { bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } @@ -4576,9 +4602,6 @@ var ts; case 141 /* IndexSignature */: case 143 /* FunctionType */: case 144 /* ConstructorType */: - case 163 /* FunctionExpression */: - case 164 /* ArrowFunction */: - case 201 /* FunctionDeclaration */: return true; } } @@ -5219,6 +5242,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130 /* Parameter */; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153 /* BindingElement */) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } @@ -6839,13 +6874,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === 77 /* EnumKeyword */; @@ -6863,6 +6891,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ @@ -10804,7 +10835,6 @@ var ts; var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -10834,6 +10864,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -11063,9 +11095,9 @@ var ts; } else if (location.kind === 228 /* SourceFile */ || (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -11481,7 +11513,8 @@ var ts; } var symbol; if (name.kind === 65 /* Identifier */) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -11528,10 +11561,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -12573,14 +12607,37 @@ var ts; }); } } - function getRootDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; + // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, + // a new entry with that target and an associated result value of true is pushed on the stack, and the value + // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and + // all entries pushed after it are changed to false, and the value false is returned. The target object provides + // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of + // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and + // Signature instances are used to track resolution of Signature.resolvedReturnType. + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; } - return node; + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + // Pop an entry from the type resolution stack and return its associated result value. The result value will + // be true if no circularities were detected, or false if a circularity was found. + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; @@ -12791,7 +12848,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -12815,20 +12872,25 @@ var ts; return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + // Variable has type annotation that circularly references the variable itself + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + // Variable has initializer that circularly references the variable itself + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -12849,13 +12911,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; @@ -12883,17 +12942,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -12912,7 +12970,15 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & 107455 /* Value */ + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -13058,17 +13124,18 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + // Note that we use the links object as the target here because the symbol object is used as the unique + // identity for resolution of the 'type' property in SymbolLinks. + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -13634,7 +13701,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -13645,21 +13714,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -13987,7 +14054,17 @@ var ts; } return false; } + // Since removeSubtypes checks the subtype relation, and the subtype relation on a union + // may attempt to reduce a union, it is possible that removeSubtypes could be called + // recursively on the same set of types. The removeSubtypesStack is used to track which + // sets of types are currently undergoing subtype reduction. + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -13995,6 +14072,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -15696,19 +15774,37 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } - // Target type is type of prototype property + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); - if (!prototypeProperty) { - return type; + if (prototypeProperty) { + // Target type is type of the protoype property + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; + } } - var targetType = getTypeOfSymbol(prototypeProperty); - // Narrow to target type if it is a subtype of current type - if (isTypeSubtypeOf(targetType, type)) { - return targetType; + if (!targetType) { + // Target type is type of construct signature + var constructSignatures; + if (rightType.flags & 2048 /* Interface */) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768 /* Anonymous */) { + constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - // If current type is a union type, remove all constituents that aren't subtypes of target type - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + if (targetType) { + // Narrow to the target type if it's a subtype of the current type + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + // If the current type is a union type, remove all constituents that aren't subtypes of the target. + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } } return type; } @@ -17486,10 +17582,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -18405,7 +18500,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -18969,7 +19064,7 @@ var ts; // ambient context - no codegen impact return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; @@ -19057,7 +19152,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -19096,15 +19191,9 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node.kind === 130 /* Parameter */; - } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19153,7 +19242,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -24213,7 +24302,7 @@ var ts; var exportSpecifiers; var exportEquals; var hasExportStars; - /** write emitted output to disk*/ + /** Write emitted output to disk */ var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; @@ -25271,7 +25360,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -25288,6 +25377,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) { + write(".slice()"); + } } else { var i = pos; @@ -25325,7 +25417,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0, + emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma); } } @@ -25697,7 +25789,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -26401,7 +26493,8 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (compilerOptions.module === 4 /* System */) { + // emit call to exporter only for top level nodes + if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -26774,13 +26867,15 @@ var ts; node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1 /* Export */)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -27544,6 +27639,7 @@ var ts; writeLine(); emitToken(15 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); + // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. // For a decorated class, we need to assign its name (if it has one). This is because we emit // the class as a class expression to avoid the double-binding of the identifier: // @@ -27553,15 +27649,6 @@ var ts; // if (thisNodeIsDecorated) { write(";"); - if (node.name) { - writeLine(); - write("Object.defineProperty("); - emitDeclarationName(node); - write(", \"name\", { value: \""); - emitDeclarationName(node); - write("\", configurable: true });"); - writeLine(); - } } // Emit static property assignment. Because classDeclaration is lexically evaluated, // it is safe to emit static property assignment after classDeclaration @@ -27986,15 +28073,18 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -28016,7 +28106,8 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted writeLine(); emitStart(node); write("var "); @@ -28027,6 +28118,15 @@ var ts; write(";"); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -28666,12 +28766,26 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 /* Identifier */ + ? local + : local.name; + if (name_21) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -28702,6 +28816,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } if (node.kind === 201 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -28710,31 +28827,41 @@ var ts; return; } if (node.kind === 202 /* ClassDeclaration */) { - // TODO: rename block scoped classes if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65 /* Identifier */) { + var name_22 = node.name; + if (name_22.kind === 65 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -29529,7 +29656,7 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -29713,14 +29840,19 @@ var ts; // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + // + // If the -out option is specified, we should not pass the source file to getEmitResolver. + // This is because in the -out scenario all files need to be emitted, and therefore all + // files need to be type checked. And the way to specify that all files need to be type + // checked is to not pass the file to getEmitResolver. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -29777,43 +29909,50 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, false); @@ -29876,9 +30015,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -29906,10 +30046,7 @@ var ts; // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -30004,10 +30141,10 @@ var ts; if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -30155,7 +30292,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -30642,12 +30779,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -30660,14 +30797,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31050,9 +31187,9 @@ var ts; case 199 /* VariableDeclaration */: case 153 /* BindingElement */: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153 /* BindingElement */) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -31064,16 +31201,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -33660,9 +33797,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -36445,8 +36582,9 @@ var ts; // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index this.fileNameToEntry = {}; // Initialize the list with the root file names @@ -36461,6 +36599,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -36471,13 +36612,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -36489,8 +36630,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -37077,6 +37220,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); // Check if the localized messages json is set, otherwise query the host for it @@ -37108,8 +37252,18 @@ var ts; return ruleProvider; } function synchronizeHostData() { + // perform fast check if host supports it + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } // Get a fresh cache of the host information - var hostCache = new HostCache(host); + var hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { return; @@ -37126,7 +37280,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -37664,12 +37818,14 @@ var ts; || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion || containingNodeKind === 159 /* NewExpression */ // new C(a, | || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | + || containingNodeKind === 170 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list| case 16 /* OpenParenToken */: return containingNodeKind === 158 /* CallExpression */ // func( | || containingNodeKind === 136 /* Constructor */ // constructor( | || containingNodeKind === 159 /* NewExpression */ // new C(a| - || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| + || containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case 18 /* OpenBracketToken */: return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | case 117 /* ModuleKeyword */: // module | @@ -37766,8 +37922,10 @@ var ts; containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| + case 51 /* ColonToken */: + return containingNodeKind === 153 /* BindingElement */; // var {x :html| case 18 /* OpenBracketToken */: - return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); @@ -37780,7 +37938,7 @@ var ts; return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: return containingNodeKind === 202 /* ClassDeclaration */ || containingNodeKind === 201 /* FunctionDeclaration */ || @@ -37792,7 +37950,7 @@ var ts; return containingNodeKind === 130 /* Parameter */ || containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: @@ -37808,6 +37966,7 @@ var ts; case 104 /* LetKeyword */: case 70 /* ConstKeyword */: case 110 /* YieldKeyword */: + case 124 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -37906,10 +38065,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -39791,19 +39950,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -39812,7 +39971,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -40232,10 +40391,12 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + // The moment we get something that isn't trivia, then stop processing. + if (!ts.isTrivia(kind)) { + return; + } + // Only bother with the trivia if it at least intersects the span of interest. if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { // Simple comment. Just add as is. pushClassification(start, width, 1 /* comment */); @@ -41620,7 +41781,7 @@ var ts; })(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -41678,6 +41839,13 @@ var ts; LanguageServiceShimHostAdapter.prototype.error = function (s) { this.shimHost.error(s); }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + // shimmed host does not support getProjectVersion + return undefined; + } + return this.shimHost.getProjectVersion(); + }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 3114c56b789..f03a7a00e46 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1379,6 +1379,7 @@ declare module ts { interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; + getProjectVersion?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): IScriptSnapshot; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index ad70519a3fa..4cab75bfcb6 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -1129,9 +1129,18 @@ var ts; return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -1302,10 +1311,14 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + /** + * List of supported extensions in order of file resolution precedence. + */ + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -2020,6 +2033,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2099,8 +2114,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -2120,7 +2135,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -2153,7 +2168,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -2174,7 +2189,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -3977,6 +3991,18 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + } else { bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } @@ -4576,9 +4602,6 @@ var ts; case 141 /* IndexSignature */: case 143 /* FunctionType */: case 144 /* ConstructorType */: - case 163 /* FunctionExpression */: - case 164 /* ArrowFunction */: - case 201 /* FunctionDeclaration */: return true; } } @@ -5219,6 +5242,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130 /* Parameter */; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153 /* BindingElement */) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } @@ -6839,13 +6874,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === 77 /* EnumKeyword */; @@ -6863,6 +6891,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ @@ -10804,7 +10835,6 @@ var ts; var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -10834,6 +10864,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -11063,9 +11095,9 @@ var ts; } else if (location.kind === 228 /* SourceFile */ || (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -11481,7 +11513,8 @@ var ts; } var symbol; if (name.kind === 65 /* Identifier */) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -11528,10 +11561,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -12573,14 +12607,37 @@ var ts; }); } } - function getRootDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; + // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, + // a new entry with that target and an associated result value of true is pushed on the stack, and the value + // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and + // all entries pushed after it are changed to false, and the value false is returned. The target object provides + // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of + // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and + // Signature instances are used to track resolution of Signature.resolvedReturnType. + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; } - return node; + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + // Pop an entry from the type resolution stack and return its associated result value. The result value will + // be true if no circularities were detected, or false if a circularity was found. + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; @@ -12791,7 +12848,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -12815,20 +12872,25 @@ var ts; return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + // Variable has type annotation that circularly references the variable itself + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + // Variable has initializer that circularly references the variable itself + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -12849,13 +12911,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; @@ -12883,17 +12942,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -12912,7 +12970,15 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & 107455 /* Value */ + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -13058,17 +13124,18 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + // Note that we use the links object as the target here because the symbol object is used as the unique + // identity for resolution of the 'type' property in SymbolLinks. + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -13634,7 +13701,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -13645,21 +13714,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -13987,7 +14054,17 @@ var ts; } return false; } + // Since removeSubtypes checks the subtype relation, and the subtype relation on a union + // may attempt to reduce a union, it is possible that removeSubtypes could be called + // recursively on the same set of types. The removeSubtypesStack is used to track which + // sets of types are currently undergoing subtype reduction. + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -13995,6 +14072,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -15696,19 +15774,37 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } - // Target type is type of prototype property + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); - if (!prototypeProperty) { - return type; + if (prototypeProperty) { + // Target type is type of the protoype property + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; + } } - var targetType = getTypeOfSymbol(prototypeProperty); - // Narrow to target type if it is a subtype of current type - if (isTypeSubtypeOf(targetType, type)) { - return targetType; + if (!targetType) { + // Target type is type of construct signature + var constructSignatures; + if (rightType.flags & 2048 /* Interface */) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768 /* Anonymous */) { + constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - // If current type is a union type, remove all constituents that aren't subtypes of target type - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + if (targetType) { + // Narrow to the target type if it's a subtype of the current type + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + // If the current type is a union type, remove all constituents that aren't subtypes of the target. + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } } return type; } @@ -17486,10 +17582,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -18405,7 +18500,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -18969,7 +19064,7 @@ var ts; // ambient context - no codegen impact return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; @@ -19057,7 +19152,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -19096,15 +19191,9 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node.kind === 130 /* Parameter */; - } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19153,7 +19242,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -24213,7 +24302,7 @@ var ts; var exportSpecifiers; var exportEquals; var hasExportStars; - /** write emitted output to disk*/ + /** Write emitted output to disk */ var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; @@ -25271,7 +25360,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -25288,6 +25377,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) { + write(".slice()"); + } } else { var i = pos; @@ -25325,7 +25417,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0, + emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma); } } @@ -25697,7 +25789,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -26401,7 +26493,8 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (compilerOptions.module === 4 /* System */) { + // emit call to exporter only for top level nodes + if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -26774,13 +26867,15 @@ var ts; node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1 /* Export */)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -27544,6 +27639,7 @@ var ts; writeLine(); emitToken(15 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); + // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. // For a decorated class, we need to assign its name (if it has one). This is because we emit // the class as a class expression to avoid the double-binding of the identifier: // @@ -27553,15 +27649,6 @@ var ts; // if (thisNodeIsDecorated) { write(";"); - if (node.name) { - writeLine(); - write("Object.defineProperty("); - emitDeclarationName(node); - write(", \"name\", { value: \""); - emitDeclarationName(node); - write("\", configurable: true });"); - writeLine(); - } } // Emit static property assignment. Because classDeclaration is lexically evaluated, // it is safe to emit static property assignment after classDeclaration @@ -27986,15 +28073,18 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -28016,7 +28106,8 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted writeLine(); emitStart(node); write("var "); @@ -28027,6 +28118,15 @@ var ts; write(";"); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -28666,12 +28766,26 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 /* Identifier */ + ? local + : local.name; + if (name_21) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -28702,6 +28816,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } if (node.kind === 201 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -28710,31 +28827,41 @@ var ts; return; } if (node.kind === 202 /* ClassDeclaration */) { - // TODO: rename block scoped classes if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65 /* Identifier */) { + var name_22 = node.name; + if (name_22.kind === 65 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -29529,7 +29656,7 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -29713,14 +29840,19 @@ var ts; // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + // + // If the -out option is specified, we should not pass the source file to getEmitResolver. + // This is because in the -out scenario all files need to be emitted, and therefore all + // files need to be type checked. And the way to specify that all files need to be type + // checked is to not pass the file to getEmitResolver. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -29777,43 +29909,50 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, false); @@ -29876,9 +30015,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -29906,10 +30046,7 @@ var ts; // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -30004,10 +30141,10 @@ var ts; if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -30155,7 +30292,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -30642,12 +30779,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -30660,14 +30797,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31050,9 +31187,9 @@ var ts; case 199 /* VariableDeclaration */: case 153 /* BindingElement */: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153 /* BindingElement */) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -31064,16 +31201,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -33660,9 +33797,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -36445,8 +36582,9 @@ var ts; // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index this.fileNameToEntry = {}; // Initialize the list with the root file names @@ -36461,6 +36599,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -36471,13 +36612,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -36489,8 +36630,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -37077,6 +37220,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); // Check if the localized messages json is set, otherwise query the host for it @@ -37108,8 +37252,18 @@ var ts; return ruleProvider; } function synchronizeHostData() { + // perform fast check if host supports it + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } // Get a fresh cache of the host information - var hostCache = new HostCache(host); + var hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { return; @@ -37126,7 +37280,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -37664,12 +37818,14 @@ var ts; || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion || containingNodeKind === 159 /* NewExpression */ // new C(a, | || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | + || containingNodeKind === 170 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list| case 16 /* OpenParenToken */: return containingNodeKind === 158 /* CallExpression */ // func( | || containingNodeKind === 136 /* Constructor */ // constructor( | || containingNodeKind === 159 /* NewExpression */ // new C(a| - || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| + || containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case 18 /* OpenBracketToken */: return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | case 117 /* ModuleKeyword */: // module | @@ -37766,8 +37922,10 @@ var ts; containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| + case 51 /* ColonToken */: + return containingNodeKind === 153 /* BindingElement */; // var {x :html| case 18 /* OpenBracketToken */: - return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); @@ -37780,7 +37938,7 @@ var ts; return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: return containingNodeKind === 202 /* ClassDeclaration */ || containingNodeKind === 201 /* FunctionDeclaration */ || @@ -37792,7 +37950,7 @@ var ts; return containingNodeKind === 130 /* Parameter */ || containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: @@ -37808,6 +37966,7 @@ var ts; case 104 /* LetKeyword */: case 70 /* ConstKeyword */: case 110 /* YieldKeyword */: + case 124 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -37906,10 +38065,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -39791,19 +39950,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -39812,7 +39971,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -40232,10 +40391,12 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + // The moment we get something that isn't trivia, then stop processing. + if (!ts.isTrivia(kind)) { + return; + } + // Only bother with the trivia if it at least intersects the span of interest. if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { // Simple comment. Just add as is. pushClassification(start, width, 1 /* comment */); @@ -41620,7 +41781,7 @@ var ts; })(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -41678,6 +41839,13 @@ var ts; LanguageServiceShimHostAdapter.prototype.error = function (s) { this.shimHost.error(s); }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + // shimmed host does not support getProjectVersion + return undefined; + } + return this.shimHost.getProjectVersion(); + }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { diff --git a/package.json b/package.json index c33f2a93ec1..88d5db51f72 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.5.0", + "version": "1.5.2", "licenses": [ { "type": "Apache License 2.0", diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 170f3d3c830..b66497fc40d 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -440,6 +440,18 @@ module ts { else if (isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false); + } else { bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 47e1828711a..722019dc703 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -88,6 +88,7 @@ module ts { let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); let unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); + let circularType = createIntrinsicType(TypeFlags.Any, "__circular__"); let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -803,7 +804,9 @@ module ts { let symbol: Symbol; if (name.kind === SyntaxKind.Identifier) { - symbol = resolveName(name, (name).text, meaning, Diagnostics.Cannot_find_name_0, name); + let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0; + + symbol = resolveName(name, (name).text, meaning, message, name); if (!symbol) { return undefined; } @@ -855,10 +858,11 @@ module ts { return symbol; } } + let fileName: string; let sourceFile: SourceFile; while (true) { - let fileName = normalizePath(combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = normalizePath(combinePaths(searchPath, moduleName)); + sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension)); if (sourceFile || isRelative) { break; } @@ -2048,13 +2052,6 @@ module ts { return resolutionResults.pop(); } - function getRootDeclaration(node: Node): Node { - while (node.kind === SyntaxKind.BindingElement) { - node = node.parent.parent; - } - return node; - } - function getDeclarationContainer(node: Node): Node { node = getRootDeclaration(node); @@ -2412,7 +2409,16 @@ module ts { function getTypeOfAlias(symbol: Symbol): Type { let links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + let targetSymbol = resolveAlias(symbol); + + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & SymbolFlags.Value + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -3632,10 +3638,20 @@ module ts { return type; } + // Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer + // to process and look strange in quick info and error messages. Semantically there is no difference between the + // reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the + // type itself. function getReducedTypeOfUnionType(type: UnionType): Type { - // If union type was created without subtype reduction, perform the deferred reduction now if (!type.reducedType) { - type.reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false); + type.reducedType = circularType; + let reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false); + if (type.reducedType === circularType) { + type.reducedType = reducedType; + } + } + else if (type.reducedType === circularType) { + type.reducedType = type; } return type.reducedType; } @@ -5382,20 +5398,43 @@ module ts { if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } - // Target type is type of prototype property + + let targetType: Type; let prototypeProperty = getPropertyOfType(rightType, "prototype"); - if (!prototypeProperty) { - return type; + if (prototypeProperty) { + // Target type is type of the protoype property + let prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; + } } - let targetType = getTypeOfSymbol(prototypeProperty); - // Narrow to target type if it is a subtype of current type - if (isTypeSubtypeOf(targetType, type)) { - return targetType; + + if (!targetType) { + // Target type is type of construct signature + let constructSignatures: Signature[]; + if (rightType.flags & TypeFlags.Interface) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & TypeFlags.Anonymous) { + constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct); + } + + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature)))); + } } - // If current type is a union type, remove all constituents that aren't subtypes of target type - if (type.flags & TypeFlags.Union) { - return getUnionType(filter((type).types, t => isTypeSubtypeOf(t, targetType))); + + if (targetType) { + // Narrow to the target type if it's a subtype of the current type + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + // If the current type is a union type, remove all constituents that aren't subtypes of the target. + if (type.flags & TypeFlags.Union) { + return getUnionType(filter((type).types, t => isTypeSubtypeOf(t, targetType))); + } } + return type; } @@ -9180,13 +9219,6 @@ module ts { } } - function isParameterDeclaration(node: VariableLikeDeclaration) { - while (node.kind === SyntaxKind.BindingElement) { - node = node.parent.parent; - } - return node.kind === SyntaxKind.Parameter; - } - // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node: VariableLikeDeclaration): void { if (getRootDeclaration(node).kind !== SyntaxKind.Parameter) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 6a055aebf6a..7a589fe61cb 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -88,7 +88,7 @@ module ts { { name: "noEmitOnError", type: "boolean", - description: Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported, + description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, }, { name: "noImplicitAny", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 9b987ba77c6..ef7c892be9d 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -459,8 +459,18 @@ module ts { if (path.charCodeAt(2) === CharacterCodes.slash) return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } let idx = path.indexOf('://'); - if (idx !== -1) return idx + 3 + if (idx !== -1) { + return idx + "://".length; + } return 0; } @@ -640,16 +650,18 @@ module ts { return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } - let supportedExtensions = [".d.ts", ".ts", ".js"]; + /** + * List of supported extensions in order of file resolution precedence. + */ + export const supportedExtensions = [".ts", ".d.ts"]; + const extensionsToRemove = [".d.ts", ".ts", ".js"]; export function removeFileExtension(path: string): string { - for (let ext of supportedExtensions) { - + for (let ext of extensionsToRemove) { if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } } - return path; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 4eed4a85329..32dc590eeec 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -364,6 +364,7 @@ module ts { A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -443,8 +444,8 @@ module ts { Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -464,7 +465,7 @@ module ts { Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -497,7 +498,7 @@ module ts { Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d7d1011ce7f..a3dfd62d34e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1444,6 +1444,10 @@ "category": "Error", "code": 2502 }, + "Cannot find namespace '{0}'.": { + "category": "Error", + "code": 2503 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1761,11 +1765,11 @@ "category": "Error", "code": 5033 }, - "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.": { + "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": { "category": "Error", "code": 5038 }, - "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.": { + "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": { "category": "Error", "code": 5039 }, @@ -1846,7 +1850,7 @@ "category": "Message", "code": 6007 }, - "Do not emit outputs if any type checking errors were reported.": { + "Do not emit outputs if any errors were reported.": { "category": "Message", "code": 6008 }, @@ -1978,7 +1982,7 @@ "category": "Error", "code": 6053 }, - "File '{0}' must have extension '.ts' or '.d.ts'.": { + "File '{0}' has unsupported extension. The only supported extensions are {1}.": { "category": "Error", "code": 6054 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5a9a654ce60..c9d23ec5cee 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -139,7 +139,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { let exportEquals: ExportAssignment; let hasExportStars: boolean; - /** write emitted output to disk*/ + /** Write emitted output to disk */ let writeEmittedFiles = writeJavaScriptFile; let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; @@ -1366,7 +1366,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { return true; } - function emitListWithSpread(elements: Expression[], multiLine: boolean, trailingComma: boolean) { + function emitListWithSpread(elements: Expression[], alwaysCopy: boolean, multiLine: boolean, trailingComma: boolean) { let pos = 0; let group = 0; let length = elements.length; @@ -1383,6 +1383,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { e = (e).expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) { + write(".slice()"); + } } else { let i = pos; @@ -1422,7 +1425,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write("]"); } else { - emitListWithSpread(elements, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, + emitListWithSpread(elements, /*alwaysCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, /*trailingComma*/ elements.hasTrailingComma); } } @@ -1847,7 +1850,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write("void 0"); } write(", "); - emitListWithSpread(node.arguments, /*multiLine*/ false, /*trailingComma*/ false); + emitListWithSpread(node.arguments, /*alwaysCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false); write(")"); } @@ -2639,7 +2642,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { writeLine(); emitStart(node); - if (compilerOptions.module === ModuleKind.System) { + // emit call to exporter only for top level nodes + if (compilerOptions.module === ModuleKind.System && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(`${exportFunctionForFile}("`); @@ -3055,13 +3059,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } function emitVariableStatement(node: VariableStatement) { - let startIsEmitted = true; - if (!(node.flags & NodeFlags.Export)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + let startIsEmitted = false; + if (node.flags & NodeFlags.Export) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -3898,6 +3904,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { emitToken(SyntaxKind.CloseBraceToken, node.members.end); scopeEmitEnd(); + // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. + // For a decorated class, we need to assign its name (if it has one). This is because we emit // the class as a class expression to avoid the double-binding of the identifier: // @@ -3907,15 +3915,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { // if (thisNodeIsDecorated) { write(";"); - if (node.name) { - writeLine(); - write("Object.defineProperty("); - emitDeclarationName(node); - write(", \"name\", { value: \""); - emitDeclarationName(node); - write("\", configurable: true });"); - writeLine(); - } } // Emit static property assignment. Because classDeclaration is lexically evaluated, @@ -4380,15 +4379,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { return; } - if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -4410,7 +4412,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & NodeFlags.Export) { + if (!isES6ExportedDeclaration(node) && node.flags & NodeFlags.Export && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted writeLine(); emitStart(node); write("var "); @@ -4421,6 +4424,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write(";"); } if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + if (compilerOptions.module === ModuleKind.System && (node.flags & NodeFlags.Export)) { + // write the call to exporter for enum + writeLine(); + write(`${exportFunctionForFile}("`); + emitDeclarationName(node); + write(`", `); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -5101,7 +5113,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { // in theory we should hoist only exported functions and its dependencies // in practice to simplify things we'll hoist all source level functions and variable declaration // including variables declarations for module and class declarations - let hoistedVars: (Identifier | ClassDeclaration | ModuleDeclaration)[]; + let hoistedVars: (Identifier | ClassDeclaration | ModuleDeclaration | EnumDeclaration)[]; let hoistedFunctionDeclarations: FunctionDeclaration[]; let exportedDeclarations: (Identifier | Declaration)[]; @@ -5110,13 +5122,30 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { if (hoistedVars) { writeLine(); write("var "); + let seen: Map = {}; for (let i = 0; i < hoistedVars.length; ++i) { let local = hoistedVars[i]; + let name = local.kind === SyntaxKind.Identifier + ? local + : (local).name; + + if (name) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + let text = unescapeIdentifier(name.text); + if (hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { write(", "); } - if (local.kind === SyntaxKind.ClassDeclaration || local.kind === SyntaxKind.ModuleDeclaration) { - emitDeclarationName(local); + + if (local.kind === SyntaxKind.ClassDeclaration || local.kind === SyntaxKind.ModuleDeclaration || local.kind === SyntaxKind.EnumDeclaration) { + emitDeclarationName(local); } else { emit(local); @@ -5150,6 +5179,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { return exportedDeclarations; function visit(node: Node): void { + if (node.flags & NodeFlags.Ambient) { + return; + } + if (node.kind === SyntaxKind.FunctionDeclaration) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -5160,7 +5193,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } if (node.kind === SyntaxKind.ClassDeclaration) { - // TODO: rename block scoped classes if (!hoistedVars) { hoistedVars = []; } @@ -5169,12 +5201,26 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { return; } - if (node.kind === SyntaxKind.ModuleDeclaration && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === SyntaxKind.EnumDeclaration) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + + hoistedVars.push(node); } - hoistedVars.push(node); + return; + } + + if (node.kind === SyntaxKind.ModuleDeclaration) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + + hoistedVars.push(node); + } return; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 055fc1b6f74..af9b486a1da 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -957,15 +957,6 @@ module ts { } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - - function parseAnyContextualModifier(): boolean { - return isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - - function nextTokenCanFollowContextualModifier() { if (token === SyntaxKind.ConstKeyword) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === SyntaxKind.EnumKeyword; @@ -984,6 +975,10 @@ module ts { return canFollowModifier(); } + function parseAnyContextualModifier(): boolean { + return isModifier(token) && tryParse(nextTokenCanFollowModifier); + } + function canFollowModifier(): boolean { return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.OpenBraceToken diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e77d6432224..345844736d2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -8,7 +8,7 @@ module ts { /* @internal */ export let ioWriteTime = 0; /** The version of the TypeScript compiler release */ - export const version = "1.5.0"; + export const version = "1.5.2"; const carriageReturnLineFeed = "\r\n"; const lineFeed = "\n"; @@ -226,7 +226,12 @@ module ts { // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + // + // If the -out option is specified, we should not pass the source file to getEmitResolver. + // This is because in the -out scenario all files need to be emitted, and therefore all + // files need to be type checked. And the way to specify that all files need to be type + // checked is to not pass the file to getEmitResolver. + let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); let start = new Date().getTime(); @@ -240,7 +245,7 @@ module ts { } function getSourceFile(fileName: string) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(normalizeSlashes(fileName)); return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } @@ -314,45 +319,52 @@ module ts { function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { let start: number; let length: number; + let extensions: string; + let diagnosticArgument: string[]; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } let diagnostic: DiagnosticMessage; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) { + diagnostic = Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) { diagnostic = Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument)); } else { - diagnostics.add(createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); } } } // Get source file from normalized fileName function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { - let canonicalName = host.getCanonicalFileName(fileName); + let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName)); if (hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); @@ -424,9 +436,10 @@ module ts { let moduleNameText = (moduleNameExpr).text; if (moduleNameText) { let searchPath = basePath; + let searchName: string; while (true) { - let searchName = normalizePath(combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = normalizePath(combinePaths(searchPath, moduleNameText)); + if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) { break; } let parentPath = getDirectoryPath(searchPath); @@ -455,10 +468,7 @@ module ts { // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. let searchName = normalizePath(combinePaths(basePath, moduleName)); - let tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral)); } } }); @@ -571,10 +581,10 @@ module ts { if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 0bb0065d1b0..356337e1315 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -484,9 +484,6 @@ module ts { case SyntaxKind.IndexSignature: case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.FunctionDeclaration: return true; } } @@ -1149,6 +1146,18 @@ module ts { } return false; } + + export function isParameterDeclaration(node: VariableLikeDeclaration) { + let root = getRootDeclaration(node); + return root.kind === SyntaxKind.Parameter; + } + + export function getRootDeclaration(node: Node): Node { + while (node.kind === SyntaxKind.BindingElement) { + node = node.parent.parent; + } + return node; + } export function nodeStartsNewLexicalEnvironment(n: Node): boolean { return isFunctionLike(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 0f4a7c3a3d2..f9da67bf100 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -144,10 +144,10 @@ module FourSlash { if (globalOptions.hasOwnProperty(prop)) { switch (prop) { case metadataOptionNames.allowNonTsExtensions: - settings.allowNonTsExtensions = true; + settings.allowNonTsExtensions = globalOptions[prop] === "true"; break; case metadataOptionNames.declaration: - settings.declaration = true; + settings.declaration = globalOptions[prop] === "true"; break; case metadataOptionNames.mapRoot: settings.mapRoot = globalOptions[prop]; @@ -174,7 +174,7 @@ module FourSlash { settings.outDir = globalOptions[prop]; break; case metadataOptionNames.sourceMap: - settings.sourceMap = true; + settings.sourceMap = globalOptions[prop] === "true"; break; case metadataOptionNames.sourceRoot: settings.sourceRoot = globalOptions[prop]; @@ -308,7 +308,7 @@ module FourSlash { ts.forEach(testData.files, file => { // Create map between fileName and its content for easily looking up when resolveReference flag is specified this.inputFiles[file.fileName] = file.content; - if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) { + if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") { startResolveFileRef = file; } else if (startResolveFileRef) { // If entry point for resolving file references is already specified, report duplication error @@ -1159,7 +1159,7 @@ module FourSlash { var allFourSlashFiles = this.testData.files; for (var idx = 0; idx < allFourSlashFiles.length; ++idx) { var file = allFourSlashFiles[idx]; - if (file.fileOptions[metadataOptionNames.emitThisFile]) { + if (file.fileOptions[metadataOptionNames.emitThisFile] === "true") { // Find a file with the flag emitThisFile turned on emitFiles.push(file); } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index 1ab6e31cdbb..d11c5e639e5 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -35,9 +35,9 @@ class FourSlashRunner extends RunnerBase { this.tests = this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false }); } - describe(this.testSuiteName, () => { this.tests.forEach((fn: string) => { - fn = ts.normalizeSlashes(fn); + describe(fn, () => { + fn = ts.normalizeSlashes(fn); var justName = fn.replace(/^.*[\\\/]/, ''); // Convert to relative path diff --git a/src/harness/harness.ts b/src/harness/harness.ts index d6cf0b2af40..b4d5fead042 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -45,11 +45,13 @@ module Utils { export function getExecutionEnvironment() { if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return ExecutionEnvironment.CScript; - } else if (process && process.execPath && process.execPath.indexOf("node") !== -1) { - return ExecutionEnvironment.Node; - } else { + } + else if (typeof window !== "undefined") { return ExecutionEnvironment.Browser; } + else { + return ExecutionEnvironment.Node; + } } export var currentExecutionEnvironment = getExecutionEnvironment(); @@ -946,6 +948,7 @@ module Harness { options = options || { noResolve: false }; options.target = options.target || ts.ScriptTarget.ES3; options.module = options.module || ts.ModuleKind.None; + options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; options.noErrorTruncation = true; if (lightMode) { options.noLibCheck = true; @@ -1044,19 +1047,19 @@ module Harness { break; case 'noemitonerror': - options.noEmitOnError = !!setting.value; + options.noEmitOnError = setting.value === 'true'; break; case 'noresolve': - options.noResolve = !!setting.value; + options.noResolve = setting.value === 'true'; break; case 'noimplicitany': - options.noImplicitAny = !!setting.value; + options.noImplicitAny = setting.value === 'true'; break; case 'nolib': - options.noLib = !!setting.value; + options.noLib = setting.value === 'true'; break; case 'out': @@ -1078,11 +1081,11 @@ module Harness { break; case 'sourcemap': - options.sourceMap = !!setting.value; + options.sourceMap = setting.value === 'true'; break; case 'declaration': - options.declaration = !!setting.value; + options.declaration = setting.value === 'true'; break; case 'newline': @@ -1106,7 +1109,7 @@ module Harness { break; case 'stripinternal': - options.stripInternal = !!setting.value; + options.stripInternal = setting.value === 'true'; case 'usecasesensitivefilenames': useCaseSensitiveFileNames = setting.value === 'true'; @@ -1117,7 +1120,7 @@ module Harness { break; case 'emitbom': - options.emitBOM = !!setting.value; + options.emitBOM = setting.value === 'true'; break; case 'errortruncation': diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index fb0c64f8495..dc082c8f0a6 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -3580,6 +3580,7 @@ interface PromiseLike { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } /** @@ -3593,6 +3594,7 @@ interface Promise { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index dbf3ff3e51c..9c87a20c851 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -398,7 +398,7 @@ module ts.server { export class ProjectService { filenameToScriptInfo: ts.Map = {}; - // open, non-configured root files + // open, non-configured root files openFileRoots: ScriptInfo[] = []; // projects built from openFileRoots inferredProjects: Project[] = []; @@ -421,7 +421,7 @@ module ts.server { hostInfo: "Unknown host" } } - + getFormatCodeOptions(file?: string) { if (file) { var info = this.filenameToScriptInfo[file]; @@ -448,7 +448,7 @@ module ts.server { } } } - + log(msg: string, type = "Err") { this.psLogger.msg(msg, type); } @@ -457,17 +457,17 @@ module ts.server { if (args.file) { var info = this.filenameToScriptInfo[args.file]; if (info) { - info.setFormatOptions(args.formatOptions); + info.setFormatOptions(args.formatOptions); this.log("Host configuration update for file " + args.file, "Info"); } } else { if (args.hostInfo !== undefined) { this.hostConfiguration.hostInfo = args.hostInfo; - this.log("Host information " + args.hostInfo, "Info"); + this.log("Host information " + args.hostInfo, "Info"); } if (args.formatOptions) { - mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions); + mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions); this.log("Format host information updated", "Info"); } } @@ -487,7 +487,7 @@ module ts.server { fileDeletedInFilesystem(info: ScriptInfo) { this.psLogger.info(info.fileName + " deleted"); - + if (info.fileWatcher) { info.fileWatcher.close(); info.fileWatcher = undefined; @@ -537,7 +537,7 @@ module ts.server { } return false; } - + addOpenFile(info: ScriptInfo) { if (this.setConfiguredProjectRoot(info)) { this.openFileRootsConfigured.push(info); @@ -561,7 +561,7 @@ module ts.server { copyListRemovingItem(r.defaultProject, this.inferredProjects); // put r in referenced open file list this.openFilesReferenced.push(r); - // set default project of r to the new project + // set default project of r to the new project r.defaultProject = info.defaultProject; } else { @@ -694,7 +694,7 @@ module ts.server { this.openFilesReferenced = openFilesReferenced; // Then, loop through all of the open files that are project roots. - // For each root file, note the project that it roots. Then see if + // For each root file, note the project that it roots. Then see if // any other projects newly reference the file. If zero projects // newly reference the file, keep it as a root. If one or more // projects newly references the file, remove its project from the @@ -719,7 +719,7 @@ module ts.server { // Finally, if we found any open, referenced files that are no longer // referenced by their default project, treat them as newly opened - // by the editor. + // by the editor. for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { this.addOpenFile(unattachedOpenFiles[i]); } @@ -809,7 +809,7 @@ module ts.server { } else { this.log("Opened configuration file " + configFileName,"Info"); - this.configuredProjects.push(configResult.project); + this.configuredProjects.push(configResult.project); } } var info = this.openFile(fileName, true); @@ -901,22 +901,22 @@ module ts.server { } return false; } - + openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult { configFilename = ts.normalizePath(configFilename); // file references will be relative to dirPath (or absolute) var dirPath = ts.getDirectoryPath(configFilename); - var rawConfig = ts.readConfigFile(configFilename); - if (!rawConfig) { - return { errorMsg: "tsconfig syntax error" }; + var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename); + if (rawConfig.error) { + return rawConfig.error; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } else if (parsedCommandLine.fileNames) { - var projectOptions: ProjectOptions = { + var projectOptions: ProjectOptions = { files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options }; @@ -1040,7 +1040,7 @@ module ts.server { startPath: LineCollection[]; endBranch: LineCollection[] = []; branchNode: LineNode; - // path to current node + // path to current node stack: LineNode[]; state = CharRangeSection.Entire; lineCollectionAtBranch: LineCollection; @@ -1242,7 +1242,7 @@ module ts.server { } } - // text change information + // text change information class TextChange { constructor(public pos: number, public deleteLen: number, public insertedText?: string) { } @@ -1290,7 +1290,7 @@ module ts.server { if (cb) cb(); } - + // reload whole script, leaving no change history behind reload reload(script: string) { this.currentVersion++; @@ -1300,7 +1300,7 @@ module ts.server { snap.index = new LineIndex(); var lm = LineIndex.linesFromText(script); snap.index.load(lm.lines); - // REVIEW: could use linked list + // REVIEW: could use linked list for (var i = this.minVersion; i < this.currentVersion; i++) { this.versions[i] = undefined; } @@ -1381,7 +1381,7 @@ module ts.server { return this.index.root.charCount(); } - // this requires linear space so don't hold on to these + // this requires linear space so don't hold on to these getLineStartPositions(): number[] { var starts: number[] = [-1]; var count = 1; @@ -1643,7 +1643,7 @@ module ts.server { } walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { - // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) var childIndex = 0; var child = this.children[0]; var childCharCount = child.charCount(); @@ -1729,7 +1729,7 @@ module ts.server { line: lineNumber, offset: charOffset } - } + } else if (childInfo.child.isLeaf()) { return { line: lineNumber, @@ -1917,4 +1917,4 @@ module ts.server { return 1; } } -} \ No newline at end of file +} diff --git a/src/services/services.ts b/src/services/services.ts index 1333f2a13cb..9fb495ee931 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -949,6 +949,7 @@ module ts { export interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; + getProjectVersion?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): IScriptSnapshot; @@ -1632,7 +1633,7 @@ module ts { private fileNameToEntry: Map; private _compilationSettings: CompilerOptions; - constructor(private host: LanguageServiceHost) { + constructor(private host: LanguageServiceHost, private getCanonicalFileName: (fileName: string) => string) { // script id => script index this.fileNameToEntry = {}; @@ -1650,6 +1651,10 @@ module ts { return this._compilationSettings; } + private normalizeFileName(fileName: string): string { + return this.getCanonicalFileName(normalizeSlashes(fileName)); + } + private createEntry(fileName: string) { let entry: HostFileInformation; let scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -1661,15 +1666,15 @@ module ts { }; } - return this.fileNameToEntry[normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; } - public getEntry(fileName: string): HostFileInformation { - return lookUp(this.fileNameToEntry, normalizeSlashes(fileName)); + private getEntry(fileName: string): HostFileInformation { + return lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); } - public contains(fileName: string): boolean { - return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName)); + private contains(fileName: string): boolean { + return hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); } public getOrCreateEntry(fileName: string): HostFileInformation { @@ -1684,8 +1689,10 @@ module ts { let fileNames: string[] = []; forEachKey(this.fileNameToEntry, key => { - if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key]) - fileNames.push(key); + let entry = this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; @@ -2347,6 +2354,7 @@ module ts { let syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); let ruleProvider: formatting.RulesProvider; let program: Program; + let lastProjectVersion: string; let useCaseSensitivefileNames = false; let cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); @@ -2386,8 +2394,20 @@ module ts { } function synchronizeHostData(): void { + // perform fast check if host supports it + if (host.getProjectVersion) { + let hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + + lastProjectVersion = hostProjectVersion; + } + } + // Get a fresh cache of the host information - let hostCache = new HostCache(host); + let hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { @@ -2408,7 +2428,7 @@ module ts { let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: () => cancellationToken, - getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(), + getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitivefileNames, getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n", getDefaultLibFileName: (options) => host.getDefaultLibFileName(options), @@ -3019,46 +3039,47 @@ module ts { let containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case SyntaxKind.CommaToken: - return containingNodeKind === SyntaxKind.CallExpression // func( a, | - || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion - || containingNodeKind === SyntaxKind.NewExpression // new C(a, | - || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | - || containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, | + return containingNodeKind === SyntaxKind.CallExpression // func( a, | + || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion + || containingNodeKind === SyntaxKind.NewExpression // new C(a, | + || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | + || containingNodeKind === SyntaxKind.BinaryExpression // let x = (a, | + || containingNodeKind === SyntaxKind.FunctionType; // var x: (s: string, list| - case SyntaxKind.OpenParenToken: return containingNodeKind === SyntaxKind.CallExpression // func( | || containingNodeKind === SyntaxKind.Constructor // constructor( | || containingNodeKind === SyntaxKind.NewExpression // new C(a| - || containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedType; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case SyntaxKind.OpenBracketToken: - return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | + return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | - case SyntaxKind.ModuleKeyword: // module | - case SyntaxKind.NamespaceKeyword: // namespace | + case SyntaxKind.ModuleKeyword: // module | + case SyntaxKind.NamespaceKeyword: // namespace | return true; case SyntaxKind.DotToken: - return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.| + return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.| case SyntaxKind.OpenBraceToken: - return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | + return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | case SyntaxKind.EqualsToken: - return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a| - || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| + return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a| + || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| case SyntaxKind.TemplateHead: - return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${| + return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${| case SyntaxKind.TemplateMiddle: - return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${| + return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${| case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: case SyntaxKind.ProtectedKeyword: - return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public | + return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. @@ -3137,40 +3158,43 @@ module ts { return containingNodeKind === SyntaxKind.VariableDeclaration || containingNodeKind === SyntaxKind.VariableDeclarationList || containingNodeKind === SyntaxKind.VariableStatement || - containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, | + containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, | isFunction(containingNodeKind) || - containingNodeKind === SyntaxKind.ClassDeclaration || // class A; references: [] }[] @@ -162,8 +163,8 @@ module ts { /** * Returns a JSON-encoded value of the type: * { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[] - * - * @param fileToSearch A JSON encoded string[] containing the file names that should be + * + * @param fileToSearch A JSON encoded string[] containing the file names that should be * considered when searching. */ getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; @@ -244,7 +245,7 @@ module ts { export class LanguageServiceShimHostAdapter implements LanguageServiceHost { private files: string[]; - + constructor(private shimHost: LanguageServiceShimHost) { } @@ -255,11 +256,20 @@ module ts { public trace(s: string): void { this.shimHost.trace(s); } - + public error(s: string): void { this.shimHost.error(s); } + public getProjectVersion(): string { + if (!this.shimHost.getProjectVersion) { + // shimmed host does not support getProjectVersion + return undefined; + } + + return this.shimHost.getProjectVersion(); + } + public getCompilationSettings(): CompilerOptions { var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { @@ -322,7 +332,7 @@ module ts { } } } - + export class CoreServicesShimHostAdapter implements ParseConfigHost { constructor(private shimHost: CoreServicesShimHost) { @@ -587,7 +597,7 @@ module ts { /** * Computes the definition location and file for the symbol - * at the requested position. + * at the requested position. */ public getDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( @@ -601,7 +611,7 @@ module ts { /** * Computes the definition location of the type of the symbol - * at the requested position. + * at the requested position. */ public getTypeDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( @@ -684,8 +694,8 @@ module ts { /// COMPLETION LISTS /** - * Get a string based representation of the completions - * to provide at the given source position and providing a member completion + * Get a string based representation of the completions + * to provide at the given source position and providing a member completion * list if requested. */ public getCompletionsAtPosition(fileName: string, position: number) { diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js index cb1e18d094e..b1769ba25f9 100644 --- a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js @@ -16,6 +16,5 @@ var A; } return B; })(); - A.beez; A.beez2 = new Array(); })(A || (A = {})); diff --git a/tests/baselines/reference/NonInitializedExportInInternalModule.errors.txt b/tests/baselines/reference/NonInitializedExportInInternalModule.errors.txt new file mode 100644 index 00000000000..a7b6b5de43d --- /dev/null +++ b/tests/baselines/reference/NonInitializedExportInInternalModule.errors.txt @@ -0,0 +1,47 @@ +tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(3,8): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(4,5): error TS2304: Cannot find name 'let'. +tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(5,10): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts (3 errors) ==== + + module Inner { + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + } \ No newline at end of file diff --git a/tests/baselines/reference/NonInitializedExportInInternalModule.js b/tests/baselines/reference/NonInitializedExportInInternalModule.js new file mode 100644 index 00000000000..e49bb20d3f0 --- /dev/null +++ b/tests/baselines/reference/NonInitializedExportInInternalModule.js @@ -0,0 +1,71 @@ +//// [NonInitializedExportInInternalModule.ts] + +module Inner { + var; + let; + const; + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; +} + +//// [NonInitializedExportInInternalModule.js] +var Inner; +(function (Inner) { + var ; + let; + var ; + var A = (function () { + function A() { + } + return A; + })(); + var B; + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + var C; + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + Inner.a1 = 1; + Inner.b1 = 1; + Inner.c1 = 'a'; + Inner.d1 = 1; + var D = (function () { + function D() { + } + return D; + })(); + Inner.e1 = new D; + Inner.f1 = new D; + Inner.g1 = new D; + Inner.h1 = new D; +})(Inner || (Inner = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js index 53b065281fc..de9f86084bc 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js @@ -39,14 +39,12 @@ var A; (function (A) { var B; (function (B) { - B.x; })(B = A.B || (A.B = {})); })(A || (A = {})); var A; (function (A) { var B; (function (B) { - B.x; })(B || (B = {})); })(A || (A = {})); // ensure the right var decl is exported diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 04fb5a143c6..ed6c82bddd8 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -55,7 +55,6 @@ var E; })(E || (E = {})); var M; (function (M) { - M.a; })(M || (M = {})); var a; var b; diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.js b/tests/baselines/reference/additionOperatorWithInvalidOperands.js index a8edb4b1879..3eadd013849 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.js @@ -56,7 +56,6 @@ var E; })(E || (E = {})); var M; (function (M) { - M.a; })(M || (M = {})); var a; var b; diff --git a/tests/baselines/reference/aliasErrors.errors.txt b/tests/baselines/reference/aliasErrors.errors.txt index ffc114f80e3..c74649618ba 100644 --- a/tests/baselines/reference/aliasErrors.errors.txt +++ b/tests/baselines/reference/aliasErrors.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/aliasErrors.ts(11,12): error TS2304: Cannot find name 'no'. -tests/cases/compiler/aliasErrors.ts(12,13): error TS2304: Cannot find name 'no'. +tests/cases/compiler/aliasErrors.ts(11,12): error TS2503: Cannot find namespace 'no'. +tests/cases/compiler/aliasErrors.ts(12,13): error TS2503: Cannot find namespace 'no'. tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected. -tests/cases/compiler/aliasErrors.ts(16,12): error TS2304: Cannot find name 'undefined'. +tests/cases/compiler/aliasErrors.ts(16,12): error TS2503: Cannot find namespace 'undefined'. tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. @@ -20,10 +20,10 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h import m = no; ~~ -!!! error TS2304: Cannot find name 'no'. +!!! error TS2503: Cannot find namespace 'no'. import m2 = no.mod; ~~ -!!! error TS2304: Cannot find name 'no'. +!!! error TS2503: Cannot find namespace 'no'. import n = 5; ~ !!! error TS1003: Identifier expected. @@ -35,7 +35,7 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h !!! error TS1003: Identifier expected. import r = undefined; ~~~~~~~~~ -!!! error TS2304: Cannot find name 'undefined'. +!!! error TS2503: Cannot find namespace 'undefined'. var p = new provide.Provide(); diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index fb909181529..c93acb43fa6 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -19,7 +19,6 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] -exports.id; //// [aliasUsedAsNameValue_1.js] function b(a) { return null; } exports.b = b; diff --git a/tests/baselines/reference/arrayLiteralSpread.js b/tests/baselines/reference/arrayLiteralSpread.js index 73a60714526..3561189671e 100644 --- a/tests/baselines/reference/arrayLiteralSpread.js +++ b/tests/baselines/reference/arrayLiteralSpread.js @@ -26,7 +26,7 @@ function f2() { //// [arrayLiteralSpread.js] function f0() { var a = [1, 2, 3]; - var a1 = a; + var a1 = a.slice(); var a2 = [1].concat(a); var a3 = [1, 2].concat(a); var a4 = a.concat([1]); diff --git a/tests/baselines/reference/arrayLiterals2ES5.js b/tests/baselines/reference/arrayLiterals2ES5.js index 0ff82e90970..6a81ab465a2 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.js +++ b/tests/baselines/reference/arrayLiterals2ES5.js @@ -93,12 +93,12 @@ var temp2 = [[1, 2, 3], ["hello", "string"]]; var temp3 = [undefined, null, undefined]; var temp4 = []; var d0 = [1, true].concat(temp); // has type (string|number|boolean)[] -var d1 = temp; // has type string[] -var d2 = temp1; -var d3 = temp1; +var d1 = temp.slice(); // has type string[] +var d2 = temp1.slice(); +var d3 = temp1.slice(); var d4 = temp.concat(temp1); -var d5 = temp3; -var d6 = temp4; -var d7 = temp1; -var d8 = [temp1]; -var d9 = [temp1].concat(["hello"]); +var d5 = temp3.slice(); +var d6 = temp4.slice(); +var d7 = temp1.slice(); +var d8 = [temp1.slice()]; +var d9 = [temp1.slice()].concat(["hello"]); diff --git a/tests/baselines/reference/arrayLiterals3.js b/tests/baselines/reference/arrayLiterals3.js index 091c6148068..4769c069988 100644 --- a/tests/baselines/reference/arrayLiterals3.js +++ b/tests/baselines/reference/arrayLiterals3.js @@ -55,6 +55,6 @@ var _a = [1, 2, "string", true], b1 = _a[0], b2 = _a[1]; var temp = ["s", "t", "r"]; var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; -var c0 = temp2; // Error -var c1 = temp1; // Error cannot assign number[] to [number, number, number] +var c0 = temp2.slice(); // Error +var c1 = temp1.slice(); // Error cannot assign number[] to [number, number, number] var c2 = temp1.concat(temp); // Error cannot assign (number|string)[] to number[] diff --git a/tests/baselines/reference/assignmentCompatability2.js b/tests/baselines/reference/assignmentCompatability2.js index 207942875bf..0c45fa378c6 100644 --- a/tests/baselines/reference/assignmentCompatability2.js +++ b/tests/baselines/reference/assignmentCompatability2.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability25.js b/tests/baselines/reference/assignmentCompatability25.js index 4f365e9049c..52cc4326eaa 100644 --- a/tests/baselines/reference/assignmentCompatability25.js +++ b/tests/baselines/reference/assignmentCompatability25.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability26.js b/tests/baselines/reference/assignmentCompatability26.js index e2ae6b766df..12479b7b8b9 100644 --- a/tests/baselines/reference/assignmentCompatability26.js +++ b/tests/baselines/reference/assignmentCompatability26.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability27.js b/tests/baselines/reference/assignmentCompatability27.js index be5b06dab7c..aeac55d9c17 100644 --- a/tests/baselines/reference/assignmentCompatability27.js +++ b/tests/baselines/reference/assignmentCompatability27.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability28.js b/tests/baselines/reference/assignmentCompatability28.js index eef6f0a5ef0..27d2f7d09d0 100644 --- a/tests/baselines/reference/assignmentCompatability28.js +++ b/tests/baselines/reference/assignmentCompatability28.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability29.js b/tests/baselines/reference/assignmentCompatability29.js index c3410a943ca..4488c518530 100644 --- a/tests/baselines/reference/assignmentCompatability29.js +++ b/tests/baselines/reference/assignmentCompatability29.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability30.js b/tests/baselines/reference/assignmentCompatability30.js index 261c86ad584..e6729ad3194 100644 --- a/tests/baselines/reference/assignmentCompatability30.js +++ b/tests/baselines/reference/assignmentCompatability30.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability31.js b/tests/baselines/reference/assignmentCompatability31.js index 152b588b72c..20aab7d823b 100644 --- a/tests/baselines/reference/assignmentCompatability31.js +++ b/tests/baselines/reference/assignmentCompatability31.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability32.js b/tests/baselines/reference/assignmentCompatability32.js index b9ddacff90c..c1656c8b426 100644 --- a/tests/baselines/reference/assignmentCompatability32.js +++ b/tests/baselines/reference/assignmentCompatability32.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability33.js b/tests/baselines/reference/assignmentCompatability33.js index 80dfcfc4f7a..f078421a65b 100644 --- a/tests/baselines/reference/assignmentCompatability33.js +++ b/tests/baselines/reference/assignmentCompatability33.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); __test2__.__val__obj = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability34.js b/tests/baselines/reference/assignmentCompatability34.js index ab324a10396..d0e04eddf3f 100644 --- a/tests/baselines/reference/assignmentCompatability34.js +++ b/tests/baselines/reference/assignmentCompatability34.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); __test2__.__val__obj = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability35.js b/tests/baselines/reference/assignmentCompatability35.js index 1b79a83146b..c1a87636e82 100644 --- a/tests/baselines/reference/assignmentCompatability35.js +++ b/tests/baselines/reference/assignmentCompatability35.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability36.js b/tests/baselines/reference/assignmentCompatability36.js index 62332f741d4..c5d274ba090 100644 --- a/tests/baselines/reference/assignmentCompatability36.js +++ b/tests/baselines/reference/assignmentCompatability36.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability37.js b/tests/baselines/reference/assignmentCompatability37.js index 8625cae42e5..8f4bf522854 100644 --- a/tests/baselines/reference/assignmentCompatability37.js +++ b/tests/baselines/reference/assignmentCompatability37.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability38.js b/tests/baselines/reference/assignmentCompatability38.js index 22096b68f25..d89f5c735d6 100644 --- a/tests/baselines/reference/assignmentCompatability38.js +++ b/tests/baselines/reference/assignmentCompatability38.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentCompatability4.js b/tests/baselines/reference/assignmentCompatability4.js index 2f7d33b8d55..7ce0f48bc18 100644 --- a/tests/baselines/reference/assignmentCompatability4.js +++ b/tests/baselines/reference/assignmentCompatability4.js @@ -19,7 +19,6 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.aa; ; __test2__.__val__aa = __test2__.aa; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index d5276e71a9b..33054009d8e 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -93,7 +93,6 @@ this = value; // identifiers: module, class, enum, function var M; (function (M) { - M.a; })(M || (M = {})); M = value; C = value; diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js index 9526cb08bef..d28dd76fcf6 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js @@ -79,7 +79,6 @@ x = ''; // Error (x) = ''; // Error var M; (function (M) { - M.y; })(M || (M = {})); M.y = 3; // OK (M).y = 3; // OK @@ -93,7 +92,6 @@ var M2; (function (M2) { var M3; (function (M3) { - M3.x; })(M3 = M2.M3 || (M2.M3 = {})); M3 = { x: 3 }; // Error })(M2 || (M2 = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js index 3ee3f28ad9e..a4012731356 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js @@ -84,7 +84,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any other type var diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index fb573a7523f..d3f8c76c6ca 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index ac439f02903..370400a7dff 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index a553712e16b..071d52e7c18 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -56,7 +56,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 21e0326f741..726f918f4e8 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -27,7 +27,6 @@ var A = (function () { })(); var A; (function (A) { - A.v; })(A || (A = {})); var Foo; (function (Foo) { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js index a8e0718f277..e6fbc48cadd 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js @@ -16,7 +16,6 @@ export class Test1 { } //// [classMemberInitializerWithLamdaScoping3_0.js] -exports.field1; //// [classMemberInitializerWithLamdaScoping3_1.js] var Test1 = (function () { function Test1(field1) { diff --git a/tests/baselines/reference/commentsBeforeVariableStatement1.js b/tests/baselines/reference/commentsBeforeVariableStatement1.js index 21705826555..1413f8bc415 100644 --- a/tests/baselines/reference/commentsBeforeVariableStatement1.js +++ b/tests/baselines/reference/commentsBeforeVariableStatement1.js @@ -6,5 +6,4 @@ export var b: number; //// [commentsBeforeVariableStatement1.js] define(["require", "exports"], function (require, exports) { /** b's comment*/ - exports.b; }); diff --git a/tests/baselines/reference/commentsExternalModules.js b/tests/baselines/reference/commentsExternalModules.js index 7f1193c7d1d..47f24f53570 100644 --- a/tests/baselines/reference/commentsExternalModules.js +++ b/tests/baselines/reference/commentsExternalModules.js @@ -67,7 +67,6 @@ define(["require", "exports"], function (require, exports) { var m1; (function (m1) { /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -98,7 +97,6 @@ define(["require", "exports"], function (require, exports) { var m4; (function (m4) { /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsExternalModules2.js b/tests/baselines/reference/commentsExternalModules2.js index cba04c8cc02..179d3f9f88e 100644 --- a/tests/baselines/reference/commentsExternalModules2.js +++ b/tests/baselines/reference/commentsExternalModules2.js @@ -67,7 +67,6 @@ define(["require", "exports"], function (require, exports) { var m1; (function (m1) { /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -98,7 +97,6 @@ define(["require", "exports"], function (require, exports) { var m4; (function (m4) { /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsExternalModules3.js b/tests/baselines/reference/commentsExternalModules3.js index ff384507b79..2572a153a14 100644 --- a/tests/baselines/reference/commentsExternalModules3.js +++ b/tests/baselines/reference/commentsExternalModules3.js @@ -66,7 +66,6 @@ export var newVar2 = new extMod.m4.m2.c(); var m1; (function (m1) { /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -97,7 +96,6 @@ var myvar = new m1.m2.c(); var m4; (function (m4) { /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsModules.js b/tests/baselines/reference/commentsModules.js index 7607e6e050c..4406e609ead 100644 --- a/tests/baselines/reference/commentsModules.js +++ b/tests/baselines/reference/commentsModules.js @@ -102,7 +102,6 @@ new m7.m8.m9.c(); var m1; (function (m1) { /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; diff --git a/tests/baselines/reference/complicatedPrivacy.js b/tests/baselines/reference/complicatedPrivacy.js index 3d5b321a36f..7f431f3d136 100644 --- a/tests/baselines/reference/complicatedPrivacy.js +++ b/tests/baselines/reference/complicatedPrivacy.js @@ -163,7 +163,6 @@ var m1; return C5; })(); m1.C5 = C5; - m1.v2; })(m1 || (m1 = {})); var C2 = (function () { function C2() { diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index 6e355e136e3..4c5c050dc83 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -156,7 +156,6 @@ this += value; // identifiers: module, class, enum, function var M; (function (M) { - M.a; })(M || (M = {})); M *= value; M += value; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 5d607c8f5b2..2818793948f 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,4 +1,5 @@ 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. @@ -82,7 +83,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (82 errors) ==== +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ==== declare module "fs" { export class File { constructor(filename: string); @@ -96,6 +97,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS import fs = module("fs"); ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~~~~~~ +!!! error TS2503: Cannot find namespace 'module'. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 75b98b16c33..a763b2b6544 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -283,7 +283,6 @@ var C4T5 = (function () { // CONTEXT: Module property assignment var C5T5; (function (C5T5) { - C5T5.foo; C5T5.foo = function (i, s) { return s; }; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index a8835dc965d..fc84d1dc318 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;;IACtCA;QACIC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;;IAGjCC;QACIC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;cACX,CAAsB,IAAGC,CAACA;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;;IACZC,eAAYA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;;IACtCA;QACIC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;;IAGjCC;QACIC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IAETE,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;cACX,CAAsB,IAAGC,CAACA;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;;IACZC,eAAYA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 085f6a439ff..b6b4c18b289 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -1109,6 +1109,7 @@ sourceFile:contextualTyping.ts 3 > ^^^^ 4 > ^^ 5 > ^ +6 > ^^^^^^^^^^^^^^^-> 1-> 2 >module 3 > C5T5 @@ -1120,19 +1121,6 @@ sourceFile:contextualTyping.ts 4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) 5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- ->>> C5T5.foo; -1 >^^^^ -2 > ^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > - > export var -2 > foo: (i: number, s: string) => string -3 > ; -1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) ---- >>> C5T5.foo = function (i, s) { 1->^^^^ 2 > ^^^^^^^^ @@ -1142,6 +1130,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 1-> + > export var foo: (i: number, s: string) => string; > 2 > foo 3 > = @@ -1149,13 +1138,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(52, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(52, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(52, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(52, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(52, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1169,11 +1158,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(53, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(53, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(53, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(53, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(53, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1184,9 +1173,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(54, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(54, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(54, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1210,13 +1199,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(55, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(55, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(55, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(55, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(55, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(55, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(55, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1228,9 +1217,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(56, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(56, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(56, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ @@ -1241,9 +1230,9 @@ sourceFile:contextualTyping.ts >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(57, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(57, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(57, 10) Source(74, 31) + SourceIndex(0) --- >>>c6t5 = function (n) { return ({}); }; 1-> @@ -1277,21 +1266,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) -6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) -7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) -8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) -9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) -10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) -11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) -12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) -13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) -14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) -15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) +1->Emitted(58, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(58, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(58, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(58, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(58, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(58, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(58, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(58, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(58, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(58, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(58, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(58, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(58, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(58, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment 1 > @@ -1303,9 +1292,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Array index assignment -1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(59, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(59, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(59, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1316,9 +1305,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(60, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(60, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(60, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1350,20 +1339,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(61, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(61, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(61, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(61, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(61, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(61, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(61, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(61, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(61, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(61, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(61, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(61, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(61, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(61, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1424,14 +1413,14 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(62, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(62, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(62, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(62, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(62, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(62, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(62, 18) Source(120, 24) + SourceIndex(0) --- >>>objc8.t1 = (function (s) { return s; }); 1-> @@ -1470,23 +1459,23 @@ sourceFile:contextualTyping.ts 15> } 16> ) 17> ; -1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) -9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) -10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) -11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) -12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) -13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) -14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) -15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) -16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) -17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) +1->Emitted(63, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(63, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(63, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(63, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(63, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(63, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(63, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(63, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(63, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(63, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(63, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(63, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(63, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(63, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(63, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(63, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(63, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ 1 > @@ -1502,12 +1491,12 @@ sourceFile:contextualTyping.ts 4 > t2 5 > = 6 > ( -1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(64, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(64, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1519,10 +1508,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(65, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(65, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(65, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(65, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1533,9 +1522,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(66, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(66, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(66, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1554,13 +1543,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(67, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(67, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(67, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(67, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(67, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(67, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(67, 15) Source(126, 15) + SourceIndex(0) --- >>>objc8.t4 = function () { return ({}); }; 1-> @@ -1595,21 +1584,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) -6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) -7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) -8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) -9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) -10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) -11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) -12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) -13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) -14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) -15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) +1->Emitted(68, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(68, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(68, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(68, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(68, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(68, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(68, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(68, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(68, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(68, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(68, 41) Source(127, 45) + SourceIndex(0) --- >>>objc8.t5 = function (n) { return ({}); }; 1-> @@ -1648,23 +1637,23 @@ sourceFile:contextualTyping.ts 15> 16> } 17> ; -1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) -8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) -9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) -10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) -11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) -12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) -13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) -14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) -15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) -16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) -17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) +1->Emitted(69, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(69, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(69, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(69, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(69, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(69, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(69, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(69, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(69, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(69, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(69, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(69, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(69, 42) Source(128, 46) + SourceIndex(0) --- >>>objc8.t6 = function (n, s) { return ({}); }; 1-> @@ -1706,25 +1695,25 @@ sourceFile:contextualTyping.ts 17> 18> } 19> ; -1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) -10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) -11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) -12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) -13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) -14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) -15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) -16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) -17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) -18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) -19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) +1->Emitted(70, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(70, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(70, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(70, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(70, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(70, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(70, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(70, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(70, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(70, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(70, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(70, 45) Source(129, 49) + SourceIndex(0) --- >>>objc8.t7 = function (n) { return n; }; 1 > @@ -1759,21 +1748,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) -8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) -9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) -10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) -11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) -12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) -13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) -14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) -15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) +1 >Emitted(71, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(71, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(71, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(71, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(71, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(71, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(71, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(71, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(71, 39) Source(130, 45) + SourceIndex(0) --- >>>objc8.t8 = function (n) { return n; }; 1-> @@ -1808,21 +1797,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) -8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) -9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) -10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) -11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) -12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) -13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) -14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) -15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) +1->Emitted(72, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(72, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(72, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(72, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(72, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(72, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(72, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(72, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(72, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; 1 > @@ -1849,17 +1838,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(73, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(73, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(73, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(73, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(73, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(73, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(73, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1894,21 +1883,21 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(74, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(74, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(74, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(74, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(74, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(74, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(74, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(74, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(74, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(74, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(74, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(74, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(74, 26) Source(134, 37) + SourceIndex(0) --- >>>objc8.t11 = [function (n, s) { return s; }]; 1-> @@ -1950,25 +1939,25 @@ sourceFile:contextualTyping.ts 17> } 18> ] 19> ; -1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) -11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) -12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) -13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) -14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) -15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) -16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) -17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) -18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) -19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) +1->Emitted(75, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(75, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(75, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(75, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(75, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(75, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(75, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(75, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(75, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(75, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(75, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(75, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(75, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(75, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { 1 > @@ -1983,11 +1972,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > t12 5 > = -1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(76, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2003,12 +1992,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(77, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(77, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(77, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(77, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(77, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(77, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2017,8 +2006,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(78, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(78, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2035,12 +2024,12 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(79, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(79, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(79, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(79, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(79, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(79, 14) Source(139, 20) + SourceIndex(0) --- >>> f: function (i, s) { return s; } 1->^^^^ @@ -2072,20 +2061,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) -8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) -9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) -10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) -11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) -12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) -13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) -14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) +1->Emitted(80, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(80, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(80, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(80, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(80, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(80, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(80, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(80, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(80, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(80, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(80, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(80, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(80, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(80, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2096,9 +2085,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(81, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(81, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(81, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2114,12 +2103,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(82, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(82, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(82, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(82, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(82, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(82, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2131,10 +2120,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(83, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(83, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(83, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(83, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2145,9 +2134,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(84, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(84, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(84, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2158,9 +2147,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(85, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(85, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(85, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^^^^^^ @@ -2172,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > f: (n: number) => IFoo 3 > ) { 4 > } -1 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) -2 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) -3 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) name (c9t5) -4 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) name (c9t5) +1 >Emitted(86, 15) Source(146, 15) + SourceIndex(0) +2 >Emitted(86, 16) Source(146, 37) + SourceIndex(0) +3 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5) +4 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5) --- >>>; 1 > @@ -2183,8 +2172,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(87, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(87, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2199,11 +2188,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(88, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(88, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(88, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(88, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(88, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2221,13 +2210,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(89, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(89, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(89, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(89, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(89, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(89, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(89, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2240,10 +2229,10 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(90, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(90, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(90, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(90, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> @@ -2256,9 +2245,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Return statement -1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(91, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(91, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(91, 29) Source(151, 29) + SourceIndex(0) --- >>>var c10t5 = function () { return function (n) { return ({}); }; }; 1->^^^^ @@ -2304,27 +2293,27 @@ sourceFile:contextualTyping.ts 19> 20> } 21> ; -1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) -4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) -5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) -6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) -7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) -8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) -9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) -10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) -11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) -12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) -13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) -14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) -15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) -16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) -17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) -18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) -19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) -20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) -21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) +1->Emitted(92, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(92, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(92, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(92, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(92, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(92, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(92, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(92, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(92, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(92, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(92, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(92, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(92, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(92, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(92, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(92, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(92, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(92, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(92, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(92, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(92, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class 1 > @@ -2337,9 +2326,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Newing a class -1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(93, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(93, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(93, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { >>> function C11t5(f) { @@ -2350,9 +2339,9 @@ sourceFile:contextualTyping.ts >class C11t5 { 2 > constructor( 3 > f: (n: number) => IFoo -1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -3 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(95, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(95, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +3 >Emitted(95, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2360,16 +2349,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(96, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(96, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(97, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(97, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2380,10 +2369,10 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(98, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(98, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(98, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > @@ -2391,8 +2380,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(99, 2) Source(155, 57) + SourceIndex(0) --- >>>var i = new C11t5(function (n) { return ({}); }); 1-> @@ -2436,26 +2425,26 @@ sourceFile:contextualTyping.ts 18> } 19> ) 20> ; -1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) -10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) -11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) -12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) -13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) -14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) -15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) -16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) -17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) -18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) -19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) -20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) +1->Emitted(100, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(100, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(100, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(100, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(100, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(100, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(100, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(100, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(100, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(100, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(100, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(100, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(100, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(100, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(100, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(100, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(100, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(100, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(100, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(100, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression 1 > @@ -2468,9 +2457,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Type annotated expression -1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(101, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(101, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(101, 38) Source(158, 38) + SourceIndex(0) --- >>>var c12t1 = (function (s) { return s; }); 1->^^^^ @@ -2504,21 +2493,21 @@ sourceFile:contextualTyping.ts 13> } 14> ) 15> ; -1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) -7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) -8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) -9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) -10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) -11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) -12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) -13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) -14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) -15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) +1->Emitted(102, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(102, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(102, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(102, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(102, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(102, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(102, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(102, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(102, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(102, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(102, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(102, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(102, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(102, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(102, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ 1 > @@ -2532,11 +2521,11 @@ sourceFile:contextualTyping.ts 3 > c12t2 4 > = 5 > ( -1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(103, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(103, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(103, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(103, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(103, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2548,10 +2537,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(104, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(104, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(104, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(104, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2562,9 +2551,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(105, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(105, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(105, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2581,12 +2570,12 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(106, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(106, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(106, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(106, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(106, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(106, 16) Source(163, 27) + SourceIndex(0) --- >>>var c12t4 = function () { return ({}); }; 1-> @@ -2619,20 +2608,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) -5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) -6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) -7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) -8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) -9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) -10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) -11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) -12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) -13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) -14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) +1->Emitted(107, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(107, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(107, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(107, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(107, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(107, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(107, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(107, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(107, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(107, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(107, 42) Source(164, 59) + SourceIndex(0) --- >>>var c12t5 = function (n) { return ({}); }; 1-> @@ -2669,22 +2658,22 @@ sourceFile:contextualTyping.ts 14> 15> } 16> ; -1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) -7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) -8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) -9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) -10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) -11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) -12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) -13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) -14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) -15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) -16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) +1->Emitted(108, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(108, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(108, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(108, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(108, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(108, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(108, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(108, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(108, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(108, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(108, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(108, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(108, 43) Source(165, 69) + SourceIndex(0) --- >>>var c12t6 = function (n, s) { return ({}); }; 1-> @@ -2724,24 +2713,24 @@ sourceFile:contextualTyping.ts 16> 17> } 18> ; -1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) -9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) -10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) -11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) -12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) -13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) -14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) -15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) -16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) -17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) -18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) +1->Emitted(109, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(109, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(109, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(109, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(109, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(109, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(109, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(109, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(109, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(109, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(109, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(109, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(109, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(109, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(109, 46) Source(166, 83) + SourceIndex(0) --- >>>var c12t7 = function (n) { return n; }; 1 > @@ -2777,20 +2766,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) -7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) -8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) -9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) -10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) -11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) -12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) -13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) -14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) +1 >Emitted(110, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(110, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(110, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(110, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(110, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(110, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(110, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(110, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(110, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(110, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(110, 40) Source(170, 36) + SourceIndex(0) --- >>>var c12t8 = function (n) { return n; }; 1-> @@ -2823,20 +2812,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) -7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) -8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) -9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) -10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) -11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) -12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) -13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) -14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) +1->Emitted(111, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(111, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(111, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(111, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(111, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(111, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(111, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(111, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(111, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(111, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(111, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; 1 > @@ -2861,16 +2850,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(112, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(112, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(112, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(112, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(112, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(112, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(112, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -2903,20 +2892,20 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(113, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(113, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(113, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(113, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(113, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(113, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(113, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(113, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(113, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(113, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(113, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(113, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(113, 27) Source(174, 47) + SourceIndex(0) --- >>>var c12t11 = [function (n, s) { return s; }]; 1-> @@ -2956,24 +2945,24 @@ sourceFile:contextualTyping.ts 16> } 17> ] 18> ; -1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) -10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) -11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) -12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) -13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) -14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) -15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) -16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) -17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) -18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) +1->Emitted(114, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(114, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(114, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(114, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(114, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(114, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(114, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(114, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(114, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(114, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(114, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(114, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(114, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(114, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(114, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { 1 > @@ -2986,10 +2975,10 @@ sourceFile:contextualTyping.ts 2 >var 3 > c12t12 4 > = -1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(115, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3005,12 +2994,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(116, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(116, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(116, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(116, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(116, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(116, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3019,8 +3008,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(117, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(117, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3035,11 +3024,11 @@ sourceFile:contextualTyping.ts 3 > c12t13 4 > = 5 > ( -1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(118, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(118, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(118, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(118, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(118, 15) Source(179, 22) + SourceIndex(0) --- >>> f: function (i, s) { return s; } 1->^^^^ @@ -3071,20 +3060,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) -8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) -9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) -10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) -11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) -12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) -13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) -14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) +1->Emitted(119, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(119, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(119, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(119, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(119, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(119, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(119, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(119, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(119, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(119, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(119, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(119, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(119, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(119, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3095,9 +3084,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(120, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(120, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(120, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3111,11 +3100,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(121, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(121, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(121, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(121, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(121, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3127,10 +3116,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(122, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(122, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(122, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(122, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -3141,9 +3130,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(123, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(123, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(123, 4) Source(184, 3) + SourceIndex(0) --- >>>function EF1(a, b) { return a + b; } 1-> @@ -3181,20 +3170,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) -3 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) -4 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) -5 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) -6 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) -7 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) -8 >Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) -9 >Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) -10>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) -11>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) -12>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) -13>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) -14>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) +1->Emitted(124, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(124, 14) Source(191, 14) + SourceIndex(0) +3 >Emitted(124, 15) Source(191, 15) + SourceIndex(0) +4 >Emitted(124, 17) Source(191, 16) + SourceIndex(0) +5 >Emitted(124, 18) Source(191, 17) + SourceIndex(0) +6 >Emitted(124, 22) Source(191, 21) + SourceIndex(0) name (EF1) +7 >Emitted(124, 28) Source(191, 27) + SourceIndex(0) name (EF1) +8 >Emitted(124, 29) Source(191, 28) + SourceIndex(0) name (EF1) +9 >Emitted(124, 30) Source(191, 29) + SourceIndex(0) name (EF1) +10>Emitted(124, 33) Source(191, 30) + SourceIndex(0) name (EF1) +11>Emitted(124, 34) Source(191, 31) + SourceIndex(0) name (EF1) +12>Emitted(124, 35) Source(191, 32) + SourceIndex(0) name (EF1) +13>Emitted(124, 36) Source(191, 33) + SourceIndex(0) name (EF1) +14>Emitted(124, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); 1 > @@ -3222,17 +3211,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(125, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(125, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(125, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(125, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(125, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(125, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(125, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(125, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(125, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(125, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(125, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3259,11 +3248,11 @@ sourceFile:contextualTyping.ts 3 > x 4 > , 5 > y -1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) -3 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) -4 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) -5 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(126, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(126, 16) Source(207, 16) + SourceIndex(0) +3 >Emitted(126, 17) Source(207, 17) + SourceIndex(0) +4 >Emitted(126, 19) Source(207, 19) + SourceIndex(0) +5 >Emitted(126, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3282,13 +3271,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(127, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(127, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(127, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(127, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(127, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(127, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(127, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3307,13 +3296,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(128, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3328,11 +3317,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(129, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(129, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(129, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3341,8 +3330,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(130, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(130, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3374,19 +3363,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(131, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(131, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(131, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(131, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(131, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(131, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(131, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(131, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(131, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(131, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(131, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(131, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(131, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3414,17 +3403,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(132, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(132, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(132, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(132, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(132, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(132, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(132, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(132, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(132, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3466,25 +3455,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(133, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(133, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(133, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(133, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(133, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(133, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(133, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(133, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(133, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(133, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(133, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(133, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(133, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(133, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(133, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(133, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(133, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(133, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(133, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3495,9 +3484,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(134, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(134, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(134, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3512,11 +3501,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(135, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(135, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(135, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(135, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(135, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3529,10 +3518,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(136, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(136, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(136, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(136, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3545,10 +3534,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(137, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3567,13 +3556,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(138, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(138, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(138, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(138, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(138, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(138, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(138, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3615,25 +3604,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(139, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(139, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(139, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(139, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(139, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(139, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(139, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(139, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(139, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(139, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(139, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(139, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(139, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(139, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(139, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(139, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(139, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(139, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(139, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3641,8 +3630,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(140, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(140, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3651,8 +3640,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(141, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(141, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3672,11 +3661,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(142, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(142, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(142, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(142, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(142, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(142, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping1.js b/tests/baselines/reference/contextualTyping1.js index 7f1e12c744b..7ceb3b582e5 100644 --- a/tests/baselines/reference/contextualTyping1.js +++ b/tests/baselines/reference/contextualTyping1.js @@ -2,4 +2,4 @@ var foo: {id:number;} = {id:4}; //// [contextualTyping1.js] -var foo = { id: 4 };\n \ No newline at end of file +var foo = { id: 4 }; diff --git a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js index 1a175c3483d..a30f0f334c2 100644 --- a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js +++ b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js @@ -20,7 +20,6 @@ export var x: SubModule.m.m3.c; //// [declFileAmbientExternalModuleWithSingleExportedModule_0.js] //// [declFileAmbientExternalModuleWithSingleExportedModule_1.js] -exports.x; //// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts] diff --git a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js index f4cd27e6c01..6bd4320426c 100644 --- a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js +++ b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js @@ -24,7 +24,6 @@ export = m; //// [declFileExportAssignmentImportInternalModule.js] var m3; (function (m3) { - m3.server; })(m3 || (m3 = {})); var m = m3; module.exports = m; diff --git a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js index 75968ed1794..4d203705c4a 100644 --- a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js +++ b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js @@ -17,7 +17,6 @@ define(["require", "exports"], function (require, exports) { }); //// [declFileExportAssignmentOfGenericInterface_1.js] define(["require", "exports"], function (require, exports) { - exports.x; exports.x.a; }); diff --git a/tests/baselines/reference/declFileExportImportChain.js b/tests/baselines/reference/declFileExportImportChain.js index 547189948c9..127e8010b49 100644 --- a/tests/baselines/reference/declFileExportImportChain.js +++ b/tests/baselines/reference/declFileExportImportChain.js @@ -54,7 +54,6 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require }); //// [declFileExportImportChain_d.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/declFileExportImportChain2.js b/tests/baselines/reference/declFileExportImportChain2.js index d1299a21c5a..3a644428b8a 100644 --- a/tests/baselines/reference/declFileExportImportChain2.js +++ b/tests/baselines/reference/declFileExportImportChain2.js @@ -47,7 +47,6 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require }); //// [declFileExportImportChain2_d.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/declFileForExportedImport.js b/tests/baselines/reference/declFileForExportedImport.js index 0575ea7bfd0..af7cfa46b73 100644 --- a/tests/baselines/reference/declFileForExportedImport.js +++ b/tests/baselines/reference/declFileForExportedImport.js @@ -12,7 +12,6 @@ export import b = a; var z = b.x; //// [declFileForExportedImport_0.js] -exports.x; //// [declFileForExportedImport_1.js] /// exports.a = require('declFileForExportedImport_0'); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 35fde5bde00..dfbe147a78d 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -80,7 +80,6 @@ var C; })(); C.D = D; })(C = exports.C || (exports.C = {})); -exports.a; exports.b = C.F; exports.c = C.F2; exports.d = C.F3; diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js index 494603e286a..178511f2b78 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js @@ -34,7 +34,6 @@ module M { //// [declFileTypeAnnotationTypeAlias.js] var M; (function (M) { - M.x; var c = (function () { function c() { } @@ -61,7 +60,6 @@ var M; return Window; })(); N.Window = Window; - N.p; })(N = M.N || (M.N = {})); })(M || (M = {})); diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js index ec653c84dc9..4210cc13925 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js @@ -52,7 +52,7 @@ var M; return Window; })(); N.Window = Window; - N.p; // Should report error that W is private + // Should report error that W is private })(N = M.N || (M.N = {})); })(M || (M = {})); var M1; @@ -65,7 +65,7 @@ var M1; return Window; })(); N.Window = Window; - N.p; // No error + // No error })(N = M1.N || (M1.N = {})); })(M1 || (M1 = {})); var M2; diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js index f6bd1689e60..959d82917f7 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js @@ -51,7 +51,6 @@ var m; })(); m2.public1 = public1; })(m2 || (m2 = {})); - m.x; m.x2 = { x: new private1(), y: new m2.public1(), @@ -61,9 +60,7 @@ var m; }; m.x3 = m.x; // Function type - m.y; m.y2 = m.y; // constructor type - m.z; m.z2 = m.z; })(m || (m = {})); diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js index a097ac159db..3d4a4337ae9 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js @@ -50,11 +50,9 @@ var m; // Directly using names from this module var x; var y = new private1(); - m.k; m.l = new private1(); var x2; var y2 = new public1(); - m.k2; m.l2 = new public1(); var m2; (function (m2) { @@ -67,6 +65,5 @@ var m; })(m2 || (m2 = {})); var x3; var y3 = new m2.public2(); - m.k3; m.l3 = new m2.public2(); })(m || (m = {})); diff --git a/tests/baselines/reference/declFileTypeofModule.js b/tests/baselines/reference/declFileTypeofModule.js index b90a48fc8fa..fad0c1b25bb 100644 --- a/tests/baselines/reference/declFileTypeofModule.js +++ b/tests/baselines/reference/declFileTypeofModule.js @@ -16,13 +16,11 @@ var m2_2: typeof m2; //// [declFileTypeofModule.js] var m1; (function (m1) { - m1.c; })(m1 || (m1 = {})); var m1_1 = m1; var m1_2; var m2; (function (m2) { - m2.d; })(m2 || (m2 = {})); var m2_1 = m2; var m2_2; diff --git a/tests/baselines/reference/declarationEmitDestructuring2.errors.txt b/tests/baselines/reference/declarationEmitDestructuring2.errors.txt new file mode 100644 index 00000000000..4e8561e83ad --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuring2.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/declarationEmitDestructuring2.ts(3,13): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/declarationEmitDestructuring2.ts(3,17): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/declarationEmitDestructuring2.ts(3,23): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/declarationEmitDestructuring2.ts(3,41): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/declarationEmitDestructuring2.ts(3,44): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/declarationEmitDestructuring2.ts(3,47): error TS2300: Duplicate identifier 'c'. + + +==== tests/cases/compiler/declarationEmitDestructuring2.ts (6 errors) ==== + function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { } + function g([a, b, c, d] = [1, 2, 3, 4]) { } + function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ } + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuring2.symbols b/tests/baselines/reference/declarationEmitDestructuring2.symbols deleted file mode 100644 index 9cf35c1d866..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuring2.symbols +++ /dev/null @@ -1,40 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuring2.ts === -function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { } ->f : Symbol(f, Decl(declarationEmitDestructuring2.ts, 0, 0)) ->x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 0, 12)) ->a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 0, 24)) ->b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 0, 26)) ->c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 0, 29)) ->d : Symbol(d, Decl(declarationEmitDestructuring2.ts, 0, 32)) ->x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 0, 55)) ->y : Symbol(y, Decl(declarationEmitDestructuring2.ts, 0, 62)) - -function g([a, b, c, d] = [1, 2, 3, 4]) { } ->g : Symbol(g, Decl(declarationEmitDestructuring2.ts, 0, 85)) ->a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 1, 12)) ->b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 1, 14)) ->c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 1, 17)) ->d : Symbol(d, Decl(declarationEmitDestructuring2.ts, 1, 20)) - -function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ } ->h : Symbol(h, Decl(declarationEmitDestructuring2.ts, 1, 43)) ->a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 2, 12), Decl(declarationEmitDestructuring2.ts, 2, 40)) ->b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 2, 16), Decl(declarationEmitDestructuring2.ts, 2, 42)) ->c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 2, 22), Decl(declarationEmitDestructuring2.ts, 2, 45)) ->x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 2, 28)) ->a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 2, 12), Decl(declarationEmitDestructuring2.ts, 2, 40)) ->b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 2, 16), Decl(declarationEmitDestructuring2.ts, 2, 42)) ->c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 2, 22), Decl(declarationEmitDestructuring2.ts, 2, 45)) ->a1 : Symbol(a1, Decl(declarationEmitDestructuring2.ts, 2, 54)) ->b1 : Symbol(b1, Decl(declarationEmitDestructuring2.ts, 2, 57)) - -function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ } ->h1 : Symbol(h1, Decl(declarationEmitDestructuring2.ts, 2, 67)) ->a : Symbol(a, Decl(declarationEmitDestructuring2.ts, 3, 13)) ->b : Symbol(b, Decl(declarationEmitDestructuring2.ts, 3, 17)) ->c : Symbol(c, Decl(declarationEmitDestructuring2.ts, 3, 23)) ->x : Symbol(x, Decl(declarationEmitDestructuring2.ts, 3, 29)) ->y : Symbol(y, Decl(declarationEmitDestructuring2.ts, 3, 36)) ->a1 : Symbol(a1, Decl(declarationEmitDestructuring2.ts, 3, 56)) ->b1 : Symbol(b1, Decl(declarationEmitDestructuring2.ts, 3, 59)) - diff --git a/tests/baselines/reference/declarationEmitDestructuring2.types b/tests/baselines/reference/declarationEmitDestructuring2.types deleted file mode 100644 index 619ad13d084..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuring2.types +++ /dev/null @@ -1,68 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuring2.ts === -function f({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]} = { x: 10, y: [2, 4, 6, 8] }) { } ->f : ({x = 10, y: [a, b, c, d] = [1, 2, 3, 4]}?: { x: number; y: [number, number, number, number]; }) => void ->x : number ->10 : number ->y : any ->a : number ->b : number ->c : number ->d : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number ->{ x: 10, y: [2, 4, 6, 8] } : { x: number; y: [number, number, number, number]; } ->x : number ->10 : number ->y : [number, number, number, number] ->[2, 4, 6, 8] : [number, number, number, number] ->2 : number ->4 : number ->6 : number ->8 : number - -function g([a, b, c, d] = [1, 2, 3, 4]) { } ->g : ([a, b, c, d]?: [number, number, number, number]) => void ->a : number ->b : number ->c : number ->d : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number - -function h([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]){ } ->h : ([a, [b], [[c]], {x = 10, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], { x?: number; y: [any, any, any]; z: { a1: any; b1: any; }; }]) => void ->a : any ->b : any ->c : any ->x : number ->10 : number ->y : any ->a : any ->b : any ->c : any ->z : any ->a1 : any ->b1 : any - -function h1([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]){ } ->h1 : ([a, [b], [[c]], {x = 10, y = [1, 2, 3], z: {a1, b1}}]: [any, [any], [[any]], { x?: number; y?: number[]; z: { a1: any; b1: any; }; }]) => void ->a : any ->b : any ->c : any ->x : number ->10 : number ->y : number[] ->[1, 2, 3] : number[] ->1 : number ->2 : number ->3 : number ->z : any ->a1 : any ->b1 : any - diff --git a/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js b/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js index 9b580bcd7a4..b82766e2834 100644 --- a/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js +++ b/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js @@ -22,7 +22,6 @@ var m; })(); c_1.c = c; })(c = m.c || (m.c = {})); - m.a; })(m || (m = {})); module.exports = m; diff --git a/tests/baselines/reference/declarationEmit_nameConflicts2.js b/tests/baselines/reference/declarationEmit_nameConflicts2.js index 2a228080c68..e7b145877f8 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts2.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts2.js @@ -32,7 +32,6 @@ var X; base.C = C; var M; (function (M) { - M.v; })(M = base.M || (base.M = {})); (function (E) { })(base.E || (base.E = {})); diff --git a/tests/baselines/reference/declarationEmit_nameConflicts3.js b/tests/baselines/reference/declarationEmit_nameConflicts3.js index 8f4fa686e44..db5a0a05cfd 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts3.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts3.js @@ -74,7 +74,7 @@ var M; D[D["f"] = 0] = "f"; })(P.D || (P.D = {})); var D = P.D; - P.v; // ok + // ok P.w = M.D.f; // error, should be typeof M.D.f P.x = M.C.f; // error, should be typeof M.C.f P.x = M.E.f; // error, should be typeof M.E.f diff --git a/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js index 9d6ab935fdb..55535e9ec29 100644 --- a/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js +++ b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js @@ -9,7 +9,7 @@ export module M { //// [declarationEmit_nameConflictsWithAlias.js] var M; (function (M) { - M.w; // Gets emitted as C.I, which is the wrong interface + // Gets emitted as C.I, which is the wrong interface })(M = exports.M || (exports.M = {})); diff --git a/tests/baselines/reference/declareModifierOnImport1.errors.txt b/tests/baselines/reference/declareModifierOnImport1.errors.txt index 776f2c07bcb..7260a8e48f3 100644 --- a/tests/baselines/reference/declareModifierOnImport1.errors.txt +++ b/tests/baselines/reference/declareModifierOnImport1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS1079: A 'declare' modifier cannot be used with an import declaration. -tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot find name 'b'. +tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2503: Cannot find namespace 'b'. ==== tests/cases/compiler/declareModifierOnImport1.ts (2 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot fin ~~~~~~~ !!! error TS1079: A 'declare' modifier cannot be used with an import declaration. ~ -!!! error TS2304: Cannot find name 'b'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/decoratedClassFromExternalModule.js b/tests/baselines/reference/decoratedClassFromExternalModule.js index 36cffbb6677..163a4a094b4 100644 --- a/tests/baselines/reference/decoratedClassFromExternalModule.js +++ b/tests/baselines/reference/decoratedClassFromExternalModule.js @@ -21,7 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, function decorate() { } let Decorated = class { }; -Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true }); Decorated = __decorate([ decorate ], Decorated); diff --git a/tests/baselines/reference/decoratorOnImportEquals1.js b/tests/baselines/reference/decoratorOnImportEquals1.js index 440fdb99bce..9ad94768331 100644 --- a/tests/baselines/reference/decoratorOnImportEquals1.js +++ b/tests/baselines/reference/decoratorOnImportEquals1.js @@ -13,5 +13,4 @@ module M2 { //// [decoratorOnImportEquals1.js] var M1; (function (M1) { - M1.X; })(M1 || (M1 = {})); diff --git a/tests/baselines/reference/decoratorOnImportEquals2.js b/tests/baselines/reference/decoratorOnImportEquals2.js index 7db2da6b2c2..5f54f0b4ee6 100644 --- a/tests/baselines/reference/decoratorOnImportEquals2.js +++ b/tests/baselines/reference/decoratorOnImportEquals2.js @@ -10,5 +10,4 @@ import lib = require('./decoratorOnImportEquals2_0'); declare function dec(target: T): T; //// [decoratorOnImportEquals2_0.js] -exports.X; //// [decoratorOnImportEquals2_1.js] diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherType.js b/tests/baselines/reference/decrementOperatorWithAnyOtherType.js index 34ea154daa6..155c7cede22 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherType.js @@ -61,7 +61,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js index 8e4f927a920..5b717d0669c 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js @@ -93,7 +93,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/decrementOperatorWithNumberType.js b/tests/baselines/reference/decrementOperatorWithNumberType.js index 85ed9ca548a..98f9b9d8fde 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberType.js +++ b/tests/baselines/reference/decrementOperatorWithNumberType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 34e862063ce..00a613a16f6 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -59,7 +59,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); //number type var diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 2be74a64d8f..9ce6d2320be 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -66,7 +66,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 430f9af963f..dfc828dcb28 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.js b/tests/baselines/reference/defaultArgsInFunctionExpressions.js index 3f77c4430e8..d9cae93344f 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.js +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.js @@ -62,7 +62,6 @@ var f5 = function (a) { }; var U; (function (U) { - U.x; })(U || (U = {})); var f6 = function (t) { if (t === void 0) { t = T; } diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.js b/tests/baselines/reference/deleteOperatorWithAnyOtherType.js index e2a2be4d9aa..03558d41e87 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.js @@ -83,7 +83,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index b0a60a23744..2b390f2dc0f 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index bb70c55024d..024fc850cc4 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index 79246e27725..9dcf113b4b2 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.js index bf71064264a..4f071b5e5ec 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.js +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.js @@ -88,7 +88,7 @@ var _e = foo(), b6 = _e[0], b7 = _e[1]; var b8 = foo().slice(0); // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. var temp = [1, 2, 3]; -var _f = temp, c0 = _f[0], c1 = _f[1]; +var _f = temp.slice(), c0 = _f[0], c1 = _f[1]; var c2 = [][0]; var _g = [[[]], [[[[]]]]], c3 = _g[0][0][0], c4 = _g[1][0][0][0][0]; var _h = [[1], true], c5 = _h[0][0], c6 = _h[1]; diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.js index fdbf47fd970..223090ea8ca 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.js +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.js @@ -50,8 +50,8 @@ var _c = bar(), _d = _c[0], b3 = _d === void 0 ? "string" : _d, b4 = _c[1], b5 = // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. var temp = [1, 2, 3]; -var _e = temp, c0 = _e[0], c1 = _e[1]; // Error -var _f = temp, c2 = _f[0], c3 = _f[1]; // Error +var _e = temp.slice(), c0 = _e[0], c1 = _e[1]; // Error +var _f = temp.slice(), c2 = _f[0], c3 = _f[1]; // Error function foo(idx) { return { 2: true diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES6.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration1ES6.errors.txt new file mode 100644 index 00000000000..e900b9be393 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES6.errors.txt @@ -0,0 +1,111 @@ +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,18): error TS2300: Duplicate identifier 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,26): error TS2300: Duplicate identifier 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts(96,34): error TS2300: Duplicate identifier 'number'. + + +==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts (3 errors) ==== + // Conformance for emitting ES6 + + // A parameter declaration may specify either an identifier or a binding pattern. + // The identifiers specified in parameter declarations and binding patterns + // in a parameter list must be unique within that parameter list. + + // If the declaration includes a type annotation, the parameter is of that type + function a1([a, b, [[c]]]: [number, number, string[][]]) { } + function a2(o: { x: number, a: number }) { } + function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { }; + function a4({x, a}: { x: number, a: number }) { } + + a1([1, 2, [["world"]]]); + a1([1, 2, [["world"]], 3]); + + + // If the declaration includes an initializer expression (which is permitted only + // when the parameter list occurs in conjunction with a function body), + // the parameter type is the widened form (section 3.11) of the type of the initializer expression. + + function b1(z = [undefined, null]) { }; + function b2(z = null, o = { x: 0, y: undefined }) { } + function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { } + + interface F1 { + b5(z, y, [, a, b], {p, m: { q, r}}); + } + + function b6([a, z, y] = [undefined, null, undefined]) { } + function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } + + b1([1, 2, 3]); // z is widen to the type any[] + b2("string", { x: 200, y: "string" }); + b2("string", { x: 200, y: true }); + + + // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) + enum Foo { a } + function c0({z: {x, y: {j}}}) { } + function c1({z} = { z: 10 }) { } + function c2({z = 10}) { } + function c3({b}: { b: number|string} = { b: "hello" }) { } + function c5([a, b, [[c]]]) { } + function c6([a, b, [[c=1]]]) { } + + c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} } + c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} } + + c1(); // Implied type is {z:number}? + c1({ z: 1 }) // Implied type is {z:number}? + + c2({}); // Implied type is {z?: number} + c2({z:1}); // Implied type is {z?: number} + + c3({ b: 1 }); // Implied type is { b: number|string }. + + c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] + c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] + + + // A parameter can be marked optional by following its name or binding pattern with a question mark (?) + // or by including an initializer. + + interface F2 { + d3([a, b, c]?); + d4({x, y, z}?); + e0([a, b, c]); + } + + class C2 implements F2 { + constructor() { } + d3() { } + d4() { } + e0([a, b, c]) { } + } + + class C3 implements F2 { + d3([a, b, c]) { } + d4({x, y, z}) { } + e0([a, b, c]) { } + } + + function d5({x, y} = { x: 1, y: 2 }) { } + d5(); // Parameter is optional as its declaration included an initializer + + // Destructuring parameter declarations do not permit type annotations on the individual binding patterns, + // as such annotations would conflict with the already established meaning of colons in object literals. + // Type annotations must instead be written on the top- level parameter declaration + + function e1({x: number}) { } // x has type any NOT number + function e2({x}: { x: number }) { } // x is type number + function e3({x}: { x?: number }) { } // x is an optional with type number + function e4({x: [number,string,any] }) { } // x has type [any, any, any] + function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] + + function e6({x: [number, number, number]}) { } // error, duplicate identifier; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. + + + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES6.js b/tests/baselines/reference/destructuringParameterDeclaration1ES6.js index 6310a8f638e..f5c79c5fe88 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES6.js +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES6.js @@ -94,7 +94,7 @@ function e3({x}: { x?: number }) { } // x is an optional with type number function e4({x: [number,string,any] }) { } // x has type [any, any, any] function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] -function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier; +function e6({x: [number, number, number]}) { } // error, duplicate identifier; @@ -166,4 +166,4 @@ function e2({ x }) { } // x is type number function e3({ x }) { } // x is an optional with type number function e4({ x: [number, string, any] }) { } // x has type [any, any, any] function e5({ x: [a, b, c] }) { } // x has type [any, any, any] -function e6({ x: [number, number, number] }) { } // should be an error, duplicate identifier; +function e6({ x: [number, number, number] }) { } // error, duplicate identifier; diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES6.symbols b/tests/baselines/reference/destructuringParameterDeclaration1ES6.symbols deleted file mode 100644 index 3267d4470db..00000000000 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES6.symbols +++ /dev/null @@ -1,314 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts === -// Conformance for emitting ES6 - -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. - -// If the declaration includes a type annotation, the parameter is of that type -function a1([a, b, [[c]]]: [number, number, string[][]]) { } ->a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 7, 13)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 7, 15)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 7, 21)) - -function a2(o: { x: number, a: number }) { } ->a2 : Symbol(a2, Decl(destructuringParameterDeclaration1ES6.ts, 7, 60)) ->o : Symbol(o, Decl(destructuringParameterDeclaration1ES6.ts, 8, 12)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 8, 16)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 8, 27)) - -function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { }; ->a3 : Symbol(a3, Decl(destructuringParameterDeclaration1ES6.ts, 8, 44)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 9, 13)) ->k : Symbol(k, Decl(destructuringParameterDeclaration1ES6.ts, 9, 15)) ->m : Symbol(m, Decl(destructuringParameterDeclaration1ES6.ts, 9, 23)) ->n : Symbol(n, Decl(destructuringParameterDeclaration1ES6.ts, 9, 25)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 9, 34)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 9, 36)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 9, 39)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 9, 46)) ->k : Symbol(k, Decl(destructuringParameterDeclaration1ES6.ts, 9, 57)) ->l : Symbol(l, Decl(destructuringParameterDeclaration1ES6.ts, 9, 68)) ->m : Symbol(m, Decl(destructuringParameterDeclaration1ES6.ts, 9, 73)) ->n : Symbol(n, Decl(destructuringParameterDeclaration1ES6.ts, 9, 85)) ->q : Symbol(q, Decl(destructuringParameterDeclaration1ES6.ts, 9, 98)) - -function a4({x, a}: { x: number, a: number }) { } ->a4 : Symbol(a4, Decl(destructuringParameterDeclaration1ES6.ts, 9, 127)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 10, 13)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 10, 15)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 10, 21)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 10, 32)) - -a1([1, 2, [["world"]]]); ->a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0)) - -a1([1, 2, [["world"]], 3]); ->a1 : Symbol(a1, Decl(destructuringParameterDeclaration1ES6.ts, 0, 0)) - - -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. - -function b1(z = [undefined, null]) { }; ->b1 : Symbol(b1, Decl(destructuringParameterDeclaration1ES6.ts, 13, 27)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 20, 12)) ->undefined : Symbol(undefined) - -function b2(z = null, o = { x: 0, y: undefined }) { } ->b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 21, 12)) ->o : Symbol(o, Decl(destructuringParameterDeclaration1ES6.ts, 21, 21)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 21, 27)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 21, 33)) ->undefined : Symbol(undefined) - -function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { } ->b3 : Symbol(b3, Decl(destructuringParameterDeclaration1ES6.ts, 21, 53)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 22, 17)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 22, 24)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 22, 32)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 22, 37)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 22, 46)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 22, 51)) - -interface F1 { ->F1 : Symbol(F1, Decl(destructuringParameterDeclaration1ES6.ts, 22, 67)) - - b5(z, y, [, a, b], {p, m: { q, r}}); ->b5 : Symbol(b5, Decl(destructuringParameterDeclaration1ES6.ts, 24, 14)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 25, 7)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 25, 9)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 25, 15)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 25, 18)) ->p : Symbol(p, Decl(destructuringParameterDeclaration1ES6.ts, 25, 24)) ->q : Symbol(q, Decl(destructuringParameterDeclaration1ES6.ts, 25, 31)) ->r : Symbol(r, Decl(destructuringParameterDeclaration1ES6.ts, 25, 34)) -} - -function b6([a, z, y] = [undefined, null, undefined]) { } ->b6 : Symbol(b6, Decl(destructuringParameterDeclaration1ES6.ts, 26, 1)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 28, 13)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 28, 15)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 28, 18)) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) - -function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } ->b7 : Symbol(b7, Decl(destructuringParameterDeclaration1ES6.ts, 28, 57)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 29, 14)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 29, 17)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 29, 23)) ->d : Symbol(d, Decl(destructuringParameterDeclaration1ES6.ts, 29, 25)) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) - -b1([1, 2, 3]); // z is widen to the type any[] ->b1 : Symbol(b1, Decl(destructuringParameterDeclaration1ES6.ts, 13, 27)) - -b2("string", { x: 200, y: "string" }); ->b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 32, 14)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 32, 22)) - -b2("string", { x: 200, y: true }); ->b2 : Symbol(b2, Decl(destructuringParameterDeclaration1ES6.ts, 20, 39)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 33, 14)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 33, 22)) - - -// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -enum Foo { a } ->Foo : Symbol(Foo, Decl(destructuringParameterDeclaration1ES6.ts, 33, 34)) ->a : Symbol(Foo.a, Decl(destructuringParameterDeclaration1ES6.ts, 37, 10)) - -function c0({z: {x, y: {j}}}) { } ->c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 38, 17)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 38, 24)) - -function c1({z} = { z: 10 }) { } ->c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 39, 13)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 39, 19)) - -function c2({z = 10}) { } ->c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 40, 13)) - -function c3({b}: { b: number|string} = { b: "hello" }) { } ->c3 : Symbol(c3, Decl(destructuringParameterDeclaration1ES6.ts, 40, 25)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 13)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 18)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 41, 40)) - -function c5([a, b, [[c]]]) { } ->c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 42, 13)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 42, 15)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 42, 21)) - -function c6([a, b, [[c=1]]]) { } ->c6 : Symbol(c6, Decl(destructuringParameterDeclaration1ES6.ts, 42, 30)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 43, 13)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 43, 15)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 43, 21)) - -c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} } ->c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 45, 4)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 45, 9)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 45, 15)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 45, 20)) - -c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} } ->c0 : Symbol(c0, Decl(destructuringParameterDeclaration1ES6.ts, 37, 14)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 46, 4)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 46, 9)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 46, 22)) ->j : Symbol(j, Decl(destructuringParameterDeclaration1ES6.ts, 46, 27)) - -c1(); // Implied type is {z:number}? ->c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33)) - -c1({ z: 1 }) // Implied type is {z:number}? ->c1 : Symbol(c1, Decl(destructuringParameterDeclaration1ES6.ts, 38, 33)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 49, 4)) - -c2({}); // Implied type is {z?: number} ->c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32)) - -c2({z:1}); // Implied type is {z?: number} ->c2 : Symbol(c2, Decl(destructuringParameterDeclaration1ES6.ts, 39, 32)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 52, 4)) - -c3({ b: 1 }); // Implied type is { b: number|string }. ->c3 : Symbol(c3, Decl(destructuringParameterDeclaration1ES6.ts, 40, 25)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 54, 4)) - -c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] ->c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58)) - -c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] ->c5 : Symbol(c5, Decl(destructuringParameterDeclaration1ES6.ts, 41, 58)) - - -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. - -interface F2 { ->F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38)) - - d3([a, b, c]?); ->d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 63, 14)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 64, 8)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 64, 10)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 64, 13)) - - d4({x, y, z}?); ->d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 64, 19)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 65, 8)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 65, 10)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 65, 13)) - - e0([a, b, c]); ->e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 65, 19)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 66, 8)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 66, 10)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 66, 13)) -} - -class C2 implements F2 { ->C2 : Symbol(C2, Decl(destructuringParameterDeclaration1ES6.ts, 67, 1)) ->F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38)) - - constructor() { } - d3() { } ->d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 70, 21)) - - d4() { } ->d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 71, 12)) - - e0([a, b, c]) { } ->e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 72, 12)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 73, 8)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 73, 10)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 73, 13)) -} - -class C3 implements F2 { ->C3 : Symbol(C3, Decl(destructuringParameterDeclaration1ES6.ts, 74, 1)) ->F2 : Symbol(F2, Decl(destructuringParameterDeclaration1ES6.ts, 57, 38)) - - d3([a, b, c]) { } ->d3 : Symbol(d3, Decl(destructuringParameterDeclaration1ES6.ts, 76, 24)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 77, 8)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 77, 10)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 77, 13)) - - d4({x, y, z}) { } ->d4 : Symbol(d4, Decl(destructuringParameterDeclaration1ES6.ts, 77, 21)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 78, 8)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 78, 10)) ->z : Symbol(z, Decl(destructuringParameterDeclaration1ES6.ts, 78, 13)) - - e0([a, b, c]) { } ->e0 : Symbol(e0, Decl(destructuringParameterDeclaration1ES6.ts, 78, 21)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 79, 8)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 79, 10)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 79, 13)) -} - -function d5({x, y} = { x: 1, y: 2 }) { } ->d5 : Symbol(d5, Decl(destructuringParameterDeclaration1ES6.ts, 80, 1)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 82, 13)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 82, 15)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 82, 22)) ->y : Symbol(y, Decl(destructuringParameterDeclaration1ES6.ts, 82, 28)) - -d5(); // Parameter is optional as its declaration included an initializer ->d5 : Symbol(d5, Decl(destructuringParameterDeclaration1ES6.ts, 80, 1)) - -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration - -function e1({x: number}) { } // x has type any NOT number ->e1 : Symbol(e1, Decl(destructuringParameterDeclaration1ES6.ts, 83, 5)) ->number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 89, 13)) - -function e2({x}: { x: number }) { } // x is type number ->e2 : Symbol(e2, Decl(destructuringParameterDeclaration1ES6.ts, 89, 28)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 90, 13)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 90, 18)) - -function e3({x}: { x?: number }) { } // x is an optional with type number ->e3 : Symbol(e3, Decl(destructuringParameterDeclaration1ES6.ts, 90, 35)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 91, 13)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 91, 18)) - -function e4({x: [number,string,any] }) { } // x has type [any, any, any] ->e4 : Symbol(e4, Decl(destructuringParameterDeclaration1ES6.ts, 91, 36)) ->number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 92, 17)) ->string : Symbol(string, Decl(destructuringParameterDeclaration1ES6.ts, 92, 24)) ->any : Symbol(any, Decl(destructuringParameterDeclaration1ES6.ts, 92, 31)) - -function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] ->e5 : Symbol(e5, Decl(destructuringParameterDeclaration1ES6.ts, 92, 42)) ->a : Symbol(a, Decl(destructuringParameterDeclaration1ES6.ts, 93, 17)) ->b : Symbol(b, Decl(destructuringParameterDeclaration1ES6.ts, 93, 19)) ->c : Symbol(c, Decl(destructuringParameterDeclaration1ES6.ts, 93, 22)) ->x : Symbol(x, Decl(destructuringParameterDeclaration1ES6.ts, 93, 29)) - -function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier; ->e6 : Symbol(e6, Decl(destructuringParameterDeclaration1ES6.ts, 93, 64)) ->number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32)) ->number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32)) ->number : Symbol(number, Decl(destructuringParameterDeclaration1ES6.ts, 95, 17), Decl(destructuringParameterDeclaration1ES6.ts, 95, 24), Decl(destructuringParameterDeclaration1ES6.ts, 95, 32)) - - - diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES6.types b/tests/baselines/reference/destructuringParameterDeclaration1ES6.types deleted file mode 100644 index 9395fa49b5b..00000000000 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES6.types +++ /dev/null @@ -1,422 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts === -// Conformance for emitting ES6 - -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. - -// If the declaration includes a type annotation, the parameter is of that type -function a1([a, b, [[c]]]: [number, number, string[][]]) { } ->a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void ->a : number ->b : number ->c : string - -function a2(o: { x: number, a: number }) { } ->a2 : (o: { x: number; a: number; }) => void ->o : { x: number; a: number; } ->x : number ->a : number - -function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { }; ->a3 : ({j, k, l: {m, n}, q: [a, b, c]}: { j: number; k: string; l: { m: boolean; n: number; }; q: (string | number)[]; }) => void ->j : number ->k : string ->l : any ->m : boolean ->n : number ->q : any ->a : string | number ->b : string | number ->c : string | number ->j : number ->k : string ->l : { m: boolean; n: number; } ->m : boolean ->n : number ->q : (string | number)[] - -function a4({x, a}: { x: number, a: number }) { } ->a4 : ({x, a}: { x: number; a: number; }) => void ->x : number ->a : number ->x : number ->a : number - -a1([1, 2, [["world"]]]); ->a1([1, 2, [["world"]]]) : void ->a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void ->[1, 2, [["world"]]] : [number, number, string[][]] ->1 : number ->2 : number ->[["world"]] : string[][] ->["world"] : string[] ->"world" : string - -a1([1, 2, [["world"]], 3]); ->a1([1, 2, [["world"]], 3]) : void ->a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void ->[1, 2, [["world"]], 3] : [number, number, string[][], number] ->1 : number ->2 : number ->[["world"]] : string[][] ->["world"] : string[] ->"world" : string ->3 : number - - -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. - -function b1(z = [undefined, null]) { }; ->b1 : (z?: any[]) => void ->z : any[] ->[undefined, null] : null[] ->undefined : undefined ->null : null - -function b2(z = null, o = { x: 0, y: undefined }) { } ->b2 : (z?: any, o?: { x: number; y: any; }) => void ->z : any ->null : null ->o : { x: number; y: any; } ->{ x: 0, y: undefined } : { x: number; y: undefined; } ->x : number ->0 : number ->y : undefined ->undefined : undefined - -function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { } ->b3 : ({z: {x, y: {j}}}?: { z: { x: string; y: { j: number; }; }; }) => void ->z : any ->x : string ->y : any ->j : number ->{ z: { x: "hi", y: { j: 1 } } } : { z: { x: string; y: { j: number; }; }; } ->z : { x: string; y: { j: number; }; } ->{ x: "hi", y: { j: 1 } } : { x: string; y: { j: number; }; } ->x : string ->"hi" : string ->y : { j: number; } ->{ j: 1 } : { j: number; } ->j : number ->1 : number - -interface F1 { ->F1 : F1 - - b5(z, y, [, a, b], {p, m: { q, r}}); ->b5 : (z: any, y: any, [, a, b]: [any, any, any], {p, m: { q, r}}: { p: any; m: { q: any; r: any; }; }) => any ->z : any ->y : any -> : undefined ->a : any ->b : any ->p : any ->m : any ->q : any ->r : any -} - -function b6([a, z, y] = [undefined, null, undefined]) { } ->b6 : ([a, z, y]?: [undefined, null, undefined]) => void ->a : any ->z : any ->y : any ->[undefined, null, undefined] : [undefined, null, undefined] ->undefined : undefined ->null : null ->undefined : undefined - -function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } ->b7 : ([[a], b, [[c, d]]]?: [[undefined], undefined, [[undefined, undefined]]]) => void ->a : any ->b : any ->c : any ->d : any ->[[undefined], undefined, [[undefined, undefined]]] : [[undefined], undefined, [[undefined, undefined]]] ->[undefined] : [undefined] ->undefined : undefined ->undefined : undefined ->[[undefined, undefined]] : [[undefined, undefined]] ->[undefined, undefined] : [undefined, undefined] ->undefined : undefined ->undefined : undefined - -b1([1, 2, 3]); // z is widen to the type any[] ->b1([1, 2, 3]) : void ->b1 : (z?: any[]) => void ->[1, 2, 3] : number[] ->1 : number ->2 : number ->3 : number - -b2("string", { x: 200, y: "string" }); ->b2("string", { x: 200, y: "string" }) : void ->b2 : (z?: any, o?: { x: number; y: any; }) => void ->"string" : string ->{ x: 200, y: "string" } : { x: number; y: string; } ->x : number ->200 : number ->y : string ->"string" : string - -b2("string", { x: 200, y: true }); ->b2("string", { x: 200, y: true }) : void ->b2 : (z?: any, o?: { x: number; y: any; }) => void ->"string" : string ->{ x: 200, y: true } : { x: number; y: boolean; } ->x : number ->200 : number ->y : boolean ->true : boolean - - -// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -enum Foo { a } ->Foo : Foo ->a : Foo - -function c0({z: {x, y: {j}}}) { } ->c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void ->z : any ->x : any ->y : any ->j : any - -function c1({z} = { z: 10 }) { } ->c1 : ({z}?: { z: number; }) => void ->z : number ->{ z: 10 } : { z: number; } ->z : number ->10 : number - -function c2({z = 10}) { } ->c2 : ({z = 10}: { z?: number; }) => void ->z : number ->10 : number - -function c3({b}: { b: number|string} = { b: "hello" }) { } ->c3 : ({b}?: { b: string | number; }) => void ->b : string | number ->b : string | number ->{ b: "hello" } : { b: string; } ->b : string ->"hello" : string - -function c5([a, b, [[c]]]) { } ->c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void ->a : any ->b : any ->c : any - -function c6([a, b, [[c=1]]]) { } ->c6 : ([a, b, [[c=1]]]: [any, any, [[number]]]) => void ->a : any ->b : any ->c : number ->1 : number - -c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} } ->c0({z : { x: 1, y: { j: "world" } }}) : void ->c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void ->{z : { x: 1, y: { j: "world" } }} : { z: { x: number; y: { j: string; }; }; } ->z : { x: number; y: { j: string; }; } ->{ x: 1, y: { j: "world" } } : { x: number; y: { j: string; }; } ->x : number ->1 : number ->y : { j: string; } ->{ j: "world" } : { j: string; } ->j : string ->"world" : string - -c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} } ->c0({z : { x: "string", y: { j: true } }}) : void ->c0 : ({z: {x, y: {j}}}: { z: { x: any; y: { j: any; }; }; }) => void ->{z : { x: "string", y: { j: true } }} : { z: { x: string; y: { j: boolean; }; }; } ->z : { x: string; y: { j: boolean; }; } ->{ x: "string", y: { j: true } } : { x: string; y: { j: boolean; }; } ->x : string ->"string" : string ->y : { j: boolean; } ->{ j: true } : { j: boolean; } ->j : boolean ->true : boolean - -c1(); // Implied type is {z:number}? ->c1() : void ->c1 : ({z}?: { z: number; }) => void - -c1({ z: 1 }) // Implied type is {z:number}? ->c1({ z: 1 }) : void ->c1 : ({z}?: { z: number; }) => void ->{ z: 1 } : { z: number; } ->z : number ->1 : number - -c2({}); // Implied type is {z?: number} ->c2({}) : void ->c2 : ({z = 10}: { z?: number; }) => void ->{} : {} - -c2({z:1}); // Implied type is {z?: number} ->c2({z:1}) : void ->c2 : ({z = 10}: { z?: number; }) => void ->{z:1} : { z: number; } ->z : number ->1 : number - -c3({ b: 1 }); // Implied type is { b: number|string }. ->c3({ b: 1 }) : void ->c3 : ({b}?: { b: string | number; }) => void ->{ b: 1 } : { b: number; } ->b : number ->1 : number - -c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] ->c5([1, 2, [["string"]]]) : void ->c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void ->[1, 2, [["string"]]] : [number, number, [[string]]] ->1 : number ->2 : number ->[["string"]] : [[string]] ->["string"] : [string] ->"string" : string - -c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] ->c5([1, 2, [["string"]], false, true]) : void ->c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void ->[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean] ->1 : number ->2 : number ->[["string"]] : [[string]] ->["string"] : [string] ->"string" : string ->false : boolean ->true : boolean - - -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. - -interface F2 { ->F2 : F2 - - d3([a, b, c]?); ->d3 : ([a, b, c]?: [any, any, any]) => any ->a : any ->b : any ->c : any - - d4({x, y, z}?); ->d4 : ({x, y, z}?: { x: any; y: any; z: any; }) => any ->x : any ->y : any ->z : any - - e0([a, b, c]); ->e0 : ([a, b, c]: [any, any, any]) => any ->a : any ->b : any ->c : any -} - -class C2 implements F2 { ->C2 : C2 ->F2 : F2 - - constructor() { } - d3() { } ->d3 : () => void - - d4() { } ->d4 : () => void - - e0([a, b, c]) { } ->e0 : ([a, b, c]: [any, any, any]) => void ->a : any ->b : any ->c : any -} - -class C3 implements F2 { ->C3 : C3 ->F2 : F2 - - d3([a, b, c]) { } ->d3 : ([a, b, c]: [any, any, any]) => void ->a : any ->b : any ->c : any - - d4({x, y, z}) { } ->d4 : ({x, y, z}: { x: any; y: any; z: any; }) => void ->x : any ->y : any ->z : any - - e0([a, b, c]) { } ->e0 : ([a, b, c]: [any, any, any]) => void ->a : any ->b : any ->c : any -} - -function d5({x, y} = { x: 1, y: 2 }) { } ->d5 : ({x, y}?: { x: number; y: number; }) => void ->x : number ->y : number ->{ x: 1, y: 2 } : { x: number; y: number; } ->x : number ->1 : number ->y : number ->2 : number - -d5(); // Parameter is optional as its declaration included an initializer ->d5() : void ->d5 : ({x, y}?: { x: number; y: number; }) => void - -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration - -function e1({x: number}) { } // x has type any NOT number ->e1 : ({x: number}: { x: any; }) => void ->x : any ->number : any - -function e2({x}: { x: number }) { } // x is type number ->e2 : ({x}: { x: number; }) => void ->x : number ->x : number - -function e3({x}: { x?: number }) { } // x is an optional with type number ->e3 : ({x}: { x?: number; }) => void ->x : number ->x : number - -function e4({x: [number,string,any] }) { } // x has type [any, any, any] ->e4 : ({x: [number,string,any] }: { x: [any, any, any]; }) => void ->x : any ->number : any ->string : any ->any : any - -function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] ->e5 : ({x: [a, b, c]}: { x: [number, number, number]; }) => void ->x : any ->a : number ->b : number ->c : number ->x : [number, number, number] - -function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier; ->e6 : ({x: [number, number, number]}: { x: [any, any, any]; }) => void ->x : any ->number : any ->number : any ->number : any - - - diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 11af7b0d17c..12f50d6886c 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -50,9 +50,12 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'. Property 'z' is missing in type '{ x: any; y: any; c: any; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(56,8): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,18): error TS2300: Duplicate identifier 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,26): error TS2300: Duplicate identifier 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,34): error TS2300: Duplicate identifier 'number'. -==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts (19 errors) ==== +==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts (22 errors) ==== // A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. @@ -188,7 +191,13 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( // as such annotations would conflict with the already established meaning of colons in object literals. // Type annotations must instead be written on the top- level parameter declaration - function e0({x: [number, number, number]}) { } // should be an error, duplicate identifier; + function e0({x: [number, number, number]}) { } // error, duplicate identifier; + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. + ~~~~~~ +!!! error TS2300: Duplicate identifier 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.js b/tests/baselines/reference/destructuringParameterDeclaration2.js index 8033ff7eeae..dcb2c87f25b 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.js +++ b/tests/baselines/reference/destructuringParameterDeclaration2.js @@ -63,7 +63,7 @@ class C4 implements F2 { // as such annotations would conflict with the already established meaning of colons in object literals. // Type annotations must instead be written on the top- level parameter declaration -function e0({x: [number, number, number]}) { } // should be an error, duplicate identifier; +function e0({x: [number, number, number]}) { } // error, duplicate identifier; @@ -146,4 +146,4 @@ var C4 = (function () { // Type annotations must instead be written on the top- level parameter declaration function e0(_a) { var _b = _a.x, number = _b[0], number = _b[1], number = _b[2]; -} // should be an error, duplicate identifier; +} // error, duplicate identifier; diff --git a/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.errors.txt b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.errors.txt new file mode 100644 index 00000000000..d210588234d --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.errors.txt @@ -0,0 +1,75 @@ +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,13): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,17): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,21): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(2,27): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(3,14): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(3,17): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(4,14): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(4,19): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,14): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,17): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(5,22): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(6,14): error TS2300: Duplicate identifier 'd'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(6,20): error TS2300: Duplicate identifier 'd'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,14): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,21): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,27): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,34): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,39): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(7,48): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(8,14): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts(8,20): error TS2300: Duplicate identifier 'f'. + + +==== tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts (21 errors) ==== + + function f0(a, [a, [b]], {b}) { } + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + function f1([a, a]) { } + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'a'. + function f2({b}, {b}) { } + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + function f3([c,[c],[[c]]]) { } + ~ +!!! error TS2300: Duplicate identifier 'c'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + function f4({d, d:{d}}) { } + ~ +!!! error TS2300: Duplicate identifier 'd'. + ~ +!!! error TS2300: Duplicate identifier 'd'. + function f5({e, e: {e}}, {e}, [d,e, [[e]]], ...e) { } + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + function f6([f, ...f]) { } + ~ +!!! error TS2300: Duplicate identifier 'f'. + ~ +!!! error TS2300: Duplicate identifier 'f'. + function f7(a, func = (a) => { return 1 }) { } // not error \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.js b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.js new file mode 100644 index 00000000000..0c1eb5f3210 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration1.js @@ -0,0 +1,44 @@ +//// [duplicateIdentifierBindingElementInParameterDeclaration1.ts] + +function f0(a, [a, [b]], {b}) { } +function f1([a, a]) { } +function f2({b}, {b}) { } +function f3([c,[c],[[c]]]) { } +function f4({d, d:{d}}) { } +function f5({e, e: {e}}, {e}, [d,e, [[e]]], ...e) { } +function f6([f, ...f]) { } +function f7(a, func = (a) => { return 1 }) { } // not error + +//// [duplicateIdentifierBindingElementInParameterDeclaration1.js] +function f0(a, _a, _b) { + var a = _a[0], b = _a[1][0]; + var b = _b.b; +} +function f1(_a) { + var a = _a[0], a = _a[1]; +} +function f2(_a, _b) { + var b = _a.b; + var b = _b.b; +} +function f3(_a) { + var c = _a[0], c = _a[1][0], c = _a[2][0][0]; +} +function f4(_a) { + var d = _a.d, d = _a.d.d; +} +function f5(_a, _b, _c) { + var e = _a.e, e = _a.e.e; + var e = _b.e; + var d = _c[0], e = _c[1], e = _c[2][0][0]; + var e = []; + for (var _i = 3; _i < arguments.length; _i++) { + e[_i - 3] = arguments[_i]; + } +} +function f6(_a) { + var f = _a[0], f = _a.slice(1); +} +function f7(a, func) { + if (func === void 0) { func = function (a) { return 1; }; } +} // not error diff --git a/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.errors.txt b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.errors.txt new file mode 100644 index 00000000000..e3d1dc621f8 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.errors.txt @@ -0,0 +1,76 @@ +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,13): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,17): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,21): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(3,27): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(4,14): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(4,17): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(5,14): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(5,19): error TS2300: Duplicate identifier 'b'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,14): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,18): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(6,24): error TS2300: Duplicate identifier 'c'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(7,14): error TS2300: Duplicate identifier 'd'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(7,21): error TS2300: Duplicate identifier 'd'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,14): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,21): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,27): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,35): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,40): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(8,49): error TS2300: Duplicate identifier 'e'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(9,14): error TS2300: Duplicate identifier 'f'. +tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts(9,20): error TS2300: Duplicate identifier 'f'. + + +==== tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts (21 errors) ==== + + "use strict" + function f0(a, [a, [b]], {b}) { } + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + function f1([a, a]) { } + ~ +!!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS2300: Duplicate identifier 'a'. + function f2({b}, {b}) { } + ~ +!!! error TS2300: Duplicate identifier 'b'. + ~ +!!! error TS2300: Duplicate identifier 'b'. + function f3([c, [c], [[c]]]) { } + ~ +!!! error TS2300: Duplicate identifier 'c'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + ~ +!!! error TS2300: Duplicate identifier 'c'. + function f4({d, d: {d}}) { } + ~ +!!! error TS2300: Duplicate identifier 'd'. + ~ +!!! error TS2300: Duplicate identifier 'd'. + function f5({e, e: {e}}, {e}, [d, e, [[e]]], ...e) { } + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + ~ +!!! error TS2300: Duplicate identifier 'e'. + function f6([f, ...f]) { } + ~ +!!! error TS2300: Duplicate identifier 'f'. + ~ +!!! error TS2300: Duplicate identifier 'f'. + function f7(a, func = (a) => { return 1 }){ } // not error \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.js b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.js new file mode 100644 index 00000000000..e423b035d9d --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierBindingElementInParameterDeclaration2.js @@ -0,0 +1,46 @@ +//// [duplicateIdentifierBindingElementInParameterDeclaration2.ts] + +"use strict" +function f0(a, [a, [b]], {b}) { } +function f1([a, a]) { } +function f2({b}, {b}) { } +function f3([c, [c], [[c]]]) { } +function f4({d, d: {d}}) { } +function f5({e, e: {e}}, {e}, [d, e, [[e]]], ...e) { } +function f6([f, ...f]) { } +function f7(a, func = (a) => { return 1 }){ } // not error + +//// [duplicateIdentifierBindingElementInParameterDeclaration2.js] +"use strict"; +function f0(a, _a, _b) { + var a = _a[0], b = _a[1][0]; + var b = _b.b; +} +function f1(_a) { + var a = _a[0], a = _a[1]; +} +function f2(_a, _b) { + var b = _a.b; + var b = _b.b; +} +function f3(_a) { + var c = _a[0], c = _a[1][0], c = _a[2][0][0]; +} +function f4(_a) { + var d = _a.d, d = _a.d.d; +} +function f5(_a, _b, _c) { + var e = _a.e, e = _a.e.e; + var e = _b.e; + var d = _c[0], e = _c[1], e = _c[2][0][0]; + var e = []; + for (var _i = 3; _i < arguments.length; _i++) { + e[_i - 3] = arguments[_i]; + } +} +function f6(_a) { + var f = _a[0], f = _a.slice(1); +} +function f7(a, func) { + if (func === void 0) { func = function (a) { return 1; }; } +} // not error diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js index 6a567018d1f..170740458d7 100644 --- a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js +++ b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js @@ -117,7 +117,7 @@ var Foo = (function () { })(); var Foo; (function (Foo) { - Foo.x; // error for redeclaring var in a different parent + // error for redeclaring var in a different parent })(Foo || (Foo = {})); var N; (function (N) { diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.js b/tests/baselines/reference/duplicateSymbolsExportMatching.js index 89b5a210ec4..06e37d0d5bb 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.js +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.js @@ -83,9 +83,9 @@ define(["require", "exports"], function (require, exports) { var M2; (function (M2) { var v; - M2.v; // one error (visibility) + // one error (visibility) var w; - M2.w; // two errors (visibility and type mismatch) + // two errors (visibility and type mismatch) })(M2 || (M2 = {})); var M; (function (M) { diff --git a/tests/baselines/reference/emptyFile-declaration.js b/tests/baselines/reference/emptyFile-declaration.js index 83f47258925..f395099d73c 100644 --- a/tests/baselines/reference/emptyFile-declaration.js +++ b/tests/baselines/reference/emptyFile-declaration.js @@ -2,6 +2,6 @@ //// [emptyFile-declaration.js] -//# sourceMappingURL=emptyFile-declaration.js.map + //// [emptyFile-declaration.d.ts] diff --git a/tests/baselines/reference/emptyFile-declaration.js.map b/tests/baselines/reference/emptyFile-declaration.js.map deleted file mode 100644 index 2b96d268327..00000000000 --- a/tests/baselines/reference/emptyFile-declaration.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [emptyFile-declaration.js.map] -{"version":3,"file":"emptyFile-declaration.js","sourceRoot":"","sources":["emptyFile-declaration.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tests/baselines/reference/emptyFile-declaration.sourcemap.txt b/tests/baselines/reference/emptyFile-declaration.sourcemap.txt deleted file mode 100644 index 027af4c7ba0..00000000000 --- a/tests/baselines/reference/emptyFile-declaration.sourcemap.txt +++ /dev/null @@ -1,7 +0,0 @@ -=================================================================== -JsFile: emptyFile-declaration.js -mapUrl: emptyFile-declaration.js.map -sourceRoot: -sources: emptyFile-declaration.ts -=================================================================== ->>>//# sourceMappingURL=emptyFile-declaration.js.map \ No newline at end of file diff --git a/tests/baselines/reference/emptyFile-souremap.js b/tests/baselines/reference/emptyFile-souremap.js index 677037d8689..6de7361731a 100644 --- a/tests/baselines/reference/emptyFile-souremap.js +++ b/tests/baselines/reference/emptyFile-souremap.js @@ -2,6 +2,4 @@ //// [emptyFile-souremap.js] -//# sourceMappingURL=emptyFile-souremap.js.map - -//// [emptyFile-souremap.d.ts] +//# sourceMappingURL=emptyFile-souremap.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es3-amd.js b/tests/baselines/reference/es3-amd.js index 4e9fcdf7a9e..03d4a53e9c5 100644 --- a/tests/baselines/reference/es3-amd.js +++ b/tests/baselines/reference/es3-amd.js @@ -22,10 +22,3 @@ var A = (function () { }; return A; })(); -//# sourceMappingURL=es3-amd.js.map - -//// [es3-amd.d.ts] -declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es3-amd.js.map b/tests/baselines/reference/es3-amd.js.map deleted file mode 100644 index a1ccff476c6..00000000000 --- a/tests/baselines/reference/es3-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es3-amd.js.map] -{"version":3,"file":"es3-amd.js","sourceRoot":"","sources":["es3-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es3-amd.sourcemap.txt b/tests/baselines/reference/es3-amd.sourcemap.txt deleted file mode 100644 index 86ef55a1f58..00000000000 --- a/tests/baselines/reference/es3-amd.sourcemap.txt +++ /dev/null @@ -1,115 +0,0 @@ -=================================================================== -JsFile: es3-amd.js -mapUrl: es3-amd.js.map -sourceRoot: -sources: es3-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es3-amd.js -sourceFile:es3-amd.ts -------------------------------------------------------------------- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=es3-amd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es3-declaration-amd.js b/tests/baselines/reference/es3-declaration-amd.js index 2b4995d8544..12dd009cc0e 100644 --- a/tests/baselines/reference/es3-declaration-amd.js +++ b/tests/baselines/reference/es3-declaration-amd.js @@ -22,7 +22,7 @@ var A = (function () { }; return A; })(); -//# sourceMappingURL=es3-declaration-amd.js.map + //// [es3-declaration-amd.d.ts] declare class A { diff --git a/tests/baselines/reference/es3-declaration-amd.js.map b/tests/baselines/reference/es3-declaration-amd.js.map deleted file mode 100644 index 612763299c9..00000000000 --- a/tests/baselines/reference/es3-declaration-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es3-declaration-amd.js.map] -{"version":3,"file":"es3-declaration-amd.js","sourceRoot":"","sources":["es3-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es3-declaration-amd.sourcemap.txt b/tests/baselines/reference/es3-declaration-amd.sourcemap.txt deleted file mode 100644 index 7ad6f48d3ad..00000000000 --- a/tests/baselines/reference/es3-declaration-amd.sourcemap.txt +++ /dev/null @@ -1,115 +0,0 @@ -=================================================================== -JsFile: es3-declaration-amd.js -mapUrl: es3-declaration-amd.js.map -sourceRoot: -sources: es3-declaration-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es3-declaration-amd.js -sourceFile:es3-declaration-amd.ts -------------------------------------------------------------------- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=es3-declaration-amd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-amd.js b/tests/baselines/reference/es5-amd.js index cef85a00744..e33fecaed64 100644 --- a/tests/baselines/reference/es5-amd.js +++ b/tests/baselines/reference/es5-amd.js @@ -22,10 +22,3 @@ var A = (function () { }; return A; })(); -//# sourceMappingURL=es5-amd.js.map - -//// [es5-amd.d.ts] -declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es5-amd.js.map b/tests/baselines/reference/es5-amd.js.map deleted file mode 100644 index 6201673cb34..00000000000 --- a/tests/baselines/reference/es5-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-amd.js.map] -{"version":3,"file":"es5-amd.js","sourceRoot":"","sources":["es5-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-amd.sourcemap.txt b/tests/baselines/reference/es5-amd.sourcemap.txt deleted file mode 100644 index a5902f03982..00000000000 --- a/tests/baselines/reference/es5-amd.sourcemap.txt +++ /dev/null @@ -1,115 +0,0 @@ -=================================================================== -JsFile: es5-amd.js -mapUrl: es5-amd.js.map -sourceRoot: -sources: es5-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-amd.js -sourceFile:es5-amd.ts -------------------------------------------------------------------- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=es5-amd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-declaration-amd.js b/tests/baselines/reference/es5-declaration-amd.js index d942382ff2e..e180e88d514 100644 --- a/tests/baselines/reference/es5-declaration-amd.js +++ b/tests/baselines/reference/es5-declaration-amd.js @@ -22,7 +22,7 @@ var A = (function () { }; return A; })(); -//# sourceMappingURL=es5-declaration-amd.js.map + //// [es5-declaration-amd.d.ts] declare class A { diff --git a/tests/baselines/reference/es5-declaration-amd.js.map b/tests/baselines/reference/es5-declaration-amd.js.map deleted file mode 100644 index d4dfe8ac244..00000000000 --- a/tests/baselines/reference/es5-declaration-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-declaration-amd.js.map] -{"version":3,"file":"es5-declaration-amd.js","sourceRoot":"","sources":["es5-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-declaration-amd.sourcemap.txt b/tests/baselines/reference/es5-declaration-amd.sourcemap.txt deleted file mode 100644 index 59b6ba6bb0a..00000000000 --- a/tests/baselines/reference/es5-declaration-amd.sourcemap.txt +++ /dev/null @@ -1,115 +0,0 @@ -=================================================================== -JsFile: es5-declaration-amd.js -mapUrl: es5-declaration-amd.js.map -sourceRoot: -sources: es5-declaration-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-declaration-amd.js -sourceFile:es5-declaration-amd.ts -------------------------------------------------------------------- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=es5-declaration-amd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.js b/tests/baselines/reference/es5-umd.js index 0175e8e9fe8..8c68092cbc6 100644 --- a/tests/baselines/reference/es5-umd.js +++ b/tests/baselines/reference/es5-umd.js @@ -23,10 +23,3 @@ var A = (function () { }; return A; })(); -//# sourceMappingURL=es5-umd.js.map - -//// [es5-umd.d.ts] -declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es5-umd.js.map b/tests/baselines/reference/es5-umd.js.map deleted file mode 100644 index 5e29a48796e..00000000000 --- a/tests/baselines/reference/es5-umd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-umd.js.map] -{"version":3,"file":"es5-umd.js","sourceRoot":"","sources":["es5-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd.sourcemap.txt b/tests/baselines/reference/es5-umd.sourcemap.txt deleted file mode 100644 index bdbdec5fa9e..00000000000 --- a/tests/baselines/reference/es5-umd.sourcemap.txt +++ /dev/null @@ -1,115 +0,0 @@ -=================================================================== -JsFile: es5-umd.js -mapUrl: es5-umd.js.map -sourceRoot: -sources: es5-umd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-umd.js -sourceFile:es5-umd.ts -------------------------------------------------------------------- ->>>var A = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>})(); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0) ---- ->>>//# sourceMappingURL=es5-umd.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd2.js b/tests/baselines/reference/es5-umd2.js index cb0265bf92f..4267e7a3331 100644 --- a/tests/baselines/reference/es5-umd2.js +++ b/tests/baselines/reference/es5-umd2.js @@ -33,10 +33,3 @@ export class A })(); exports.A = A; }); -//# sourceMappingURL=es5-umd2.js.map - -//// [es5-umd2.d.ts] -export declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es5-umd2.js.map b/tests/baselines/reference/es5-umd2.js.map deleted file mode 100644 index 13a785b2edc..00000000000 --- a/tests/baselines/reference/es5-umd2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-umd2.js.map] -{"version":3,"file":"es5-umd2.js","sourceRoot":"","sources":["es5-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXY,SAAC,IAWb,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd2.sourcemap.txt b/tests/baselines/reference/es5-umd2.sourcemap.txt deleted file mode 100644 index bfadd9615f3..00000000000 --- a/tests/baselines/reference/es5-umd2.sourcemap.txt +++ /dev/null @@ -1,149 +0,0 @@ -=================================================================== -JsFile: es5-umd2.js -mapUrl: es5-umd2.js.map -sourceRoot: -sources: es5-umd2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-umd2.js -sourceFile:es5-umd2.ts -------------------------------------------------------------------- ->>>(function (deps, factory) { ->>> if (typeof module === 'object' && typeof module.exports === 'object') { ->>> var v = factory(require, exports); if (v !== undefined) module.exports = v; ->>> } ->>> else if (typeof define === 'function' && define.amd) { ->>> define(deps, factory); ->>> } ->>>})(["require", "exports"], function (require, exports) { ->>> var A = (function () { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1->export class A - >{ - > -1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) ---- ->>> exports.A = A; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -1-> -2 > A -3 > - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -4 > -1->Emitted(17, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(17, 14) Source(2, 15) + SourceIndex(0) -3 >Emitted(17, 18) Source(13, 2) + SourceIndex(0) -4 >Emitted(17, 19) Source(13, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=es5-umd2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd3.js b/tests/baselines/reference/es5-umd3.js index 2d18e2eecc3..3abb92f816f 100644 --- a/tests/baselines/reference/es5-umd3.js +++ b/tests/baselines/reference/es5-umd3.js @@ -33,10 +33,3 @@ export default class A })(); exports.default = A; }); -//# sourceMappingURL=es5-umd3.js.map - -//// [es5-umd3.d.ts] -export default class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es5-umd3.js.map b/tests/baselines/reference/es5-umd3.js.map deleted file mode 100644 index 8b955f11936..00000000000 --- a/tests/baselines/reference/es5-umd3.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-umd3.js.map] -{"version":3,"file":"es5-umd3.js","sourceRoot":"","sources":["es5-umd3.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAXD,mBAWC,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd3.sourcemap.txt b/tests/baselines/reference/es5-umd3.sourcemap.txt deleted file mode 100644 index afb879ac713..00000000000 --- a/tests/baselines/reference/es5-umd3.sourcemap.txt +++ /dev/null @@ -1,146 +0,0 @@ -=================================================================== -JsFile: es5-umd3.js -mapUrl: es5-umd3.js.map -sourceRoot: -sources: es5-umd3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-umd3.js -sourceFile:es5-umd3.ts -------------------------------------------------------------------- ->>>(function (deps, factory) { ->>> if (typeof module === 'object' && typeof module.exports === 'object') { ->>> var v = factory(require, exports); if (v !== undefined) module.exports = v; ->>> } ->>> else if (typeof define === 'function' && define.amd) { ->>> define(deps, factory); ->>> } ->>>})(["require", "exports"], function (require, exports) { ->>> var A = (function () { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1->export default class A - >{ - > -1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export default class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) ---- ->>> exports.default = A; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^ -1-> -2 > export default class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -3 > -1->Emitted(17, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(17, 24) Source(13, 2) + SourceIndex(0) -3 >Emitted(17, 25) Source(13, 2) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=es5-umd3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd4.js b/tests/baselines/reference/es5-umd4.js index 85683f8f3c2..058ad545f42 100644 --- a/tests/baselines/reference/es5-umd4.js +++ b/tests/baselines/reference/es5-umd4.js @@ -35,11 +35,3 @@ export = A; })(); return A; }); -//# sourceMappingURL=es5-umd4.js.map - -//// [es5-umd4.d.ts] -declare class A { - constructor(); - B(): number; -} -export = A; diff --git a/tests/baselines/reference/es5-umd4.js.map b/tests/baselines/reference/es5-umd4.js.map deleted file mode 100644 index 0a47d679ed9..00000000000 --- a/tests/baselines/reference/es5-umd4.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es5-umd4.js.map] -{"version":3,"file":"es5-umd4.js","sourceRoot":"","sources":["es5-umd4.ts"],"names":["A","A.constructor","A.B"],"mappings":";;;;;;;;IACA;QAEIA;QAGAC,CAACA;QAEMD,aAACA,GAARA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;QACLF,QAACA;IAADA,CAACA,AAXD,IAWC;IAEU,AAAX,OAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/es5-umd4.sourcemap.txt b/tests/baselines/reference/es5-umd4.sourcemap.txt deleted file mode 100644 index 9afd8effecf..00000000000 --- a/tests/baselines/reference/es5-umd4.sourcemap.txt +++ /dev/null @@ -1,143 +0,0 @@ -=================================================================== -JsFile: es5-umd4.js -mapUrl: es5-umd4.js.map -sourceRoot: -sources: es5-umd4.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es5-umd4.js -sourceFile:es5-umd4.ts -------------------------------------------------------------------- ->>>(function (deps, factory) { ->>> if (typeof module === 'object' && typeof module.exports === 'object') { ->>> var v = factory(require, exports); if (v !== undefined) module.exports = v; ->>> } ->>> else if (typeof define === 'function' && define.amd) { ->>> define(deps, factory); ->>> } ->>>})(["require", "exports"], function (require, exports) { ->>> var A = (function () { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(9, 5) Source(2, 1) + SourceIndex(0) ---- ->>> function A() { -1->^^^^^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(10, 9) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(11, 9) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(11, 10) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> A.prototype.B = function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^ -1-> - > - > public -2 > B -3 > -1->Emitted(12, 9) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(12, 22) Source(9, 13) + SourceIndex(0) name (A) -3 >Emitted(12, 25) Source(9, 5) + SourceIndex(0) name (A) ---- ->>> return 42; -1 >^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1 >public B() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1 >Emitted(13, 13) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(13, 19) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(13, 20) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(13, 22) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(13, 23) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(14, 9) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(14, 10) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>> return A; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(15, 9) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(15, 17) Source(13, 2) + SourceIndex(0) name (A) ---- ->>> })(); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^-> -1 > -2 > } -3 > -4 > class A - > { - > constructor () - > { - > - > } - > - > public B() - > { - > return 42; - > } - > } -1 >Emitted(16, 5) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(16, 6) Source(13, 2) + SourceIndex(0) name (A) -3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(16, 10) Source(13, 2) + SourceIndex(0) ---- ->>> return A; -1->^^^^ -2 > -3 > ^^^^^^^ -4 > ^ -5 > ^ -1-> - > - >export = A; -2 > -3 > export = -4 > A -5 > ; -1->Emitted(17, 5) Source(15, 12) + SourceIndex(0) -2 >Emitted(17, 5) Source(15, 1) + SourceIndex(0) -3 >Emitted(17, 12) Source(15, 10) + SourceIndex(0) -4 >Emitted(17, 13) Source(15, 11) + SourceIndex(0) -5 >Emitted(17, 14) Source(15, 12) + SourceIndex(0) ---- ->>>}); ->>>//# sourceMappingURL=es5-umd4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es6-amd.js b/tests/baselines/reference/es6-amd.js index 74f3037303e..b09f074e59f 100644 --- a/tests/baselines/reference/es6-amd.js +++ b/tests/baselines/reference/es6-amd.js @@ -21,10 +21,3 @@ class A { return 42; } } -//# sourceMappingURL=es6-amd.js.map - -//// [es6-amd.d.ts] -declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es6-amd.js.map b/tests/baselines/reference/es6-amd.js.map deleted file mode 100644 index fe234f8424b..00000000000 --- a/tests/baselines/reference/es6-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es6-amd.js.map] -{"version":3,"file":"es6-amd.js","sourceRoot":"","sources":["es6-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-amd.sourcemap.txt b/tests/baselines/reference/es6-amd.sourcemap.txt deleted file mode 100644 index 1ab547073c6..00000000000 --- a/tests/baselines/reference/es6-amd.sourcemap.txt +++ /dev/null @@ -1,91 +0,0 @@ -=================================================================== -JsFile: es6-amd.js -mapUrl: es6-amd.js.map -sourceRoot: -sources: es6-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es6-amd.js -sourceFile:es6-amd.ts -------------------------------------------------------------------- ->>>class A { -1 > -2 >^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> constructor() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> B() { -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^-> -1-> - > - > public -2 > B -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) ---- ->>> return 42; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1->() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> } -1 >^^^^ -2 > ^ -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>//# sourceMappingURL=es6-amd.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) ---- \ No newline at end of file diff --git a/tests/baselines/reference/es6-declaration-amd.js b/tests/baselines/reference/es6-declaration-amd.js index aeba23e0b6e..b1f54086969 100644 --- a/tests/baselines/reference/es6-declaration-amd.js +++ b/tests/baselines/reference/es6-declaration-amd.js @@ -21,7 +21,7 @@ class A { return 42; } } -//# sourceMappingURL=es6-declaration-amd.js.map + //// [es6-declaration-amd.d.ts] declare class A { diff --git a/tests/baselines/reference/es6-declaration-amd.js.map b/tests/baselines/reference/es6-declaration-amd.js.map deleted file mode 100644 index ca1899e03f5..00000000000 --- a/tests/baselines/reference/es6-declaration-amd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es6-declaration-amd.js.map] -{"version":3,"file":"es6-declaration-amd.js","sourceRoot":"","sources":["es6-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-declaration-amd.sourcemap.txt b/tests/baselines/reference/es6-declaration-amd.sourcemap.txt deleted file mode 100644 index 9061bc1ed7c..00000000000 --- a/tests/baselines/reference/es6-declaration-amd.sourcemap.txt +++ /dev/null @@ -1,91 +0,0 @@ -=================================================================== -JsFile: es6-declaration-amd.js -mapUrl: es6-declaration-amd.js.map -sourceRoot: -sources: es6-declaration-amd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es6-declaration-amd.js -sourceFile:es6-declaration-amd.ts -------------------------------------------------------------------- ->>>class A { -1 > -2 >^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> constructor() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> B() { -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^-> -1-> - > - > public -2 > B -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) ---- ->>> return 42; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1->() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> } -1 >^^^^ -2 > ^ -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>//# sourceMappingURL=es6-declaration-amd.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) ---- \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd.js b/tests/baselines/reference/es6-umd.js index 74cd671f5ef..af8159eeb3e 100644 --- a/tests/baselines/reference/es6-umd.js +++ b/tests/baselines/reference/es6-umd.js @@ -21,10 +21,3 @@ class A { return 42; } } -//# sourceMappingURL=es6-umd.js.map - -//// [es6-umd.d.ts] -declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es6-umd.js.map b/tests/baselines/reference/es6-umd.js.map deleted file mode 100644 index a5e82f7ccfd..00000000000 --- a/tests/baselines/reference/es6-umd.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es6-umd.js.map] -{"version":3,"file":"es6-umd.js","sourceRoot":"","sources":["es6-umd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd.sourcemap.txt b/tests/baselines/reference/es6-umd.sourcemap.txt deleted file mode 100644 index bb8281ce741..00000000000 --- a/tests/baselines/reference/es6-umd.sourcemap.txt +++ /dev/null @@ -1,91 +0,0 @@ -=================================================================== -JsFile: es6-umd.js -mapUrl: es6-umd.js.map -sourceRoot: -sources: es6-umd.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es6-umd.js -sourceFile:es6-umd.ts -------------------------------------------------------------------- ->>>class A { -1 > -2 >^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> constructor() { -1->^^^^ -2 > ^^-> -1->class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> B() { -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^-> -1-> - > - > public -2 > B -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) ---- ->>> return 42; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1->() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> } -1 >^^^^ -2 > ^ -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>//# sourceMappingURL=es6-umd.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) ---- \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.js b/tests/baselines/reference/es6-umd2.js index b12d35aacf8..416932d89bc 100644 --- a/tests/baselines/reference/es6-umd2.js +++ b/tests/baselines/reference/es6-umd2.js @@ -21,10 +21,3 @@ export class A { return 42; } } -//# sourceMappingURL=es6-umd2.js.map - -//// [es6-umd2.d.ts] -export declare class A { - constructor(); - B(): number; -} diff --git a/tests/baselines/reference/es6-umd2.js.map b/tests/baselines/reference/es6-umd2.js.map deleted file mode 100644 index 81f3d85a6cd..00000000000 --- a/tests/baselines/reference/es6-umd2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [es6-umd2.js.map] -{"version":3,"file":"es6-umd2.js","sourceRoot":"","sources":["es6-umd2.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA;IAEIA;IAGAC,CAACA;IAEMD,CAACA;QAEJE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;AACLF,CAACA;AAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.sourcemap.txt b/tests/baselines/reference/es6-umd2.sourcemap.txt deleted file mode 100644 index d032aa3d6c7..00000000000 --- a/tests/baselines/reference/es6-umd2.sourcemap.txt +++ /dev/null @@ -1,91 +0,0 @@ -=================================================================== -JsFile: es6-umd2.js -mapUrl: es6-umd2.js.map -sourceRoot: -sources: es6-umd2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/es6-umd2.js -sourceFile:es6-umd2.ts -------------------------------------------------------------------- ->>>export class A { -1 > -2 >^^^^^^^^^^^^^^^^^^^^-> -1 > - > -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) ---- ->>> constructor() { -1->^^^^ -2 > ^^-> -1->export class A - >{ - > -1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^-> -1->constructor () - > { - > - > -2 > } -1->Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor) -2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor) ---- ->>> B() { -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^-> -1-> - > - > public -2 > B -1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A) -2 >Emitted(4, 6) Source(9, 13) + SourceIndex(0) name (A) ---- ->>> return 42; -1->^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^ -5 > ^ -1->() - > { - > -2 > return -3 > -4 > 42 -5 > ; -1->Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B) -2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B) -3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B) -4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B) -5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B) ---- ->>> } -1 >^^^^ -2 > ^ -1 > - > -2 > } -1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B) -2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(7, 1) Source(13, 1) + SourceIndex(0) name (A) -2 >Emitted(7, 2) Source(13, 2) + SourceIndex(0) name (A) ---- ->>>//# sourceMappingURL=es6-umd2.js.map1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -1->Emitted(8, 1) Source(13, 2) + SourceIndex(0) ---- \ No newline at end of file diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index 7051d8d2433..5ab7dcc5a5a 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -140,11 +140,9 @@ b++; // modules var moduleType1; (function (moduleType1) { - moduleType1.baz1; })(moduleType1 || (moduleType1 = {})); var moduleType\u0032; (function (moduleType2) { - moduleType2.baz2; })(moduleType\u0032 || (moduleType\u0032 = {})); moduleType1.baz1 = 3; moduleType\u0031.baz1 = 3; diff --git a/tests/baselines/reference/exportAssignmentError.js b/tests/baselines/reference/exportAssignmentError.js index 3a9e57029a9..777a9fab048 100644 --- a/tests/baselines/reference/exportAssignmentError.js +++ b/tests/baselines/reference/exportAssignmentError.js @@ -12,7 +12,6 @@ export = M2; // should not error define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.x; })(M || (M = {})); var M2 = M; return M2; diff --git a/tests/baselines/reference/exportAssignmentInternalModule.js b/tests/baselines/reference/exportAssignmentInternalModule.js index fb9adfd5650..3426519e626 100644 --- a/tests/baselines/reference/exportAssignmentInternalModule.js +++ b/tests/baselines/reference/exportAssignmentInternalModule.js @@ -16,7 +16,6 @@ var n: number = modM.x; define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.x; })(M || (M = {})); return M; }); diff --git a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js index cb4cb3269b1..adfb85ae4bc 100644 --- a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js +++ b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js @@ -25,7 +25,6 @@ export = M; define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.server; })(M || (M = {})); return M; }); diff --git a/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt new file mode 100644 index 00000000000..ae79675d8dd --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesAMD.js b/tests/baselines/reference/exportNonInitializedVariablesAMD.js new file mode 100644 index 00000000000..3b61281eaba --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesAMD.js @@ -0,0 +1,69 @@ +//// [exportNonInitializedVariablesAMD.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesAMD.js] +define(["require", "exports"], function (require, exports) { + var ; + let; + var ; + var A = (function () { + function A() { + } + return A; + })(); + var B; + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + var C; + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports.a1 = 1; + exports.b1 = 1; + exports.c1 = 'a'; + exports.d1 = 1; + var D = (function () { + function D() { + } + return D; + })(); + exports.e1 = new D; + exports.f1 = new D; + exports.g1 = new D; + exports.h1 = new D; +}); diff --git a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt new file mode 100644 index 00000000000..65a18649af3 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js new file mode 100644 index 00000000000..c1d308b1b94 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js @@ -0,0 +1,67 @@ +//// [exportNonInitializedVariablesCommonJS.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesCommonJS.js] +var ; +let; +var ; +var A = (function () { + function A() { + } + return A; +})(); +var B; +(function (B) { + B.a = 1, B.c = 2; +})(B || (B = {})); +var C; +(function (C) { + C.a = 1, C.c = 2; +})(C || (C = {})); +// Shouldn't be filtered +exports.a1 = 1; +exports.b1 = 1; +exports.c1 = 'a'; +exports.d1 = 1; +var D = (function () { + function D() { + } + return D; +})(); +exports.e1 = new D; +exports.f1 = new D; +exports.g1 = new D; +exports.h1 = new D; diff --git a/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt new file mode 100644 index 00000000000..905d16b360f --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesES6.js b/tests/baselines/reference/exportNonInitializedVariablesES6.js new file mode 100644 index 00000000000..e4f47b2dc68 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesES6.js @@ -0,0 +1,67 @@ +//// [exportNonInitializedVariablesES6.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesES6.js] +var ; +let; +const ; +export var a; +export let b; +export var c; +export let d; +class A { +} +export var e; +export let f; +var B; +(function (B) { + B.a = 1, B.c = 2; +})(B || (B = {})); +var C; +(function (C) { + C.a = 1, C.c = 2; +})(C || (C = {})); +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1 = 'a'; +export let d1 = 1; +class D { +} +export var e1 = new D; +export let f1 = new D; +export var g1 = new D; +export let h1 = new D; diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt new file mode 100644 index 00000000000..d7aeb5d2ac0 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.js b/tests/baselines/reference/exportNonInitializedVariablesSystem.js new file mode 100644 index 00000000000..3b9c5d759dc --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.js @@ -0,0 +1,71 @@ +//// [exportNonInitializedVariablesSystem.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesSystem.js] +System.register([], function(exports_1) { + var a, b, c, d, A, e, f, B, C, a1, b1, c1, d1, D, e1, f1, g1, h1; + return { + setters:[], + execute: function() { + let; + A = (function () { + function A() { + } + return A; + })(); + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports_1("a1", a1 = 1); + exports_1("b1", b1 = 1); + exports_1("c1", c1 = 'a'); + exports_1("d1", d1 = 1); + D = (function () { + function D() { + } + return D; + })(); + exports_1("e1", e1 = new D); + exports_1("f1", f1 = new D); + exports_1("g1", g1 = new D); + exports_1("h1", h1 = new D); + } + } +}); diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt new file mode 100644 index 00000000000..eaf68e67055 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.js b/tests/baselines/reference/exportNonInitializedVariablesUMD.js new file mode 100644 index 00000000000..1e8b3ce4446 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.js @@ -0,0 +1,76 @@ +//// [exportNonInitializedVariablesUMD.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesUMD.js] +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports"], function (require, exports) { + var ; + let; + var ; + var A = (function () { + function A() { + } + return A; + })(); + var B; + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + var C; + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports.a1 = 1; + exports.b1 = 1; + exports.c1 = 'a'; + exports.d1 = 1; + var D = (function () { + function D() { + } + return D; + })(); + exports.e1 = new D; + exports.f1 = new D; + exports.g1 = new D; + exports.h1 = new D; +}); diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 11ccc037ef6..87dc16968f6 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -45,9 +45,5 @@ var foo; return C2; })(); // None of the types are exported, so per section 10.3, should all be errors - foo.e; - foo.f; - foo.g; - foo.h; })(foo || (foo = {})); var y = foo.g; // Exported variable 'y' has or is using private type 'foo.C2'. diff --git a/tests/baselines/reference/exportsAndImports1-amd.js b/tests/baselines/reference/exportsAndImports1-amd.js index fdc6d396bad..39744c7f142 100644 --- a/tests/baselines/reference/exportsAndImports1-amd.js +++ b/tests/baselines/reference/exportsAndImports1-amd.js @@ -55,7 +55,6 @@ define(["require", "exports"], function (require, exports) { exports.E = E; var M; (function (M) { - M.x; })(M || (M = {})); exports.M = M; var a = M.x; diff --git a/tests/baselines/reference/exportsAndImports1.js b/tests/baselines/reference/exportsAndImports1.js index 87cb9e0fe13..cd7db07b569 100644 --- a/tests/baselines/reference/exportsAndImports1.js +++ b/tests/baselines/reference/exportsAndImports1.js @@ -54,7 +54,6 @@ var E; exports.E = E; var M; (function (M) { - M.x; })(M || (M = {})); exports.M = M; var a = M.x; diff --git a/tests/baselines/reference/exportsAndImports3-amd.js b/tests/baselines/reference/exportsAndImports3-amd.js index f72d063e099..e816dec9f62 100644 --- a/tests/baselines/reference/exportsAndImports3-amd.js +++ b/tests/baselines/reference/exportsAndImports3-amd.js @@ -57,7 +57,6 @@ define(["require", "exports"], function (require, exports) { exports.E1 = exports.E; var M; (function (M) { - M.x; })(M = exports.M || (exports.M = {})); exports.M1 = exports.M; exports.a = M.x; diff --git a/tests/baselines/reference/exportsAndImports3.js b/tests/baselines/reference/exportsAndImports3.js index 56baead64cc..db29b62449e 100644 --- a/tests/baselines/reference/exportsAndImports3.js +++ b/tests/baselines/reference/exportsAndImports3.js @@ -56,7 +56,6 @@ var E = exports.E; exports.E1 = exports.E; var M; (function (M) { - M.x; })(M = exports.M || (exports.M = {})); exports.M1 = exports.M; exports.a = M.x; diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 9b0fbf4bcad..6dd456ab703 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -10,6 +10,5 @@ module foo { function foo(y, z) { return y; } var foo; (function (foo) { - foo.x; var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js index 76b6159f487..27961a68c73 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js @@ -14,6 +14,5 @@ var foo = (function () { })(); var foo; (function (foo) { - foo.x; var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/getEmitOutputOut.baseline b/tests/baselines/reference/getEmitOutputOut.baseline new file mode 100644 index 00000000000..9508b6d5570 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputOut.baseline @@ -0,0 +1,12 @@ +EmitSkipped: false +FileName : out.js +/// +var foo; +(function (foo) { + var bar; + (function (bar) { + var baz1 = bar.Baz.prototype; // Should emit as bar.Baz.prototype + })(bar = foo.bar || (foo.bar = {})); +})(foo || (foo = {})); +var x; + diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 4409933bb19..46bdaf827d5 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -805,7 +805,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - M.eV; function eF() { } M.eF = eF; ; @@ -822,7 +821,6 @@ define(["require", "exports"], function (require, exports) { ; ; })(M || (M = {})); - M_1.eV; function eF() { } M_1.eF = eF; ; @@ -884,7 +882,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - eM.eV; function eF() { } eM.eF = eF; ; @@ -903,7 +900,6 @@ define(["require", "exports"], function (require, exports) { })(eM = M_1.eM || (M_1.eM = {})); ; })(M || (M = {})); - exports.eV; function eF() { } exports.eF = eF; ; @@ -1014,7 +1010,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - M.eV; function eF() { } M.eF = eF; ; @@ -1031,7 +1026,6 @@ define(["require", "exports"], function (require, exports) { ; ; })(M || (M = {})); - eM_1.eV; function eF() { } eM_1.eF = eF; ; @@ -1093,7 +1087,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - eM.eV; function eF() { } eM.eF = eF; ; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index 9d4839e5e7c..fb2aa6e0d1f 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -88,7 +88,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] @@ -108,7 +107,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] @@ -118,7 +116,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js index 6f6d9367278..70244f47381 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js @@ -19,7 +19,6 @@ var B = (function () { })(); exports.B = B; //// [importDeclarationUsedAsTypeQuery_1.js] -exports.x; //// [importDeclarationUsedAsTypeQuery_require.d.ts] diff --git a/tests/baselines/reference/importOnAliasedIdentifiers.js b/tests/baselines/reference/importOnAliasedIdentifiers.js index 7034f682bf3..ceb6ebb7b2e 100644 --- a/tests/baselines/reference/importOnAliasedIdentifiers.js +++ b/tests/baselines/reference/importOnAliasedIdentifiers.js @@ -13,7 +13,6 @@ module B { //// [importOnAliasedIdentifiers.js] var A; (function (A) { - A.X; })(A || (A = {})); var B; (function (B) { diff --git a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt index 8948c67f78b..aed680b89aa 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt +++ b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot find name 'b'. +tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2503: Cannot find namespace 'b'. ==== tests/cases/compiler/importedModuleAddToGlobal.ts (1 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot f import a = A; function hello(): b.B { return null; } ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2503: Cannot find namespace 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherType.js b/tests/baselines/reference/incrementOperatorWithAnyOtherType.js index 4c9d570d07f..6cd7afc5a60 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherType.js @@ -61,7 +61,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js index 6f76fba6d8c..259dcac404e 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js @@ -90,7 +90,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/incrementOperatorWithNumberType.js b/tests/baselines/reference/incrementOperatorWithNumberType.js index 09365833e3b..cf7ce435cb0 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberType.js +++ b/tests/baselines/reference/incrementOperatorWithNumberType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index eb9cd949280..17820b7bd86 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -59,7 +59,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); //number type var diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6a974443f7b..5bdba8dfee5 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -66,7 +66,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 82bf03cd83a..baeaf9555fb 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/internalAliasInterface.js b/tests/baselines/reference/internalAliasInterface.js index d2006caf24c..aa902c2f56e 100644 --- a/tests/baselines/reference/internalAliasInterface.js +++ b/tests/baselines/reference/internalAliasInterface.js @@ -13,7 +13,6 @@ module c { //// [internalAliasInterface.js] var c; (function (c) { - c.x; })(c || (c = {})); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js index c4852ffe27a..8db0ad7f49e 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js @@ -14,7 +14,6 @@ export module c { define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js index b09f21650e4..047553fa668 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js @@ -14,7 +14,6 @@ export module c { define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js index 1d13192c928..e5ac69a44c1 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js @@ -15,7 +15,6 @@ var x: c.b; define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); var x; }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js index a771da2d789..912336068da 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js @@ -9,7 +9,6 @@ export var x: b; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.js] -exports.x; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.d.ts] diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js index bd1a83fdd85..3964e539fdf 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js @@ -10,7 +10,6 @@ export var x: b; //// [internalAliasInterfaceInsideTopLevelModuleWithoutExport.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModule.js b/tests/baselines/reference/internalAliasUninitializedModule.js index ee62a10c1ca..5233f9a790d 100644 --- a/tests/baselines/reference/internalAliasUninitializedModule.js +++ b/tests/baselines/reference/internalAliasUninitializedModule.js @@ -16,7 +16,6 @@ module c { //// [internalAliasUninitializedModule.js] var c; (function (c) { - c.x; c.x.foo(); })(c || (c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js index 5c67c835f1f..f6faee442c4 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js @@ -16,7 +16,6 @@ export module c { //// [internalAliasUninitializedModuleInsideLocalModuleWithExport.js] var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js index 6f85a346891..2ef3c5320a8 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js @@ -16,7 +16,6 @@ export module c { //// [internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js] var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js index 61d1005c9f4..ea13aae8aa1 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js @@ -20,8 +20,6 @@ export var z: c.b.I; define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); - exports.z; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js index 79bc7c6c874..edfc3be8e69 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js @@ -14,7 +14,6 @@ x.foo(); //// [internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js] define(["require", "exports"], function (require, exports) { - exports.x; exports.x.foo(); }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js index 3f626fd37ac..6e484e67cdb 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js @@ -13,7 +13,6 @@ x.foo(); //// [internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js] -exports.x; exports.x.foo(); diff --git a/tests/baselines/reference/internalAliasWithDottedNameEmit.js b/tests/baselines/reference/internalAliasWithDottedNameEmit.js index 98c8ce36a6c..0e74d7ecd4e 100644 --- a/tests/baselines/reference/internalAliasWithDottedNameEmit.js +++ b/tests/baselines/reference/internalAliasWithDottedNameEmit.js @@ -14,7 +14,6 @@ var a; (function (b) { var c; (function (c) { - c.d; })(c = b.c || (b.c = {})); })(b = a.b || (a.b = {})); })(a || (a = {})); diff --git a/tests/baselines/reference/intrinsics.js b/tests/baselines/reference/intrinsics.js index 5e608b7fd6a..736ffa020fa 100644 --- a/tests/baselines/reference/intrinsics.js +++ b/tests/baselines/reference/intrinsics.js @@ -19,7 +19,6 @@ var foo: (__proto__: number) => void; var hasOwnProperty; // Error var m1; (function (m1) { - m1.__proto__; var C = (function () { function C() { } diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt index 7794fb027d7..fb29c829947 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2304: Cannot find name 'V'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2304: Cannot find name 'C'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2304: Cannot find name 'E'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2304: Cannot find name 'I'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2503: Cannot find namespace 'I'. ==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (4 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import v = V; ~ -!!! error TS2304: Cannot find name 'V'. +!!! error TS2503: Cannot find namespace 'V'. class C { name: string; @@ -19,7 +19,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import c = C; ~ -!!! error TS2304: Cannot find name 'C'. +!!! error TS2503: Cannot find namespace 'C'. enum E { Red, Blue @@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import e = E; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. interface I { id: number; @@ -35,5 +35,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import i = I; ~ -!!! error TS2304: Cannot find name 'I'. +!!! error TS2503: Cannot find namespace 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidInstantiatedModule.errors.txt b/tests/baselines/reference/invalidInstantiatedModule.errors.txt index 8bd7e6492c0..540f22f5951 100644 --- a/tests/baselines/reference/invalidInstantiatedModule.errors.txt +++ b/tests/baselines/reference/invalidInstantiatedModule.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'. tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'. -tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2304: Cannot find name 'm'. +tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2503: Cannot find namespace 'm'. ==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ==== @@ -21,7 +21,7 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedMo var m = M2; var p: m.Point; // Error ~ -!!! error TS2304: Cannot find name 'm'. +!!! error TS2503: Cannot find namespace 'm'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidNestedModules.js b/tests/baselines/reference/invalidNestedModules.js index 0679dae7ac6..5f3a19aaec8 100644 --- a/tests/baselines/reference/invalidNestedModules.js +++ b/tests/baselines/reference/invalidNestedModules.js @@ -73,6 +73,6 @@ var M2; (function (M2) { var X; (function (X) { - X.Point; // Error + // Error })(X = M2.X || (M2.X = {})); })(M2 || (M2 = {})); diff --git a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js index 28366739233..61a1d4c01d1 100644 --- a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js @@ -81,7 +81,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 107bd9a88ec..6af1f67f7cf 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 0d0601cad23..b291d31f5b0 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 7f75814d601..caf31b78057 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/moduleAliasAsFunctionArgument.js b/tests/baselines/reference/moduleAliasAsFunctionArgument.js index 4cf9114a26d..ae95e2f7361 100644 --- a/tests/baselines/reference/moduleAliasAsFunctionArgument.js +++ b/tests/baselines/reference/moduleAliasAsFunctionArgument.js @@ -16,7 +16,6 @@ fn(a); // Error: property 'x' is missing from 'a' //// [moduleAliasAsFunctionArgument_0.js] define(["require", "exports"], function (require, exports) { - exports.x; }); //// [moduleAliasAsFunctionArgument_1.js] define(["require", "exports", 'moduleAliasAsFunctionArgument_0'], function (require, exports, a) { diff --git a/tests/baselines/reference/moduleProperty2.js b/tests/baselines/reference/moduleProperty2.js index 715577b6458..7ed1c89108c 100644 --- a/tests/baselines/reference/moduleProperty2.js +++ b/tests/baselines/reference/moduleProperty2.js @@ -21,7 +21,6 @@ var M; var x; } var y; - M.z; var test1 = x; var test2 = y; // y visible because same module })(M || (M = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 1765342efcd..e8719742ab6 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -13,6 +13,5 @@ var Bar; (function (Bar) { Bar.a = 1; function fooA() { return Bar.a; } // Correct: return Bar.a - Bar.b; function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduledecl.js b/tests/baselines/reference/moduledecl.js index 4a27e0fbe1f..ef3b9a2965c 100644 --- a/tests/baselines/reference/moduledecl.js +++ b/tests/baselines/reference/moduledecl.js @@ -272,11 +272,9 @@ var m; var m2; (function (m2) { var a = 10; - m2.b; })(m2 = m.m2 || (m.m2 = {})); var m3; (function (m3) { - m3.c; })(m3 = m.m3 || (m.m3 = {})); })(m || (m = {})); var m; @@ -285,7 +283,6 @@ var m; (function (m25) { var m5; (function (m5) { - m5.c; })(m5 = m25.m5 || (m25.m5 = {})); })(m25 = m.m25 || (m.m25 = {})); })(m || (m = {})); @@ -297,7 +294,6 @@ var m13; (function (m2) { var m3; (function (m3) { - m3.c; })(m3 = m2.m3 || (m2.m3 = {})); })(m2 = m4.m2 || (m4.m2 = {})); function f() { diff --git a/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt b/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt index c85e7584139..14b7769d22f 100644 --- a/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt +++ b/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(1,1): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(2,18): error TS2304: Cannot find name 'Role'. -tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): error TS2304: Cannot find name 'ng'. +tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): error TS2503: Cannot find namespace 'ng'. ==== tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts (3 errors) ==== @@ -13,5 +13,5 @@ tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): er this.roleService.add(role) .then((data: ng.IHttpPromiseCallbackArg) => data.data)); ~~ -!!! error TS2304: Cannot find name 'ng'. +!!! error TS2503: Cannot find namespace 'ng'. \ No newline at end of file diff --git a/tests/baselines/reference/multipleExports.js b/tests/baselines/reference/multipleExports.js index b8c08952b67..ec795ef9913 100644 --- a/tests/baselines/reference/multipleExports.js +++ b/tests/baselines/reference/multipleExports.js @@ -16,7 +16,6 @@ export module M { var M; (function (M) { M.v = 0; - M.x; })(M = exports.M || (exports.M = {})); var x = 0; var M; diff --git a/tests/baselines/reference/multivar.js b/tests/baselines/reference/multivar.js index b5a997a2bd5..3f9796d2944 100644 --- a/tests/baselines/reference/multivar.js +++ b/tests/baselines/reference/multivar.js @@ -51,7 +51,7 @@ var a, b, c; var x = 1, y = 2, z = 3; var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; var m1; var a2, b22 = 10, b222; var m3; diff --git a/tests/baselines/reference/narrowTypeByInstanceof.js b/tests/baselines/reference/narrowTypeByInstanceof.js new file mode 100644 index 00000000000..11f55089bda --- /dev/null +++ b/tests/baselines/reference/narrowTypeByInstanceof.js @@ -0,0 +1,53 @@ +//// [narrowTypeByInstanceof.ts] + class Match { + public range(): any { + return undefined; + } + } + + class FileMatch { + public resource(): any { + return undefined; + } + } + +type FileMatchOrMatch = FileMatch | Match; + + +let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; + +if (elementA instanceof FileMatch && elementB instanceof FileMatch) { + let a = elementA.resource().path; + let b = elementB.resource().path; +} else if (elementA instanceof Match && elementB instanceof Match) { + let a = elementA.range(); + let b = elementB.range(); +} + + +//// [narrowTypeByInstanceof.js] +var Match = (function () { + function Match() { + } + Match.prototype.range = function () { + return undefined; + }; + return Match; +})(); +var FileMatch = (function () { + function FileMatch() { + } + FileMatch.prototype.resource = function () { + return undefined; + }; + return FileMatch; +})(); +var elementA, elementB; +if (elementA instanceof FileMatch && elementB instanceof FileMatch) { + var a = elementA.resource().path; + var b = elementB.resource().path; +} +else if (elementA instanceof Match && elementB instanceof Match) { + var a = elementA.range(); + var b = elementB.range(); +} diff --git a/tests/baselines/reference/narrowTypeByInstanceof.symbols b/tests/baselines/reference/narrowTypeByInstanceof.symbols new file mode 100644 index 00000000000..3e620fd105c --- /dev/null +++ b/tests/baselines/reference/narrowTypeByInstanceof.symbols @@ -0,0 +1,72 @@ +=== tests/cases/compiler/narrowTypeByInstanceof.ts === + class Match { +>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0)) + + public range(): any { +>range : Symbol(range, Decl(narrowTypeByInstanceof.ts, 0, 17)) + + return undefined; +>undefined : Symbol(undefined) + } + } + + class FileMatch { +>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5)) + + public resource(): any { +>resource : Symbol(resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) + + return undefined; +>undefined : Symbol(undefined) + } + } + +type FileMatchOrMatch = FileMatch | Match; +>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5)) +>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5)) +>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0)) + + +let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; +>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3)) +>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5)) +>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31)) +>FileMatchOrMatch : Symbol(FileMatchOrMatch, Decl(narrowTypeByInstanceof.ts, 10, 5)) + +if (elementA instanceof FileMatch && elementB instanceof FileMatch) { +>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3)) +>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5)) +>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31)) +>FileMatch : Symbol(FileMatch, Decl(narrowTypeByInstanceof.ts, 4, 5)) + + let a = elementA.resource().path; +>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 18, 7)) +>elementA.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) +>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3)) +>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) + + let b = elementB.resource().path; +>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 19, 7)) +>elementB.resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) +>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31)) +>resource : Symbol(FileMatch.resource, Decl(narrowTypeByInstanceof.ts, 6, 21)) + +} else if (elementA instanceof Match && elementB instanceof Match) { +>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3)) +>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0)) +>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31)) +>Match : Symbol(Match, Decl(narrowTypeByInstanceof.ts, 0, 0)) + + let a = elementA.range(); +>a : Symbol(a, Decl(narrowTypeByInstanceof.ts, 21, 7)) +>elementA.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17)) +>elementA : Symbol(elementA, Decl(narrowTypeByInstanceof.ts, 15, 3)) +>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17)) + + let b = elementB.range(); +>b : Symbol(b, Decl(narrowTypeByInstanceof.ts, 22, 7)) +>elementB.range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17)) +>elementB : Symbol(elementB, Decl(narrowTypeByInstanceof.ts, 15, 31)) +>range : Symbol(Match.range, Decl(narrowTypeByInstanceof.ts, 0, 17)) +} + diff --git a/tests/baselines/reference/narrowTypeByInstanceof.types b/tests/baselines/reference/narrowTypeByInstanceof.types new file mode 100644 index 00000000000..b98b1e4d234 --- /dev/null +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -0,0 +1,86 @@ +=== tests/cases/compiler/narrowTypeByInstanceof.ts === + class Match { +>Match : Match + + public range(): any { +>range : () => any + + return undefined; +>undefined : undefined + } + } + + class FileMatch { +>FileMatch : FileMatch + + public resource(): any { +>resource : () => any + + return undefined; +>undefined : undefined + } + } + +type FileMatchOrMatch = FileMatch | Match; +>FileMatchOrMatch : Match | FileMatch +>FileMatch : FileMatch +>Match : Match + + +let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; +>elementA : Match | FileMatch +>FileMatchOrMatch : Match | FileMatch +>elementB : Match | FileMatch +>FileMatchOrMatch : Match | FileMatch + +if (elementA instanceof FileMatch && elementB instanceof FileMatch) { +>elementA instanceof FileMatch && elementB instanceof FileMatch : boolean +>elementA instanceof FileMatch : boolean +>elementA : Match | FileMatch +>FileMatch : typeof FileMatch +>elementB instanceof FileMatch : boolean +>elementB : Match | FileMatch +>FileMatch : typeof FileMatch + + let a = elementA.resource().path; +>a : any +>elementA.resource().path : any +>elementA.resource() : any +>elementA.resource : () => any +>elementA : FileMatch +>resource : () => any +>path : any + + let b = elementB.resource().path; +>b : any +>elementB.resource().path : any +>elementB.resource() : any +>elementB.resource : () => any +>elementB : FileMatch +>resource : () => any +>path : any + +} else if (elementA instanceof Match && elementB instanceof Match) { +>elementA instanceof Match && elementB instanceof Match : boolean +>elementA instanceof Match : boolean +>elementA : Match | FileMatch +>Match : typeof Match +>elementB instanceof Match : boolean +>elementB : Match | FileMatch +>Match : typeof Match + + let a = elementA.range(); +>a : any +>elementA.range() : any +>elementA.range : () => any +>elementA : Match +>range : () => any + + let b = elementB.range(); +>b : any +>elementB.range() : any +>elementB.range : () => any +>elementB : Match +>range : () => any +} + diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.js b/tests/baselines/reference/negateOperatorWithAnyOtherType.js index 8418bbbe467..e0dd9b184c3 100644 --- a/tests/baselines/reference/negateOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.js @@ -75,7 +75,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index 9442f54490f..c357849d8a5 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -47,7 +47,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 5fa83e088c8..8a29830e3e4 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -54,7 +54,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index bdbc4a3d664..2b79819894c 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -53,7 +53,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/nestedModules.js b/tests/baselines/reference/nestedModules.js index f146990ec82..c602bb765e2 100644 --- a/tests/baselines/reference/nestedModules.js +++ b/tests/baselines/reference/nestedModules.js @@ -44,7 +44,6 @@ var M2; (function (M2) { var X; (function (X) { - X.Point; })(X = M2.X || (M2.X = {})); })(M2 || (M2 = {})); var m = M2.X; diff --git a/tests/baselines/reference/nonExportedElementsOfMergedModules.js b/tests/baselines/reference/nonExportedElementsOfMergedModules.js index 25efa8a7ec4..e46bf62c05f 100644 --- a/tests/baselines/reference/nonExportedElementsOfMergedModules.js +++ b/tests/baselines/reference/nonExportedElementsOfMergedModules.js @@ -25,7 +25,6 @@ var One; })(A || (A = {})); var B; (function (B) { - B.x; })(B || (B = {})); })(One || (One = {})); var One; @@ -36,7 +35,6 @@ var One; })(A || (A = {})); var B; (function (B) { - B.y; })(B || (B = {})); B.x; B.y; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js index 010afbc4b9e..65ba94f86a3 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js @@ -20,7 +20,6 @@ m.y.x; var x = "Foo"; var m; (function (m) { - m.x; })(m || (m = {})); var n; (function (n) { diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js index e2eb1fc128c..83dd0210a4c 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js @@ -18,7 +18,6 @@ module m { // module export var m; (function (m) { - m.x; })(m || (m = {})); var m; (function (m) { diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js index edb4e6c2953..7a5aaa34242 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js @@ -16,7 +16,6 @@ module m { //// [objectLiteralShorthandPropertiesWithModuleES6.js] var m; (function (m) { - m.x; })(m || (m = {})); var m; (function (m) { diff --git a/tests/baselines/reference/parser519458.errors.txt b/tests/baselines/reference/parser519458.errors.txt index e618e38723f..66dae596b81 100644 --- a/tests/baselines/reference/parser519458.errors.txt +++ b/tests/baselines/reference/parser519458.errors.txt @@ -1,11 +1,14 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,15): error TS2304: Cannot find name 'module'. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,15): error TS2503: Cannot find namespace 'module'. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,21): error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts (3 errors) ==== import rect = module("rect"); var bar = new rect.Rect(); ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~~~~~~ +!!! error TS2503: Cannot find namespace 'module'. ~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt b/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt index 8b9304d9165..75652c829ee 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(1,33): error TS2304: Cannot find name 'B'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(4,9): error TS2315: Type 'C' is not generic. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(5,9): error TS2304: Cannot find name 'D'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(6,9): error TS2304: Cannot find name 'E'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(7,9): error TS2304: Cannot find name 'G'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(6,9): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(7,9): error TS2503: Cannot find namespace 'G'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(8,9): error TS2304: Cannot find name 'K'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(11,16): error TS2304: Cannot find name 'E'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(14,16): error TS2304: Cannot find name 'F'. @@ -26,10 +26,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts !!! error TS2304: Cannot find name 'D'. var v3: E.F; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. var v3: G.H.I; ~ -!!! error TS2304: Cannot find name 'G'. +!!! error TS2503: Cannot find namespace 'G'. var v6: K[]; ~ !!! error TS2304: Cannot find name 'K'. diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt b/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt index 0ef716d1804..c365f461b7c 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,45): error TS2304: Cannot find name 'B'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(4,9): error TS2315: Type 'C' is not generic. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(5,9): error TS2304: Cannot find name 'D'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(6,9): error TS2304: Cannot find name 'E'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(7,9): error TS2304: Cannot find name 'G'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(6,9): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(7,9): error TS2503: Cannot find namespace 'G'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(8,9): error TS2304: Cannot find name 'K'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(11,16): error TS2304: Cannot find name 'E'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(14,16): error TS2304: Cannot find name 'F'. @@ -26,10 +26,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts !!! error TS2304: Cannot find name 'D'. var v3: E.F, Y>>; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. var v4: G.H.I, Y>>; ~ -!!! error TS2304: Cannot find name 'G'. +!!! error TS2503: Cannot find namespace 'G'. var v6: K, Y>>[]; ~ !!! error TS2304: Cannot find name 'K'. diff --git a/tests/baselines/reference/parserImportDeclaration1.errors.txt b/tests/baselines/reference/parserImportDeclaration1.errors.txt index ec3397cd196..099474d3d41 100644 --- a/tests/baselines/reference/parserImportDeclaration1.errors.txt +++ b/tests/baselines/reference/parserImportDeclaration1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts(1,21): error TS2304: Cannot find name 'TypeScriptServices'. +tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts(1,21): error TS2503: Cannot find namespace 'TypeScriptServices'. ==== tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts (1 errors) ==== import TypeScript = TypeScriptServices.TypeScript; ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScriptServices'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'TypeScriptServices'. \ No newline at end of file diff --git a/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt b/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt index 569c960404c..7eed3dbe026 100644 --- a/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt +++ b/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2304: Cannot find name 'TypeModule1'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2503: Cannot find namespace 'TypeModule1'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,8): error TS1005: '=' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,8): error TS2304: Cannot find name 'TypeModule2'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,20): error TS1005: ',' expected. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNam ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts (4 errors) ==== var x: TypeModule1. ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeModule1'. +!!! error TS2503: Cannot find namespace 'TypeModule1'. module TypeModule2 { ~~~~~~~~~~~ !!! error TS1005: '=' expected. diff --git a/tests/baselines/reference/parserVariableDeclaration3.errors.txt b/tests/baselines/reference/parserVariableDeclaration3.errors.txt index bb4e5eceaf6..a2130449f4b 100644 --- a/tests/baselines/reference/parserVariableDeclaration3.errors.txt +++ b/tests/baselines/reference/parserVariableDeclaration3.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(2,23): error TS2304: Cannot find name 'Harness'. tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(3,22): error TS2304: Cannot find name 'Harness'. -tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,21): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,21): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,55): error TS2304: Cannot find name 'TypeScript'. @@ -14,7 +14,7 @@ tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDe !!! error TS2304: Cannot find name 'Harness'. , compiler = new TypeScript.TypeScriptCompiler(outerr) ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. , code; diff --git a/tests/baselines/reference/parserharness.errors.txt b/tests/baselines/reference/parserharness.errors.txt index 2452cd76a18..66afa3d010f 100644 --- a/tests/baselines/reference/parserharness.errors.txt +++ b/tests/baselines/reference/parserharness.errors.txt @@ -13,25 +13,25 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): e tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2304: Cannot find name 'errorHandlerStack'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2304: Cannot find name 'errorHandlerStack'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(691,50): error TS2304: Cannot find name 'ITextWriter'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(721,62): error TS2304: Cannot find name 'ITextWriter'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(724,29): error TS2304: Cannot find name 'ITextWriter'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(754,53): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(764,56): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(764,56): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(765,37): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(767,47): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(776,13): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(776,42): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(781,23): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(781,23): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(794,49): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(795,49): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,53): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,89): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,115): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,115): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,145): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(988,43): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(999,40): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1041,43): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(999,40): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1041,43): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1044,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1045,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1046,26): error TS2304: Cannot find name 'TypeScript'. @@ -44,69 +44,69 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1052,26): tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1053,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1055,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1058,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1059,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1059,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1061,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1064,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1065,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1065,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1067,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1070,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1071,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1071,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1073,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1074,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1074,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1076,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1077,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1077,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1079,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,35): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,74): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1107,173): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1176,132): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,35): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,74): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1107,173): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1176,132): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1193,29): error TS2304: Cannot find name 'WScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1256,126): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1257,25): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1263,31): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1256,126): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1257,25): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1263,31): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1280,45): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,124): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,209): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,142): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,227): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,124): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,209): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,142): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,227): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1302,43): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1304,39): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1307,38): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1311,45): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1321,21): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1340,38): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1344,165): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1345,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1426,25): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1340,38): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1344,165): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1345,26): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1426,25): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1430,9): error TS1128: Declaration or statement expected. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1430,17): error TS2304: Cannot find name 'optionRegex'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1440,29): error TS2304: Cannot find name 'optionRegex'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1461,23): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1461,23): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1466,36): error TS2304: Cannot find name 'optionRegex'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1484,21): error TS2304: Cannot find name 'optionRegex'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1548,57): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1548,57): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1571,32): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1582,59): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1582,59): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1591,24): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1600,24): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1604,42): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1605,21): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1705,38): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1604,42): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1605,21): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1705,38): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1706,26): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,62): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,87): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,62): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,87): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1714,30): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1724,34): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1739,20): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1746,80): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1746,80): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1750,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1758,84): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1769,51): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,39): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,61): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1785,25): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,38): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,68): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1758,84): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1769,51): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,39): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,61): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1785,25): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,38): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,68): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. @@ -858,7 +858,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Mimics having multiple files, later concatenated to a single file. */ export class EmitterIOHost implements TypeScript.EmitterIOHost { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. private fileCollection = {}; @@ -914,7 +914,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function makeDefaultCompilerForTest(c?: TypeScript.TypeScriptCompiler) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var compiler = c || new TypeScript.TypeScriptCompiler(stderr); ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. @@ -941,7 +941,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): var compiler: TypeScript.TypeScriptCompiler; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. recreate(); // pullUpdateUnit is sufficient if an existing unit is updated, if a new unit is added we need to do a full typecheck @@ -1157,7 +1157,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. var entries = new TypeScript.ScopeTraversal(compiler).getScopeEntries(enclosingScopeContext); @@ -1175,7 +1175,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): for (var m = 0; m < compiler.scripts.members.length; m++) { var script2 = compiler.scripts.members[m]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. if (script2.locationInfo.filename !== 'lib.d.ts') { if (targetPosition > -1) { var tyInfo = compiler.pullGetTypeInfoAtPosition(targetPosition, script2); @@ -1219,7 +1219,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): private getTypeInfoName(ast : TypeScript.AST) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var name = ''; switch (ast.nodeType) { case TypeScript.NodeType.Name: // Type Name? @@ -1263,7 +1263,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).text; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.QString: ~~~~~~~~~~ @@ -1275,7 +1275,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).text; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.Return: ~~~~~~~~~~ @@ -1287,30 +1287,30 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.ModuleDeclaration: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.ClassDeclaration: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.FuncDecl: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = !(ast).name ? "" : (ast).name.actualText; // name == null for lambdas ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; default: // TODO: is there a reason to mess with all the special cases above and not just do this (ie take whatever property is there and works?) @@ -1339,7 +1339,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ export function generateDeclFile(code: string, verifyNoDeclFile: boolean, unitName?: string, compilationContext?: Harness.Compiler.CompilationContext, references?: TypeScript.IFileReference[]): string { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. reset(); compiler.settings.generateDeclarationFiles = true; @@ -1410,7 +1410,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** @param fileResults an array of strings for the filename and an ITextWriter with its code */ constructor(public fileResults: { filename: string; file: WriterAggregator; }[], errorLines: string[], public scripts: TypeScript.Script[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var lines = []; fileResults.forEach(v => lines = lines.concat(v.file.lines)); this.code = lines.join("\n") @@ -1494,10 +1494,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function addUnit(code: string, unitName?: string, isResident?: boolean, isDeclareFile?: boolean, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var script: TypeScript.Script = null; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var uName = unitName || '0' + (isDeclareFile ? '.d.ts' : '.ts'); for (var i = 0; i < compiler.units.length; i++) { @@ -1505,7 +1505,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): updateUnit(code, uName); script = compiler.scripts.members[i]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. } } if (!script) { @@ -1532,9 +1532,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function compileFile(path: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. path = switchToForwardSlashes(path); var filename = path.match(/[^\/]*$/)[0]; var code = readFile(path); @@ -1544,9 +1544,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function compileUnit(code: string, filename: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. // not recursive function clone/* */(source: any, target: any) { for (var prop in source) { @@ -1604,16 +1604,16 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function emit(ioHost: TypeScript.EmitterIOHost, usePullEmitter?: boolean) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. compiler.emit(ioHost, usePullEmitter); } export function compileString(code: string, unitName: string, callback: (res: Compiler.CompilerResult) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var scripts: TypeScript.Script[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. reset(); @@ -1696,7 +1696,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): originalFilePath: string; references: TypeScript.IFileReference[]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. } // Regex for parsing options in the format "@Alpha: Value of any sort" @@ -1739,7 +1739,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): var currentFileName = null; var refs: TypeScript.IFileReference[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. for (var i = 0; i < lines.length; i++) { var line = lines[i]; @@ -1832,7 +1832,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): public version: number; public editRanges: { length: number; editRange: TypeScript.ScriptEditRange; }[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. constructor(public name: string, public content: string, public isResident: boolean, public maxScriptVersions: number) { this.version = 1; @@ -1870,7 +1870,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): public getEditRangeSinceVersion(version: number): TypeScript.ScriptEditRange { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. if (this.version == version) { // No edits! return null; @@ -1898,10 +1898,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export class TypeScriptLS implements Services.ILanguageServiceShimHost { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. private ls: Services.ILanguageServiceShim = null; ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. public scripts: ScriptInfo[] = []; public maxScriptVersions = 100; @@ -2003,7 +2003,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ public getLanguageService(): Services.ILanguageServiceShim { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var ls = new Services.TypeScriptServicesFactory().createLanguageServiceShim(this); ~~~~~~~~ !!! error TS2304: Cannot find name 'Services'. @@ -2015,9 +2015,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Parse file given its source text */ public parseSourceText(fileName: string, sourceText: TypeScript.ISourceText): TypeScript.Script { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var parser = new TypeScript.Parser(); ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. @@ -2058,7 +2058,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ public positionToZeroBasedLineCol(fileName: string, position: number): TypeScript.ILineCol { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var script = this.ls.languageService.getScriptAST(fileName); assert.notNull(script); @@ -2074,7 +2074,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Verify that applying edits to sourceFileName result in the content of the file baselineFileName */ public checkEdits(sourceFileName: string, baselineFileName: string, edits: Services.TextEdit[]) { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var script = readFile(sourceFileName); var formattedScript = this.applyEdits(script, edits); var baseline = readFile(baselineFileName); @@ -2087,7 +2087,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Apply an array of text edits to a string, and return the resulting string. */ public applyEdits(content: string, edits: Services.TextEdit[]): string { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result = content; edits = this.normalizeEdits(edits); @@ -2104,18 +2104,18 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Normalize an array of edits by removing overlapping entries and sorting entries on the minChar position. */ private normalizeEdits(edits: Services.TextEdit[]): Services.TextEdit[] { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result: Services.TextEdit[] = []; ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. function mapEdits(edits: Services.TextEdit[]): { edit: Services.TextEdit; index: number; }[] { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result = []; for (var i = 0; i < edits.length; i++) { result.push({ edit: edits[i], index: i }); diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index d74e81fad27..4e22c804ab6 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2503,8 +2503,6 @@ var Harness; (function (Perf) { var Clock; (function (Clock) { - Clock.now; - Clock.resolution; if (typeof WScript !== "undefined" && typeof global['WScript'].InitializeProjection !== "undefined") { // Running in JSHost. global['WScript'].InitializeProjection(); diff --git a/tests/baselines/reference/parserindenter.errors.txt b/tests/baselines/reference/parserindenter.errors.txt index 3d8e5f7cc45..a332abab7bb 100644 --- a/tests/baselines/reference/parserindenter.errors.txt +++ b/tests/baselines/reference/parserindenter.errors.txt @@ -2,10 +2,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(16,1): er tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(20,38): error TS2304: Cannot find name 'ILineIndenationResolver'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(22,33): error TS2304: Cannot find name 'IndentationBag'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(24,42): error TS2304: Cannot find name 'Dictionary_int_int'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(27,28): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(27,28): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(28,26): error TS2304: Cannot find name 'ParseTree'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(29,30): error TS2304: Cannot find name 'ITextSnapshot'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(31,35): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(31,35): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(32,32): error TS2304: Cannot find name 'TokenSpan'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(35,39): error TS2304: Cannot find name 'IndentationBag'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(37,48): error TS2304: Cannot find name 'Dictionary_int_int'. @@ -27,9 +27,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,51): tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,63): error TS2304: Cannot find name 'List_TextEditInfo'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(153,30): error TS2304: Cannot find name 'List_TextEditInfo'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(155,32): error TS2304: Cannot find name 'AuthorTokenKind'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2304: Cannot find name 'GetIndentSizeFromText'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,50): error TS2304: Cannot find name 'TokenSpan'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,67): error TS2304: Cannot find name 'ParseNode'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,79): error TS2304: Cannot find name 'IndentationInfo'. @@ -165,7 +165,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): constructor( public logger: TypeScript.ILogger, ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. public tree: ParseTree, ~~~~~~~~~ !!! error TS2304: Cannot find name 'ParseTree'. @@ -175,7 +175,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): public languageHostIndentation: string, public editorOptions: Services.EditorOptions, ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. public firstToken: TokenSpan, ~~~~~~~~~ !!! error TS2304: Cannot find name 'TokenSpan'. @@ -370,7 +370,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): static GetIndentSizeFromIndentText(indentText: string, editorOptions: Services.EditorOptions): number { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'GetIndentSizeFromText'. @@ -378,7 +378,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): static GetIndentSizeFromText(text: string, editorOptions: Services.EditorOptions, includeNonIndentChars: boolean): number { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var indentSize = 0; for (var i = 0; i < text.length; i++) { diff --git a/tests/baselines/reference/parservoidInQualifiedName2.errors.txt b/tests/baselines/reference/parservoidInQualifiedName2.errors.txt index ad96679f0fd..7ca94a8989a 100644 --- a/tests/baselines/reference/parservoidInQualifiedName2.errors.txt +++ b/tests/baselines/reference/parservoidInQualifiedName2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,9): error TS2503: Cannot find namespace 'x'. tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,11): error TS1003: Identifier expected. tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,15): error TS1109: Expression expected. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,15): ==== tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts (3 errors) ==== var v : x.void; ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2503: Cannot find namespace 'x'. ~~~~ !!! error TS1003: Identifier expected. ~ diff --git a/tests/baselines/reference/plusOperatorWithAnyOtherType.js b/tests/baselines/reference/plusOperatorWithAnyOtherType.js index 33ac4ebb144..0356bad198e 100644 --- a/tests/baselines/reference/plusOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/plusOperatorWithAnyOtherType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any other type var diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 5af1a8fb903..d48066707aa 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -47,7 +47,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index a0adaa5dec2..8da631aa7a8 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -54,7 +54,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index ed2c60111b3..dbe7e23a3d6 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -53,7 +53,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/primaryExpressionMods.errors.txt b/tests/baselines/reference/primaryExpressionMods.errors.txt index 8de3d60c27d..197970591eb 100644 --- a/tests/baselines/reference/primaryExpressionMods.errors.txt +++ b/tests/baselines/reference/primaryExpressionMods.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/primaryExpressionMods.ts(7,8): error TS2304: Cannot find name 'M'. -tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2304: Cannot find name 'm'. +tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2503: Cannot find namespace 'm'. ==== tests/cases/compiler/primaryExpressionMods.ts (2 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2304: Cannot find n var x2 = m.a; // Same as M.a var q: m.P; // Error ~ -!!! error TS2304: Cannot find name 'm'. +!!! error TS2503: Cannot find namespace 'm'. \ No newline at end of file diff --git a/tests/baselines/reference/privacyCheckTypeOfFunction.js b/tests/baselines/reference/privacyCheckTypeOfFunction.js index 757416c691b..b29a21b98b5 100644 --- a/tests/baselines/reference/privacyCheckTypeOfFunction.js +++ b/tests/baselines/reference/privacyCheckTypeOfFunction.js @@ -8,5 +8,4 @@ export var b = foo; //// [privacyCheckTypeOfFunction.js] function foo() { } -exports.x; exports.b = foo; diff --git a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js index 80941509d4f..e2ee218de06 100644 --- a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js +++ b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js @@ -13,7 +13,5 @@ var Outer; (function (Outer) { var Inner; (function (Inner) { - Inner.m; })(Inner || (Inner = {})); - Outer.f; })(Outer || (Outer = {})); diff --git a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js index 832c7d2e50d..0301b7b9e4b 100644 --- a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js +++ b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js @@ -13,7 +13,6 @@ var Outer; (function (Outer) { var Inner; (function (Inner) { - Inner.m; })(Inner || (Inner = {})); - Outer.f; // Since we dont unwind inner any more, it is error here + // Since we dont unwind inner any more, it is error here })(Outer || (Outer = {})); diff --git a/tests/baselines/reference/privacyGloImport.js b/tests/baselines/reference/privacyGloImport.js index 9f29e383786..7f832ef75fe 100644 --- a/tests/baselines/reference/privacyGloImport.js +++ b/tests/baselines/reference/privacyGloImport.js @@ -168,7 +168,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -183,7 +182,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); //export declare module "m1_M3_public" { // export function f1(); @@ -251,7 +249,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public || (glo_M1_public = {})); var m2; (function (m2) { diff --git a/tests/baselines/reference/privacyGloImportParseErrors.js b/tests/baselines/reference/privacyGloImportParseErrors.js index d5a089a7678..f99fdaca8cc 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.js +++ b/tests/baselines/reference/privacyGloImportParseErrors.js @@ -168,7 +168,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -183,7 +182,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); var m1_im1_private = m1_M1_public; m1.m1_im1_private_v1_public = m1_im1_private.c1; @@ -235,7 +233,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public || (glo_M1_public = {})); var m2; (function (m2_1) { diff --git a/tests/baselines/reference/privacyGloVar.js b/tests/baselines/reference/privacyGloVar.js index edfefc1fdb1..871407428f2 100644 --- a/tests/baselines/reference/privacyGloVar.js +++ b/tests/baselines/reference/privacyGloVar.js @@ -124,9 +124,8 @@ var m1; return C4_public; })(); var m1_v1_private; - m1.m1_v2_public; var m1_v3_private; - m1.m1_v4_public; // error + // error var m1_v11_private = new C1_public(); m1.m1_v12_public = new C1_public(); var m1_v13_private = new C2_private(); diff --git a/tests/baselines/reference/privacyImport.js b/tests/baselines/reference/privacyImport.js index fb200cac363..02ee47341c4 100644 --- a/tests/baselines/reference/privacyImport.js +++ b/tests/baselines/reference/privacyImport.js @@ -372,7 +372,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -387,7 +386,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); //export declare module "m1_M3_public" { // export function f1(); @@ -457,7 +455,6 @@ var m2; } m2_M1_public.f1 = f1; m2_M1_public.v1 = c1; - m2_M1_public.v2; })(m2_M1_public = m2.m2_M1_public || (m2.m2_M1_public = {})); var m2_M2_private; (function (m2_M2_private) { @@ -472,7 +469,6 @@ var m2; } m2_M2_private.f1 = f1; m2_M2_private.v1 = c1; - m2_M2_private.v2; })(m2_M2_private || (m2_M2_private = {})); //export declare module "m2_M3_public" { // export function f1(); @@ -541,7 +537,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public = exports.glo_M1_public || (exports.glo_M1_public = {})); //export declare module "glo_M2_public" { // export function f1(); @@ -563,7 +558,6 @@ var glo_M3_private; } glo_M3_private.f1 = f1; glo_M3_private.v1 = c1; - glo_M3_private.v2; })(glo_M3_private = exports.glo_M3_private || (exports.glo_M3_private = {})); //export declare module "glo_M4_private" { // export function f1(); diff --git a/tests/baselines/reference/privacyImportParseErrors.js b/tests/baselines/reference/privacyImportParseErrors.js index 90e4a7cb097..71f20286f90 100644 --- a/tests/baselines/reference/privacyImportParseErrors.js +++ b/tests/baselines/reference/privacyImportParseErrors.js @@ -372,7 +372,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -387,7 +386,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); var m1_im1_private = m1_M1_public; m1.m1_im1_private_v1_public = m1_im1_private.c1; @@ -441,7 +439,6 @@ var m2; } m2_M1_public.f1 = f1; m2_M1_public.v1 = c1; - m2_M1_public.v2; })(m2_M1_public = m2.m2_M1_public || (m2.m2_M1_public = {})); var m2_M2_private; (function (m2_M2_private) { @@ -456,7 +453,6 @@ var m2; } m2_M2_private.f1 = f1; m2_M2_private.v1 = c1; - m2_M2_private.v2; })(m2_M2_private || (m2_M2_private = {})); var m1_im1_private = m2_M1_public; m2.m1_im1_private_v1_public = m1_im1_private.c1; @@ -509,7 +505,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public = exports.glo_M1_public || (exports.glo_M1_public = {})); var glo_M3_private; (function (glo_M3_private) { @@ -524,7 +519,6 @@ var glo_M3_private; } glo_M3_private.f1 = f1; glo_M3_private.v1 = c1; - glo_M3_private.v2; })(glo_M3_private = exports.glo_M3_private || (exports.glo_M3_private = {})); var glo_im1_private = glo_M1_public; exports.glo_im1_private_v1_public = glo_im1_private.c1; diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js index 9093787a6fc..20881230156 100644 --- a/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js @@ -229,11 +229,9 @@ var import_public; var privateUse_im_public_v_private = import_public.im_public_v_private; import_public.publicUse_im_public_v_private = import_public.im_public_v_private; var privateUse_im_public_i_private; - import_public.publicUse_im_public_i_private; var privateUse_im_public_mi_private = new import_public.im_public_mi_private.c(); import_public.publicUse_im_public_mi_private = new import_public.im_public_mi_private.c(); var privateUse_im_public_mu_private; - import_public.publicUse_im_public_mu_private; // No Privacy errors - importing public elements import_public.im_public_c_public = m_public.c_public; import_public.im_public_e_public = m_public.e_public; @@ -250,11 +248,9 @@ var import_public; var privateUse_im_public_v_public = import_public.im_public_v_public; import_public.publicUse_im_public_v_public = import_public.im_public_v_public; var privateUse_im_public_i_public; - import_public.publicUse_im_public_i_public; var privateUse_im_public_mi_public = new import_public.im_public_mi_public.c(); import_public.publicUse_im_public_mi_public = new import_public.im_public_mi_public.c(); var privateUse_im_public_mu_public; - import_public.publicUse_im_public_mu_public; })(import_public = exports.import_public || (exports.import_public = {})); var import_private; (function (import_private) { @@ -274,11 +270,9 @@ var import_private; var privateUse_im_private_v_private = import_private.im_private_v_private; import_private.publicUse_im_private_v_private = import_private.im_private_v_private; var privateUse_im_private_i_private; - import_private.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new import_private.im_private_mi_private.c(); import_private.publicUse_im_private_mi_private = new import_private.im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_private.publicUse_im_private_mu_private; // No privacy Error - importing public elements import_private.im_private_c_public = m_public.c_public; import_private.im_private_e_public = m_public.e_public; @@ -295,9 +289,7 @@ var import_private; var privateUse_im_private_v_public = import_private.im_private_v_public; import_private.publicUse_im_private_v_public = import_private.im_private_v_public; var privateUse_im_private_i_public; - import_private.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new import_private.im_private_mi_public.c(); import_private.publicUse_im_private_mi_public = new import_private.im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_private.publicUse_im_private_mu_public; })(import_private || (import_private = {})); diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js index f3b8da0de82..65565d3a5de 100644 --- a/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js @@ -230,11 +230,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; import_public.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - import_public.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); import_public.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_public.publicUse_im_private_mu_private; // No Privacy errors - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -251,11 +249,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; import_public.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - import_public.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); import_public.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_public.publicUse_im_private_mu_public; })(import_public = exports.import_public || (exports.import_public = {})); var import_private; (function (import_private) { @@ -275,11 +271,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; import_private.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - import_private.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); import_private.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_private.publicUse_im_private_mu_private; // No privacy Error - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -296,10 +290,8 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; import_private.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - import_private.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); import_private.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_private.publicUse_im_private_mu_public; })(import_private || (import_private = {})); }); diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js index e73e398d437..ec2d039df01 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js @@ -175,11 +175,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_private = exports.im_public_v_private; exports.publicUse_im_public_v_private = exports.im_public_v_private; var privateUse_im_public_i_private; - exports.publicUse_im_public_i_private; var privateUse_im_public_mi_private = new exports.im_public_mi_private.c(); exports.publicUse_im_public_mi_private = new exports.im_public_mi_private.c(); var privateUse_im_public_mu_private; - exports.publicUse_im_public_mu_private; // No Privacy errors - importing public elements exports.im_public_c_public = m_public.c_public; exports.im_public_e_public = m_public.e_public; @@ -196,9 +194,7 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_public = exports.im_public_v_public; exports.publicUse_im_public_v_public = exports.im_public_v_public; var privateUse_im_public_i_public; - exports.publicUse_im_public_i_public; var privateUse_im_public_mi_public = new exports.im_public_mi_public.c(); exports.publicUse_im_public_mi_public = new exports.im_public_mi_public.c(); var privateUse_im_public_mu_public; - exports.publicUse_im_public_mu_public; }); diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js index 11cd8c260b7..a0eb39985b4 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js @@ -176,11 +176,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; exports.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - exports.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); exports.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - exports.publicUse_im_private_mu_private; // No Privacy errors - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -197,9 +195,7 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; exports.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - exports.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); exports.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - exports.publicUse_im_private_mu_public; }); diff --git a/tests/baselines/reference/privacyVar.js b/tests/baselines/reference/privacyVar.js index 04b4cc28dd5..2dc78dd3d2b 100644 --- a/tests/baselines/reference/privacyVar.js +++ b/tests/baselines/reference/privacyVar.js @@ -218,9 +218,8 @@ var m1; return C4_public; })(); var m1_v1_private; - m1.m1_v2_public; var m1_v3_private; - m1.m1_v4_public; // error + // error var m1_v11_private = new C1_public(); m1.m1_v12_public = new C1_public(); var m1_v13_private = new C2_private(); @@ -273,9 +272,7 @@ var m2; return m2_C4_public; })(); var m2_v1_private; - m2.m2_v2_public; var m2_v3_private; - m2.m2_v4_public; var m2_v11_private = new m2_C1_public(); m2.m2_v12_public = new m2_C1_public(); var m2_v13_private = new m2_C2_private(); @@ -326,9 +323,8 @@ var glo_C4_public = (function () { return glo_C4_public; })(); var glo_v1_private; -exports.glo_v2_public; var glo_v3_private; -exports.glo_v4_public; // error + // error var glo_v11_private = new glo_C1_public(); exports.glo_v12_public = new glo_C1_public(); var glo_v13_private = new glo_C2_private(); diff --git a/tests/baselines/reference/privacyVarDeclFile.js b/tests/baselines/reference/privacyVarDeclFile.js index 1f0a14fc7cf..d080b9d7b24 100644 --- a/tests/baselines/reference/privacyVarDeclFile.js +++ b/tests/baselines/reference/privacyVarDeclFile.js @@ -459,8 +459,7 @@ var privateClassWithWithPublicPropertyTypes = (function () { } return privateClassWithWithPublicPropertyTypes; })(); -exports.publicVarWithPrivatePropertyTypes; // Error -exports.publicVarWithPublicPropertyTypes; + // Error var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -469,7 +468,7 @@ var publicClassWithPrivateModulePropertyTypes = (function () { return publicClassWithPrivateModulePropertyTypes; })(); exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; -exports.publicVarWithPrivateModulePropertyTypes; // Error + // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -511,8 +510,7 @@ var publicModule; } return privateClassWithWithPublicPropertyTypes; })(); - publicModule.publicVarWithPrivatePropertyTypes; // Error - publicModule.publicVarWithPublicPropertyTypes; + // Error var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -521,7 +519,7 @@ var publicModule; return publicClassWithPrivateModulePropertyTypes; })(); publicModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - publicModule.publicVarWithPrivateModulePropertyTypes; // Error + // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -564,8 +562,6 @@ var privateModule; } return privateClassWithWithPublicPropertyTypes; })(); - privateModule.publicVarWithPrivatePropertyTypes; - privateModule.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -574,7 +570,6 @@ var privateModule; return publicClassWithPrivateModulePropertyTypes; })(); privateModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - privateModule.publicVarWithPrivateModulePropertyTypes; var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -642,8 +637,6 @@ var publicModuleInGlobal; } return privateClassWithWithPublicPropertyTypes; })(); - privateModule.publicVarWithPrivatePropertyTypes; - privateModule.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -652,7 +645,6 @@ var publicModuleInGlobal; return publicClassWithPrivateModulePropertyTypes; })(); privateModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - privateModule.publicVarWithPrivateModulePropertyTypes; var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -682,8 +674,7 @@ var publicModuleInGlobal; } return privateClassWithWithPublicPropertyTypes; })(); - publicModuleInGlobal.publicVarWithPrivatePropertyTypes; // Error - publicModuleInGlobal.publicVarWithPublicPropertyTypes; + // Error var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -692,7 +683,7 @@ var publicModuleInGlobal; return publicClassWithPrivateModulePropertyTypes; })(); publicModuleInGlobal.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - publicModuleInGlobal.publicVarWithPrivateModulePropertyTypes; // Error + // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js index 640e4412366..fd6c8ad47f4 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js @@ -4,6 +4,5 @@ define(["require", "exports", "private_m4"], function (require, exports, private var x3 = private_m4.x; var d3 = private_m4.d; var f3 = private_m4.foo(); - usePrivate_m4_m1.numberVar; })(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {})); }); diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js b/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js index 77f1d44c2a9..8fe4cca6e92 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js @@ -5,5 +5,4 @@ var usePrivate_m4_m1; var x3 = private_m4.x; var d3 = private_m4.d; var f3 = private_m4.foo(); - usePrivate_m4_m1.numberVar; })(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {})); diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt index 25059478bf5..1bda32a0b4c 100644 --- a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt @@ -1,6 +1,6 @@ -error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'. +error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'. error TS6053: File 'a.ts' not found. -!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'. +!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'. !!! error TS6053: File 'a.ts' not found. \ No newline at end of file diff --git a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt index 25059478bf5..1bda32a0b4c 100644 --- a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt @@ -1,6 +1,6 @@ -error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'. +error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'. error TS6053: File 'a.ts' not found. -!!! error TS6054: File 'a.t' must have extension '.ts' or '.d.ts'. +!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'. !!! error TS6053: File 'a.ts' not found. \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt index 0d3528b6dc3..47d1f6df86e 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt index 0d3528b6dc3..47d1f6df86e 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt index 01a3526196c..d00f552ef97 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt index 01a3526196c..d00f552ef97 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt index b7abc0c2d52..f4b65c12f35 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. +error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt index b7abc0c2d52..f4b65c12f35 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. +error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option. +!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/promiseVoidErrorCallback.js b/tests/baselines/reference/promiseVoidErrorCallback.js new file mode 100644 index 00000000000..a9aa0f1b5d0 --- /dev/null +++ b/tests/baselines/reference/promiseVoidErrorCallback.js @@ -0,0 +1,43 @@ +//// [promiseVoidErrorCallback.ts] +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; +}); + +//// [promiseVoidErrorCallback.js] +function f1() { + return Promise.resolve({ __t1: "foo_t1" }); +} +function f2(x) { + return { __t2: x.__t1 + ":foo_21" }; +} +var x3 = f1() + .then(f2, (e) => { + throw e; +}) + .then((x) => { + return { __t3: x.__t2 + "bar" }; +}); diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols new file mode 100644 index 00000000000..78faacdb1f1 --- /dev/null +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -0,0 +1,75 @@ +=== tests/cases/compiler/promiseVoidErrorCallback.ts === +interface T1 { +>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) + + __t1: string; +>__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 0, 14)) +} + +interface T2 { +>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) + + __t2: string; +>__t2 : Symbol(__t2, Decl(promiseVoidErrorCallback.ts, 4, 14)) +} + +interface T3 { +>T3 : Symbol(T3, Decl(promiseVoidErrorCallback.ts, 6, 1)) + + __t3: string; +>__t3 : Symbol(__t3, Decl(promiseVoidErrorCallback.ts, 8, 14)) +} + +function f1(): Promise { +>f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4854, 11)) +>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) + + return Promise.resolve({ __t1: "foo_t1" }); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4836, 39), Decl(lib.d.ts, 4843, 54)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4854, 11)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4836, 39), Decl(lib.d.ts, 4843, 54)) +>__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) +} + +function f2(x: T1): T2 { +>f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) +>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 16, 12)) +>T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) +>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) + + return { __t2: x.__t1 + ":foo_21" }; +>__t2 : Symbol(__t2, Decl(promiseVoidErrorCallback.ts, 17, 12)) +>x.__t1 : Symbol(T1.__t1, Decl(promiseVoidErrorCallback.ts, 0, 14)) +>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 16, 12)) +>__t1 : Symbol(T1.__t1, Decl(promiseVoidErrorCallback.ts, 0, 14)) +} + +var x3 = f1() +>x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158)) +>f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158)) +>f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) + + .then(f2, (e: Error) => { +>then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158)) +>f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) +>e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) +>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11)) + + throw e; +>e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) + +}) + .then((x: T2) => { +>then : Symbol(Promise.then, Decl(lib.d.ts, 4774, 22), Decl(lib.d.ts, 4781, 158)) +>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) +>T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) + + return { __t3: x.__t2 + "bar" }; +>__t3 : Symbol(__t3, Decl(promiseVoidErrorCallback.ts, 25, 12)) +>x.__t2 : Symbol(T2.__t2, Decl(promiseVoidErrorCallback.ts, 4, 14)) +>x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) +>__t2 : Symbol(T2.__t2, Decl(promiseVoidErrorCallback.ts, 4, 14)) + +}); diff --git a/tests/baselines/reference/promiseVoidErrorCallback.types b/tests/baselines/reference/promiseVoidErrorCallback.types new file mode 100644 index 00000000000..82b248f64bd --- /dev/null +++ b/tests/baselines/reference/promiseVoidErrorCallback.types @@ -0,0 +1,89 @@ +=== tests/cases/compiler/promiseVoidErrorCallback.ts === +interface T1 { +>T1 : T1 + + __t1: string; +>__t1 : string +} + +interface T2 { +>T2 : T2 + + __t2: string; +>__t2 : string +} + +interface T3 { +>T3 : T3 + + __t3: string; +>__t3 : string +} + +function f1(): Promise { +>f1 : () => Promise +>Promise : Promise +>T1 : T1 + + return Promise.resolve({ __t1: "foo_t1" }); +>Promise.resolve({ __t1: "foo_t1" }) : Promise<{ __t1: string; }> +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>{ __t1: "foo_t1" } : { __t1: string; } +>__t1 : string +>"foo_t1" : string +} + +function f2(x: T1): T2 { +>f2 : (x: T1) => T2 +>x : T1 +>T1 : T1 +>T2 : T2 + + return { __t2: x.__t1 + ":foo_21" }; +>{ __t2: x.__t1 + ":foo_21" } : { __t2: string; } +>__t2 : string +>x.__t1 + ":foo_21" : string +>x.__t1 : string +>x : T1 +>__t1 : string +>":foo_21" : string +} + +var x3 = f1() +>x3 : Promise<{ __t3: string; }> +>f1() .then(f2, (e: Error) => { throw e;}) .then((x: T2) => { return { __t3: x.__t2 + "bar" };}) : Promise<{ __t3: string; }> +>f1() .then(f2, (e: Error) => { throw e;}) .then : { (onfulfilled?: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>f1() .then(f2, (e: Error) => { throw e;}) : Promise +>f1() .then : { (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>f1() : Promise +>f1 : () => Promise + + .then(f2, (e: Error) => { +>then : { (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>f2 : (x: T1) => T2 +>(e: Error) => { throw e;} : (e: Error) => void +>e : Error +>Error : Error + + throw e; +>e : Error + +}) + .then((x: T2) => { +>then : { (onfulfilled?: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>(x: T2) => { return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; } +>x : T2 +>T2 : T2 + + return { __t3: x.__t2 + "bar" }; +>{ __t3: x.__t2 + "bar" } : { __t3: string; } +>__t3 : string +>x.__t2 + "bar" : string +>x.__t2 : string +>x : T2 +>__t2 : string +>"bar" : string + +}); diff --git a/tests/baselines/reference/propertyNamesWithStringLiteral.js b/tests/baselines/reference/propertyNamesWithStringLiteral.js index 9c1bc04a95e..1474847723f 100644 --- a/tests/baselines/reference/propertyNamesWithStringLiteral.js +++ b/tests/baselines/reference/propertyNamesWithStringLiteral.js @@ -24,7 +24,6 @@ var _Color = (function () { })(); var Color; (function (Color) { - Color.namedColors; })(Color || (Color = {})); var a = Color.namedColors["azure"]; var a = Color.namedColors.blue; // Should not error diff --git a/tests/baselines/reference/protoAsIndexInIndexExpression.js b/tests/baselines/reference/protoAsIndexInIndexExpression.js index 489e624cdc6..a003c70468e 100644 --- a/tests/baselines/reference/protoAsIndexInIndexExpression.js +++ b/tests/baselines/reference/protoAsIndexInIndexExpression.js @@ -20,7 +20,6 @@ class C { } //// [protoAsIndexInIndexExpression_0.js] -exports.x; //// [protoAsIndexInIndexExpression_1.js] /// var EntityPrototype = undefined; diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js index 59f4f8c8a94..d886fb39eaf 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js @@ -27,5 +27,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType1_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js index 48f35df3097..5b2992b02fd 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js @@ -31,5 +31,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType2_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js index c7456cda942..acf9075f6db 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js @@ -35,5 +35,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType3_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js index 1a9e00675a7..8f6b76aa059 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js @@ -27,5 +27,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType4_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js index dd94524bfa2..1d6e7f729a0 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js @@ -34,5 +34,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType5_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js index 792f09b5579..c8fd463c2fe 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js @@ -41,5 +41,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType6_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js index f5568b5e39d..aa82e463ce7 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js @@ -46,5 +46,5 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType7_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB + // This should result in type ClassB }); diff --git a/tests/baselines/reference/scannerImportDeclaration1.errors.txt b/tests/baselines/reference/scannerImportDeclaration1.errors.txt index 243670c6854..d8378248d51 100644 --- a/tests/baselines/reference/scannerImportDeclaration1.errors.txt +++ b/tests/baselines/reference/scannerImportDeclaration1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts(1,21): error TS2304: Cannot find name 'TypeScriptServices'. +tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts(1,21): error TS2503: Cannot find namespace 'TypeScriptServices'. ==== tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts (1 errors) ==== import TypeScript = TypeScriptServices.TypeScript; ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScriptServices'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'TypeScriptServices'. \ No newline at end of file diff --git a/tests/baselines/reference/scopeResolutionIdentifiers.js b/tests/baselines/reference/scopeResolutionIdentifiers.js index 1d72bbbf966..42a1e684015 100644 --- a/tests/baselines/reference/scopeResolutionIdentifiers.js +++ b/tests/baselines/reference/scopeResolutionIdentifiers.js @@ -43,7 +43,6 @@ module M3 { var s; var M1; (function (M1) { - M1.s; var n = M1.s; var n; })(M1 || (M1 = {})); diff --git a/tests/baselines/reference/separateCompilationSpecifiedModule.js b/tests/baselines/reference/separateCompilationSpecifiedModule.js index 5f3c7ceb39c..02616b75874 100644 --- a/tests/baselines/reference/separateCompilationSpecifiedModule.js +++ b/tests/baselines/reference/separateCompilationSpecifiedModule.js @@ -2,4 +2,3 @@ export var x; //// [separateCompilationSpecifiedModule.js] -exports.x; diff --git a/tests/baselines/reference/separateCompilationUnspecifiedModule.js b/tests/baselines/reference/separateCompilationUnspecifiedModule.js index 0f2e5c71a87..1525207a93d 100644 --- a/tests/baselines/reference/separateCompilationUnspecifiedModule.js +++ b/tests/baselines/reference/separateCompilationUnspecifiedModule.js @@ -2,4 +2,3 @@ export var x; //// [separateCompilationUnspecifiedModule.js] -exports.x; diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..4e894fb99ad --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js @@ -0,0 +1,17 @@ +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts] +module Q { + function P() { + // Test this + var a = 1; + } +} + +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js] +var Q; +(function (Q) { + function P() { + // Test this + var a = 1; + } +})(Q || (Q = {})); +//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..217105d88d2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map @@ -0,0 +1,2 @@ +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map] +{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QAEIC,AADAA,YAAYA;YACRA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..669481b46a2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt @@ -0,0 +1,127 @@ +=================================================================== +JsFile: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js +mapUrl: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map +sourceRoot: +sources: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js +sourceFile:sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts +------------------------------------------------------------------- +>>>var Q; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1 > +2 >module +3 > Q +4 > { + > function P() { + > // Test this + > var a = 1; + > } + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 9) + SourceIndex(0) +4 >Emitted(1, 7) Source(6, 2) + SourceIndex(0) +--- +>>>(function (Q) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^-> +1-> +2 >module +3 > Q +4 > +5 > { +1->Emitted(2, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(2, 12) Source(1, 8) + SourceIndex(0) +3 >Emitted(2, 13) Source(1, 9) + SourceIndex(0) +4 >Emitted(2, 15) Source(1, 10) + SourceIndex(0) +5 >Emitted(2, 16) Source(1, 11) + SourceIndex(0) +--- +>>> function P() { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) name (Q) +--- +>>> // Test this +1->^^^^^^^^ +2 > +3 > ^^^^^^^^^^^^ +1->function P() { + > // Test this + > +2 > +3 > // Test this +1->Emitted(4, 9) Source(4, 9) + SourceIndex(0) name (Q.P) +2 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P) +3 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P) +--- +>>> var a = 1; +1 >^^^^^^^^^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^ +1 > + > var +2 > a +3 > = +4 > 1 +5 > ; +1 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P) +2 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P) +3 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P) +4 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P) +5 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(5, 5) + SourceIndex(0) name (Q.P) +2 >Emitted(6, 6) Source(5, 6) + SourceIndex(0) name (Q.P) +--- +>>>})(Q || (Q = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >} +3 > +4 > Q +5 > +6 > Q +7 > { + > function P() { + > // Test this + > var a = 1; + > } + > } +1->Emitted(7, 1) Source(6, 1) + SourceIndex(0) name (Q) +2 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) name (Q) +3 >Emitted(7, 4) Source(1, 8) + SourceIndex(0) +4 >Emitted(7, 5) Source(1, 9) + SourceIndex(0) +5 >Emitted(7, 10) Source(1, 8) + SourceIndex(0) +6 >Emitted(7, 11) Source(1, 9) + SourceIndex(0) +7 >Emitted(7, 19) Source(6, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..285a6a0ad92 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts === +module Q { +>Q : Symbol(Q, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 0)) + + function P() { +>P : Symbol(P, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 10)) + + // Test this + var a = 1; +>a : Symbol(a, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 3, 11)) + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..db4f2c320b4 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts === +module Q { +>Q : typeof Q + + function P() { +>P : () => void + + // Test this + var a = 1; +>a : number +>1 : number + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..885ece077d7 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js @@ -0,0 +1,12 @@ +//// [sourceMapForFunctionWithCommentPrecedingStatement01.ts] +function P() { + // Test this + var a = 1; +} + +//// [sourceMapForFunctionWithCommentPrecedingStatement01.js] +function P() { + // Test this + var a = 1; +} +//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..7a84caf3879 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map @@ -0,0 +1,2 @@ +//// [sourceMapForFunctionWithCommentPrecedingStatement01.js.map] +{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IAEIA,AADAA,YAAYA;QACRA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..cbeed192d31 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt @@ -0,0 +1,58 @@ +=================================================================== +JsFile: sourceMapForFunctionWithCommentPrecedingStatement01.js +mapUrl: sourceMapForFunctionWithCommentPrecedingStatement01.js.map +sourceRoot: +sources: sourceMapForFunctionWithCommentPrecedingStatement01.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.js +sourceFile:sourceMapForFunctionWithCommentPrecedingStatement01.ts +------------------------------------------------------------------- +>>>function P() { +1 > +2 >^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> // Test this +1->^^^^ +2 > +3 > ^^^^^^^^^^^^ +1->function P() { + > // Test this + > +2 > +3 > // Test this +1->Emitted(2, 5) Source(3, 5) + SourceIndex(0) name (P) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P) +3 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P) +--- +>>> var a = 1; +1 >^^^^^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^ +1 > + > var +2 > a +3 > = +4 > 1 +5 > ; +1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P) +2 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P) +3 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P) +4 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P) +5 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) name (P) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) name (P) +--- +>>>//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..b9f50a929af --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts === +function P() { +>P : Symbol(P, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 0, 0)) + + // Test this + var a = 1; +>a : Symbol(a, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 2, 7)) +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..5e3d01a6b5b --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts === +function P() { +>P : () => void + + // Test this + var a = 1; +>a : number +>1 : number +} diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 9e76e36551d..9b7c0e03d0c 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -19,19 +19,19 @@ tests/cases/compiler/strictModeReservedWord.ts(13,28): error TS1212: Identifier tests/cases/compiler/strictModeReservedWord.ts(15,25): error TS9003: 'class' expressions are not currently supported. tests/cases/compiler/strictModeReservedWord.ts(17,9): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS1215: Type expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(20,30): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(21,30): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(21,38): error TS1215: Type expected. 'protected' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(22,9): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1215: Type expected. 'interface' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2304: Cannot find name 'interface'. +tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2503: Cannot find namespace 'interface'. tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1215: Type expected. 'implements' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2304: Cannot find name 'ublic'. @@ -100,25 +100,25 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~~~~~~ !!! error TS1215: Type expected. 'public' is a reserved word in strict mode ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. function foo(x: private.x) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. function foo1(x: private.package.x) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode function foo2(x: private.package.protected) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode ~~~~~~~~~ @@ -129,7 +129,7 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~~~~~~~~~ !!! error TS1215: Type expected. 'interface' is a reserved word in strict mode ~~~~~~~~~ -!!! error TS2304: Cannot find name 'interface'. +!!! error TS2503: Cannot find namespace 'interface'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode ~~~~~~~~~~ diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt index b7876b1b849..43222495b9f 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt @@ -15,13 +15,13 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,9): error TS tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(23,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS2304: Cannot find name 'package'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS2304: Cannot find name 'package'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS2503: Cannot find namespace 'package'. ==== tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts (24 errors) ==== @@ -85,12 +85,12 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. class F1 implements public.private.implements { } ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. class G extends package { } ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. @@ -100,4 +100,4 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~~ -!!! error TS2304: Cannot find name 'package'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'package'. \ No newline at end of file diff --git a/tests/baselines/reference/structuralTypeInDeclareFileForModule.js b/tests/baselines/reference/structuralTypeInDeclareFileForModule.js index 8dfb775662b..b7d5615d3ff 100644 --- a/tests/baselines/reference/structuralTypeInDeclareFileForModule.js +++ b/tests/baselines/reference/structuralTypeInDeclareFileForModule.js @@ -6,7 +6,6 @@ var m = M; //// [structuralTypeInDeclareFileForModule.js] var M; (function (M) { - M.x; })(M || (M = {})); var m = M; diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js index 5ed756b0863..616683ed404 100644 --- a/tests/baselines/reference/symbolProperty49.js +++ b/tests/baselines/reference/symbolProperty49.js @@ -10,7 +10,6 @@ module M { //// [symbolProperty49.js] var M; (function (M) { - M.Symbol; class C { [M.Symbol.iterator]() { } } diff --git a/tests/baselines/reference/systemModule11.js b/tests/baselines/reference/systemModule11.js index 91c05e8263a..55011214042 100644 --- a/tests/baselines/reference/systemModule11.js +++ b/tests/baselines/reference/systemModule11.js @@ -61,7 +61,6 @@ System.register(['bar'], function(exports_1) { exportStar_1(_bar_1); }], execute: function() { - exports_1("x", x); } } }); @@ -128,7 +127,6 @@ System.register(['a'], function(exports_1) { exports_1("s2", _a_1["s1"]); }], execute: function() { - exports_1("x", x); exports_1("z", z); exports_1("z2", z1); } diff --git a/tests/baselines/reference/systemModule4.js b/tests/baselines/reference/systemModule4.js index 0b045b620ff..2b06d04e06f 100644 --- a/tests/baselines/reference/systemModule4.js +++ b/tests/baselines/reference/systemModule4.js @@ -10,7 +10,6 @@ System.register([], function(exports_1) { setters:[], execute: function() { exports_1("x", x = 1); - exports_1("y", y); } } }); diff --git a/tests/baselines/reference/systemModule8.js b/tests/baselines/reference/systemModule8.js index 578814d0ab2..6196005dc62 100644 --- a/tests/baselines/reference/systemModule8.js +++ b/tests/baselines/reference/systemModule8.js @@ -39,7 +39,6 @@ System.register([], function(exports_1) { return { setters:[], execute: function() { - exports_1("x", x); exports_1("x", x = 1); (exports_1("x", ++x) - 1); (exports_1("x", --x) + 1); diff --git a/tests/baselines/reference/systemModuleAmbientDeclarations.js b/tests/baselines/reference/systemModuleAmbientDeclarations.js new file mode 100644 index 00000000000..82c18cd7981 --- /dev/null +++ b/tests/baselines/reference/systemModuleAmbientDeclarations.js @@ -0,0 +1,84 @@ +//// [tests/cases/compiler/systemModuleAmbientDeclarations.ts] //// + +//// [file1.ts] + +declare class Promise { } +declare function Foo(): void; +declare class C {} +declare enum E {X = 1}; + +export var promise = Promise; +export var foo = Foo; +export var c = C; +export var e = E; + +//// [file2.ts] +export declare function foo(); + +//// [file3.ts] +export declare class C {} + +//// [file4.ts] +export declare var v: number; + +//// [file5.ts] +export declare enum E {X = 1} + +//// [file6.ts] +export declare module M { var v: number; } + + +//// [file1.js] +System.register([], function(exports_1) { + var promise, foo, c, e; + return { + setters:[], + execute: function() { + ; + exports_1("promise", promise = Promise); + exports_1("foo", foo = Foo); + exports_1("c", c = C); + exports_1("e", e = E); + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file3.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file4.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file5.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file6.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); diff --git a/tests/baselines/reference/systemModuleAmbientDeclarations.symbols b/tests/baselines/reference/systemModuleAmbientDeclarations.symbols new file mode 100644 index 00000000000..c2e8557270b --- /dev/null +++ b/tests/baselines/reference/systemModuleAmbientDeclarations.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/file1.ts === + +declare class Promise { } +>Promise : Symbol(Promise, Decl(file1.ts, 0, 0)) + +declare function Foo(): void; +>Foo : Symbol(Foo, Decl(file1.ts, 1, 25)) + +declare class C {} +>C : Symbol(C, Decl(file1.ts, 2, 29)) + +declare enum E {X = 1}; +>E : Symbol(E, Decl(file1.ts, 3, 18)) +>X : Symbol(E.X, Decl(file1.ts, 4, 16)) + +export var promise = Promise; +>promise : Symbol(promise, Decl(file1.ts, 6, 10)) +>Promise : Symbol(Promise, Decl(file1.ts, 0, 0)) + +export var foo = Foo; +>foo : Symbol(foo, Decl(file1.ts, 7, 10)) +>Foo : Symbol(Foo, Decl(file1.ts, 1, 25)) + +export var c = C; +>c : Symbol(c, Decl(file1.ts, 8, 10)) +>C : Symbol(C, Decl(file1.ts, 2, 29)) + +export var e = E; +>e : Symbol(e, Decl(file1.ts, 9, 10)) +>E : Symbol(E, Decl(file1.ts, 3, 18)) + +=== tests/cases/compiler/file2.ts === +export declare function foo(); +>foo : Symbol(foo, Decl(file2.ts, 0, 0)) + +=== tests/cases/compiler/file3.ts === +export declare class C {} +>C : Symbol(C, Decl(file3.ts, 0, 0)) + +=== tests/cases/compiler/file4.ts === +export declare var v: number; +>v : Symbol(v, Decl(file4.ts, 0, 18)) + +=== tests/cases/compiler/file5.ts === +export declare enum E {X = 1} +>E : Symbol(E, Decl(file5.ts, 0, 0)) +>X : Symbol(E.X, Decl(file5.ts, 0, 23)) + +=== tests/cases/compiler/file6.ts === +export declare module M { var v: number; } +>M : Symbol(M, Decl(file6.ts, 0, 0)) +>v : Symbol(v, Decl(file6.ts, 0, 29)) + diff --git a/tests/baselines/reference/systemModuleAmbientDeclarations.types b/tests/baselines/reference/systemModuleAmbientDeclarations.types new file mode 100644 index 00000000000..3633f922881 --- /dev/null +++ b/tests/baselines/reference/systemModuleAmbientDeclarations.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/file1.ts === + +declare class Promise { } +>Promise : Promise + +declare function Foo(): void; +>Foo : () => void + +declare class C {} +>C : C + +declare enum E {X = 1}; +>E : E +>X : E +>1 : number + +export var promise = Promise; +>promise : typeof Promise +>Promise : typeof Promise + +export var foo = Foo; +>foo : () => void +>Foo : () => void + +export var c = C; +>c : typeof C +>C : typeof C + +export var e = E; +>e : typeof E +>E : typeof E + +=== tests/cases/compiler/file2.ts === +export declare function foo(); +>foo : () => any + +=== tests/cases/compiler/file3.ts === +export declare class C {} +>C : C + +=== tests/cases/compiler/file4.ts === +export declare var v: number; +>v : number + +=== tests/cases/compiler/file5.ts === +export declare enum E {X = 1} +>E : E +>X : E +>1 : number + +=== tests/cases/compiler/file6.ts === +export declare module M { var v: number; } +>M : typeof M +>v : number + diff --git a/tests/baselines/reference/systemModuleConstEnums.js b/tests/baselines/reference/systemModuleConstEnums.js new file mode 100644 index 00000000000..126e6266b2c --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnums.js @@ -0,0 +1,27 @@ +//// [systemModuleConstEnums.ts] + +declare function use(a: any); +const enum TopLevelConstEnum { X } + +export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); +} + +module M { + export const enum NonTopLevelConstEnum { X } +} + +//// [systemModuleConstEnums.js] +System.register([], function(exports_1) { + function foo() { + use(0 /* X */); + use(0 /* X */); + } + exports_1("foo", foo); + return { + setters:[], + execute: function() { + } + } +}); diff --git a/tests/baselines/reference/systemModuleConstEnums.symbols b/tests/baselines/reference/systemModuleConstEnums.symbols new file mode 100644 index 00000000000..171f24628ec --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnums.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/systemModuleConstEnums.ts === + +declare function use(a: any); +>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0)) +>a : Symbol(a, Decl(systemModuleConstEnums.ts, 1, 21)) + +const enum TopLevelConstEnum { X } +>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnums.ts, 1, 29)) +>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30)) + +export function foo() { +>foo : Symbol(foo, Decl(systemModuleConstEnums.ts, 2, 34)) + + use(TopLevelConstEnum.X); +>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0)) +>TopLevelConstEnum.X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30)) +>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnums.ts, 1, 29)) +>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 2, 30)) + + use(M.NonTopLevelConstEnum.X); +>use : Symbol(use, Decl(systemModuleConstEnums.ts, 0, 0)) +>M.NonTopLevelConstEnum.X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44)) +>M.NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10)) +>M : Symbol(M, Decl(systemModuleConstEnums.ts, 7, 1)) +>NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10)) +>X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44)) +} + +module M { +>M : Symbol(M, Decl(systemModuleConstEnums.ts, 7, 1)) + + export const enum NonTopLevelConstEnum { X } +>NonTopLevelConstEnum : Symbol(NonTopLevelConstEnum, Decl(systemModuleConstEnums.ts, 9, 10)) +>X : Symbol(NonTopLevelConstEnum.X, Decl(systemModuleConstEnums.ts, 10, 44)) +} diff --git a/tests/baselines/reference/systemModuleConstEnums.types b/tests/baselines/reference/systemModuleConstEnums.types new file mode 100644 index 00000000000..193de0da3ab --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnums.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/systemModuleConstEnums.ts === + +declare function use(a: any); +>use : (a: any) => any +>a : any + +const enum TopLevelConstEnum { X } +>TopLevelConstEnum : TopLevelConstEnum +>X : TopLevelConstEnum + +export function foo() { +>foo : () => void + + use(TopLevelConstEnum.X); +>use(TopLevelConstEnum.X) : any +>use : (a: any) => any +>TopLevelConstEnum.X : TopLevelConstEnum +>TopLevelConstEnum : typeof TopLevelConstEnum +>X : TopLevelConstEnum + + use(M.NonTopLevelConstEnum.X); +>use(M.NonTopLevelConstEnum.X) : any +>use : (a: any) => any +>M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum +>M.NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum +>M : typeof M +>NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum +>X : M.NonTopLevelConstEnum +} + +module M { +>M : typeof M + + export const enum NonTopLevelConstEnum { X } +>NonTopLevelConstEnum : NonTopLevelConstEnum +>X : NonTopLevelConstEnum +} diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js new file mode 100644 index 00000000000..381331a84db --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.js @@ -0,0 +1,37 @@ +//// [systemModuleConstEnumsSeparateCompilation.ts] + +declare function use(a: any); +const enum TopLevelConstEnum { X } + +export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); +} + +module M { + export const enum NonTopLevelConstEnum { X } +} + +//// [systemModuleConstEnumsSeparateCompilation.js] +System.register([], function(exports_1) { + var TopLevelConstEnum, M; + function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); + } + exports_1("foo", foo); + return { + setters:[], + execute: function() { + (function (TopLevelConstEnum) { + TopLevelConstEnum[TopLevelConstEnum["X"] = 0] = "X"; + })(TopLevelConstEnum || (TopLevelConstEnum = {})); + (function (M) { + (function (NonTopLevelConstEnum) { + NonTopLevelConstEnum[NonTopLevelConstEnum["X"] = 0] = "X"; + })(M.NonTopLevelConstEnum || (M.NonTopLevelConstEnum = {})); + var NonTopLevelConstEnum = M.NonTopLevelConstEnum; + })(M || (M = {})); + } + } +}); diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.symbols b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.symbols new file mode 100644 index 00000000000..d57740b75e9 --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts === + +declare function use(a: any); +>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0)) +>a : Symbol(a, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 21)) + +const enum TopLevelConstEnum { X } +>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 29)) +>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30)) + +export function foo() { +>foo : Symbol(foo, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 34)) + + use(TopLevelConstEnum.X); +>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0)) +>TopLevelConstEnum.X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30)) +>TopLevelConstEnum : Symbol(TopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 1, 29)) +>X : Symbol(TopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 2, 30)) + + use(M.NonTopLevelConstEnum.X); +>use : Symbol(use, Decl(systemModuleConstEnumsSeparateCompilation.ts, 0, 0)) +>M.NonTopLevelConstEnum.X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44)) +>M.NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10)) +>M : Symbol(M, Decl(systemModuleConstEnumsSeparateCompilation.ts, 7, 1)) +>NonTopLevelConstEnum : Symbol(M.NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10)) +>X : Symbol(M.NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44)) +} + +module M { +>M : Symbol(M, Decl(systemModuleConstEnumsSeparateCompilation.ts, 7, 1)) + + export const enum NonTopLevelConstEnum { X } +>NonTopLevelConstEnum : Symbol(NonTopLevelConstEnum, Decl(systemModuleConstEnumsSeparateCompilation.ts, 9, 10)) +>X : Symbol(NonTopLevelConstEnum.X, Decl(systemModuleConstEnumsSeparateCompilation.ts, 10, 44)) +} diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types new file mode 100644 index 00000000000..c3a352f66ec --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts === + +declare function use(a: any); +>use : (a: any) => any +>a : any + +const enum TopLevelConstEnum { X } +>TopLevelConstEnum : TopLevelConstEnum +>X : TopLevelConstEnum + +export function foo() { +>foo : () => void + + use(TopLevelConstEnum.X); +>use(TopLevelConstEnum.X) : any +>use : (a: any) => any +>TopLevelConstEnum.X : TopLevelConstEnum +>TopLevelConstEnum : typeof TopLevelConstEnum +>X : TopLevelConstEnum + + use(M.NonTopLevelConstEnum.X); +>use(M.NonTopLevelConstEnum.X) : any +>use : (a: any) => any +>M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum +>M.NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum +>M : typeof M +>NonTopLevelConstEnum : typeof M.NonTopLevelConstEnum +>X : M.NonTopLevelConstEnum +} + +module M { +>M : typeof M + + export const enum NonTopLevelConstEnum { X } +>NonTopLevelConstEnum : NonTopLevelConstEnum +>X : NonTopLevelConstEnum +} diff --git a/tests/baselines/reference/systemModuleDeclarationMerging.js b/tests/baselines/reference/systemModuleDeclarationMerging.js new file mode 100644 index 00000000000..b745ed04891 --- /dev/null +++ b/tests/baselines/reference/systemModuleDeclarationMerging.js @@ -0,0 +1,43 @@ +//// [systemModuleDeclarationMerging.ts] + +export function F() {} +export module F { var x; } + +export class C {} +export module C { var x; } + +export enum E {} +export module E { var x; } + +//// [systemModuleDeclarationMerging.js] +System.register([], function(exports_1) { + var F, C, E; + function F() { } + exports_1("F", F); + return { + setters:[], + execute: function() { + (function (F) { + var x; + })(F = F || (F = {})); + exports_1("F", F) + C = (function () { + function C() { + } + return C; + })(); + exports_1("C", C); + (function (C) { + var x; + })(C = C || (C = {})); + exports_1("C", C) + (function (E) { + })(E || (E = {})); + exports_1("E", E) + (function (E) { + var x; + })(E = E || (E = {})); + exports_1("E", E) + } + } +}); diff --git a/tests/baselines/reference/systemModuleDeclarationMerging.symbols b/tests/baselines/reference/systemModuleDeclarationMerging.symbols new file mode 100644 index 00000000000..8efce4022ba --- /dev/null +++ b/tests/baselines/reference/systemModuleDeclarationMerging.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/systemModuleDeclarationMerging.ts === + +export function F() {} +>F : Symbol(F, Decl(systemModuleDeclarationMerging.ts, 0, 0), Decl(systemModuleDeclarationMerging.ts, 1, 22)) + +export module F { var x; } +>F : Symbol(F, Decl(systemModuleDeclarationMerging.ts, 0, 0), Decl(systemModuleDeclarationMerging.ts, 1, 22)) +>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 2, 21)) + +export class C {} +>C : Symbol(C, Decl(systemModuleDeclarationMerging.ts, 2, 26), Decl(systemModuleDeclarationMerging.ts, 4, 17)) + +export module C { var x; } +>C : Symbol(C, Decl(systemModuleDeclarationMerging.ts, 2, 26), Decl(systemModuleDeclarationMerging.ts, 4, 17)) +>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 5, 21)) + +export enum E {} +>E : Symbol(E, Decl(systemModuleDeclarationMerging.ts, 5, 26), Decl(systemModuleDeclarationMerging.ts, 7, 16)) + +export module E { var x; } +>E : Symbol(E, Decl(systemModuleDeclarationMerging.ts, 5, 26), Decl(systemModuleDeclarationMerging.ts, 7, 16)) +>x : Symbol(x, Decl(systemModuleDeclarationMerging.ts, 8, 21)) + diff --git a/tests/baselines/reference/systemModuleDeclarationMerging.types b/tests/baselines/reference/systemModuleDeclarationMerging.types new file mode 100644 index 00000000000..20bf1e67f51 --- /dev/null +++ b/tests/baselines/reference/systemModuleDeclarationMerging.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/systemModuleDeclarationMerging.ts === + +export function F() {} +>F : typeof F + +export module F { var x; } +>F : typeof F +>x : any + +export class C {} +>C : C + +export module C { var x; } +>C : typeof C +>x : any + +export enum E {} +>E : E + +export module E { var x; } +>E : typeof E +>x : any + diff --git a/tests/baselines/reference/systemModuleExportDefault.js b/tests/baselines/reference/systemModuleExportDefault.js new file mode 100644 index 00000000000..4df3ec828c1 --- /dev/null +++ b/tests/baselines/reference/systemModuleExportDefault.js @@ -0,0 +1,67 @@ +//// [tests/cases/compiler/systemModuleExportDefault.ts] //// + +//// [file1.ts] + +export default function() {} + +//// [file2.ts] +export default function foo() {} + +//// [file3.ts] +export default class {} + +//// [file4.ts] +export default class C {} + + + +//// [file1.js] +System.register([], function(exports_1) { + function default_1() { } + exports_1("default", default_1); + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + function foo() { } + exports_1("default", foo); + return { + setters:[], + execute: function() { + } + } +}); +//// [file3.js] +System.register([], function(exports_1) { + var default_1; + return { + setters:[], + execute: function() { + default_1 = (function () { + function default_1() { + } + return default_1; + })(); + exports_1("default", default_1); + } + } +}); +//// [file4.js] +System.register([], function(exports_1) { + var C; + return { + setters:[], + execute: function() { + C = (function () { + function C() { + } + return C; + })(); + exports_1("default", C); + } + } +}); diff --git a/tests/baselines/reference/systemModuleExportDefault.symbols b/tests/baselines/reference/systemModuleExportDefault.symbols new file mode 100644 index 00000000000..d6e7cde9b71 --- /dev/null +++ b/tests/baselines/reference/systemModuleExportDefault.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +No type information for this code.export default function() {} +No type information for this code. +No type information for this code.=== tests/cases/compiler/file2.ts === +export default function foo() {} +>foo : Symbol(foo, Decl(file2.ts, 0, 0)) + +=== tests/cases/compiler/file3.ts === +export default class {} +No type information for this code. +No type information for this code.=== tests/cases/compiler/file4.ts === +export default class C {} +>C : Symbol(C, Decl(file4.ts, 0, 0)) + + diff --git a/tests/baselines/reference/systemModuleExportDefault.types b/tests/baselines/reference/systemModuleExportDefault.types new file mode 100644 index 00000000000..38b5abec8ed --- /dev/null +++ b/tests/baselines/reference/systemModuleExportDefault.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +No type information for this code.export default function() {} +No type information for this code. +No type information for this code.=== tests/cases/compiler/file2.ts === +export default function foo() {} +>foo : () => void + +=== tests/cases/compiler/file3.ts === +export default class {} +No type information for this code. +No type information for this code.=== tests/cases/compiler/file4.ts === +export default class C {} +>C : C + + diff --git a/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js new file mode 100644 index 00000000000..87e96259bf1 --- /dev/null +++ b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.js @@ -0,0 +1,58 @@ +//// [systemModuleNonTopLevelModuleMembers.ts] + +export class TopLevelClass {} +export module TopLevelModule {var v;} +export function TopLevelFunction(): void {} +export enum TopLevelEnum {E} + +export module TopLevelModule2 { + export class NonTopLevelClass {} + export module NonTopLevelModule {var v;} + export function NonTopLevelFunction(): void {} + export enum NonTopLevelEnum {E} +} + +//// [systemModuleNonTopLevelModuleMembers.js] +System.register([], function(exports_1) { + var TopLevelClass, TopLevelModule, TopLevelEnum, TopLevelModule2; + function TopLevelFunction() { } + exports_1("TopLevelFunction", TopLevelFunction); + return { + setters:[], + execute: function() { + TopLevelClass = (function () { + function TopLevelClass() { + } + return TopLevelClass; + })(); + exports_1("TopLevelClass", TopLevelClass); + (function (TopLevelModule) { + var v; + })(TopLevelModule = TopLevelModule || (TopLevelModule = {})); + exports_1("TopLevelModule", TopLevelModule) + (function (TopLevelEnum) { + TopLevelEnum[TopLevelEnum["E"] = 0] = "E"; + })(TopLevelEnum || (TopLevelEnum = {})); + exports_1("TopLevelEnum", TopLevelEnum) + (function (TopLevelModule2) { + var NonTopLevelClass = (function () { + function NonTopLevelClass() { + } + return NonTopLevelClass; + })(); + TopLevelModule2.NonTopLevelClass = NonTopLevelClass; + var NonTopLevelModule; + (function (NonTopLevelModule) { + var v; + })(NonTopLevelModule = TopLevelModule2.NonTopLevelModule || (TopLevelModule2.NonTopLevelModule = {})); + function NonTopLevelFunction() { } + TopLevelModule2.NonTopLevelFunction = NonTopLevelFunction; + (function (NonTopLevelEnum) { + NonTopLevelEnum[NonTopLevelEnum["E"] = 0] = "E"; + })(TopLevelModule2.NonTopLevelEnum || (TopLevelModule2.NonTopLevelEnum = {})); + var NonTopLevelEnum = TopLevelModule2.NonTopLevelEnum; + })(TopLevelModule2 = TopLevelModule2 || (TopLevelModule2 = {})); + exports_1("TopLevelModule2", TopLevelModule2) + } + } +}); diff --git a/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.symbols b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.symbols new file mode 100644 index 00000000000..e0b69c71a2f --- /dev/null +++ b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts === + +export class TopLevelClass {} +>TopLevelClass : Symbol(TopLevelClass, Decl(systemModuleNonTopLevelModuleMembers.ts, 0, 0)) + +export module TopLevelModule {var v;} +>TopLevelModule : Symbol(TopLevelModule, Decl(systemModuleNonTopLevelModuleMembers.ts, 1, 29)) +>v : Symbol(v, Decl(systemModuleNonTopLevelModuleMembers.ts, 2, 33)) + +export function TopLevelFunction(): void {} +>TopLevelFunction : Symbol(TopLevelFunction, Decl(systemModuleNonTopLevelModuleMembers.ts, 2, 37)) + +export enum TopLevelEnum {E} +>TopLevelEnum : Symbol(TopLevelEnum, Decl(systemModuleNonTopLevelModuleMembers.ts, 3, 43)) +>E : Symbol(TopLevelEnum.E, Decl(systemModuleNonTopLevelModuleMembers.ts, 4, 26)) + +export module TopLevelModule2 { +>TopLevelModule2 : Symbol(TopLevelModule2, Decl(systemModuleNonTopLevelModuleMembers.ts, 4, 28)) + + export class NonTopLevelClass {} +>NonTopLevelClass : Symbol(NonTopLevelClass, Decl(systemModuleNonTopLevelModuleMembers.ts, 6, 31)) + + export module NonTopLevelModule {var v;} +>NonTopLevelModule : Symbol(NonTopLevelModule, Decl(systemModuleNonTopLevelModuleMembers.ts, 7, 36)) +>v : Symbol(v, Decl(systemModuleNonTopLevelModuleMembers.ts, 8, 40)) + + export function NonTopLevelFunction(): void {} +>NonTopLevelFunction : Symbol(NonTopLevelFunction, Decl(systemModuleNonTopLevelModuleMembers.ts, 8, 44)) + + export enum NonTopLevelEnum {E} +>NonTopLevelEnum : Symbol(NonTopLevelEnum, Decl(systemModuleNonTopLevelModuleMembers.ts, 9, 50)) +>E : Symbol(NonTopLevelEnum.E, Decl(systemModuleNonTopLevelModuleMembers.ts, 10, 33)) +} diff --git a/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.types b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.types new file mode 100644 index 00000000000..ffe3d23f7a6 --- /dev/null +++ b/tests/baselines/reference/systemModuleNonTopLevelModuleMembers.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts === + +export class TopLevelClass {} +>TopLevelClass : TopLevelClass + +export module TopLevelModule {var v;} +>TopLevelModule : typeof TopLevelModule +>v : any + +export function TopLevelFunction(): void {} +>TopLevelFunction : () => void + +export enum TopLevelEnum {E} +>TopLevelEnum : TopLevelEnum +>E : TopLevelEnum + +export module TopLevelModule2 { +>TopLevelModule2 : typeof TopLevelModule2 + + export class NonTopLevelClass {} +>NonTopLevelClass : NonTopLevelClass + + export module NonTopLevelModule {var v;} +>NonTopLevelModule : typeof NonTopLevelModule +>v : any + + export function NonTopLevelFunction(): void {} +>NonTopLevelFunction : () => void + + export enum NonTopLevelEnum {E} +>NonTopLevelEnum : NonTopLevelEnum +>E : NonTopLevelEnum +} diff --git a/tests/baselines/reference/topLevelFileModule.js b/tests/baselines/reference/topLevelFileModule.js index 4f8bc94dcf4..5d655f78397 100644 --- a/tests/baselines/reference/topLevelFileModule.js +++ b/tests/baselines/reference/topLevelFileModule.js @@ -13,7 +13,6 @@ var z = foo.x + fum.y; //// [foo_0.js] -exports.x; //// [foo_1.js] var foo = require("vs/foo_0"); var fum = require("vs/fum"); diff --git a/tests/baselines/reference/typeGuardsInExternalModule.js b/tests/baselines/reference/typeGuardsInExternalModule.js index 29950ece95a..88423e65ca1 100644 --- a/tests/baselines/reference/typeGuardsInExternalModule.js +++ b/tests/baselines/reference/typeGuardsInExternalModule.js @@ -37,7 +37,6 @@ else { } // exported variable in external module var strOrNum; -exports.var2; if (typeof exports.var2 === "string") { // export makes the var property and not variable strOrNum = exports.var2; // string | number diff --git a/tests/baselines/reference/typeGuardsInModule.js b/tests/baselines/reference/typeGuardsInModule.js index c72b9e58aa2..af87fae17ca 100644 --- a/tests/baselines/reference/typeGuardsInModule.js +++ b/tests/baselines/reference/typeGuardsInModule.js @@ -108,7 +108,6 @@ var m1; num = var2; // number } // exported variable in the module - m1.var3; if (typeof m1.var3 === "string") { strOrNum = m1.var3; // string | number } @@ -120,7 +119,6 @@ var m1; var m2; (function (m2) { var var2; - m2.var3; var m3; (function (m3) { // global vars in function declaration @@ -138,7 +136,6 @@ var m2; num = var4; // number } // exported variable in the module - m3.var5; if (typeof m3.var5 === "string") { strOrNum = m3.var5; // string | number } @@ -163,7 +160,6 @@ var m3; num = var2; // number } // exported variable in the module - m4.var3; if (typeof m4.var3 === "string") { strOrNum = m4.var3; // string | number } diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt new file mode 100644 index 00000000000..4960940d3ab --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -0,0 +1,229 @@ +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(12,10): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(65,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(111,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. + + +==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts (12 errors) ==== + interface AConstructor { + new (): A; + } + interface A { + foo: string; + } + declare var A: AConstructor; + + var obj1: A | string; + if (obj1 instanceof A) { // narrowed to A. + obj1.foo; + obj1.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'A'. + } + + var obj2: any; + if (obj2 instanceof A) { // can't narrow type from 'any' + obj2.foo; + obj2.bar; + } + + // a construct signature with generics + interface BConstructor { + new (): B; + } + interface B { + foo: T; + } + declare var B: BConstructor; + + var obj3: B | string; + if (obj3 instanceof B) { // narrowed to B. + obj3.foo = 1; + obj3.foo = "str"; + ~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + obj3.bar = "str"; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'B'. + } + + var obj4: any; + if (obj4 instanceof B) { // can't narrow type from 'any' + obj4.foo = "str"; + obj4.foo = 1; + obj4.bar = "str"; + } + + // has multiple construct signature + interface CConstructor { + new (value: string): C1; + new (value: number): C2; + } + interface C1 { + foo: string; + c: string; + bar1: number; + } + interface C2 { + foo: string; + c: string; + bar2: number; + } + declare var C: CConstructor; + + var obj5: C1 | A; + if (obj5 instanceof C) { // narrowed to C1|C2. + obj5.foo; + obj5.c; + obj5.bar1; + ~~~~ +!!! error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. + obj5.bar2; + ~~~~ +!!! error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. + } + + var obj6: any; + if (obj6 instanceof C) { // can't narrow type from 'any' + obj6.foo; + obj6.bar1; + obj6.bar2; + } + + // with object type literal + interface D { + foo: string; + } + declare var D: { new (): D; }; + + var obj7: D | string; + if (obj7 instanceof D) { // narrowed to D. + obj7.foo; + obj7.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'D'. + } + + var obj8: any; + if (obj8 instanceof D) { // can't narrow type from 'any' + obj8.foo; + obj8.bar; + } + + // a construct signature that returns a union type + interface EConstructor { + new (): E1 | E2; + } + interface E1 { + foo: string; + bar1: number; + } + interface E2 { + foo: string; + bar2: number; + } + declare var E: EConstructor; + + var obj9: E1 | A; + if (obj9 instanceof E) { // narrowed to E1 | E2 + obj9.foo; + obj9.bar1; + ~~~~ +!!! error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. + obj9.bar2; + ~~~~ +!!! error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. + } + + var obj10: any; + if (obj10 instanceof E) { // can't narrow type from 'any' + obj10.foo; + obj10.bar1; + obj10.bar2; + } + + // a construct signature that returns any + interface FConstructor { + new (): any; + } + interface F { + foo: string; + bar: number; + } + declare var F: FConstructor; + + var obj11: F | string; + if (obj11 instanceof F) { // can't type narrowing, construct signature returns any. + obj11.foo; + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'string | F'. + obj11.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'string | F'. + } + + var obj12: any; + if (obj12 instanceof F) { // can't narrow type from 'any' + obj12.foo; + obj12.bar; + } + + // a type with a prototype, it overrides the construct signature + interface GConstructor { + prototype: G1; // high priority + new (): G2; // low priority + } + interface G1 { + foo1: number; + } + interface G2 { + foo2: boolean; + } + declare var G: GConstructor; + + var obj13: G1 | G2; + if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property. + obj13.foo1; + obj13.foo2; + ~~~~ +!!! error TS2339: Property 'foo2' does not exist on type 'G1'. + } + + var obj14: any; + if (obj14 instanceof G) { // can't narrow type from 'any' + obj14.foo1; + obj14.foo2; + } + + // a type with a prototype that has any type + interface HConstructor { + prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`. + new (): H; // low priority + } + interface H { + foo: number; + } + declare var H: HConstructor; + + var obj15: H | string; + if (obj15 instanceof H) { // narrowed to H. + obj15.foo; + obj15.bar; + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'H'. + } + + var obj16: any; + if (obj16 instanceof H) { // can't narrow type from 'any' + obj16.foo1; + obj16.foo2; + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js new file mode 100644 index 00000000000..7e6b3324470 --- /dev/null +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js @@ -0,0 +1,280 @@ +//// [typeGuardsWithInstanceOfByConstructorSignature.ts] +interface AConstructor { + new (): A; +} +interface A { + foo: string; +} +declare var A: AConstructor; + +var obj1: A | string; +if (obj1 instanceof A) { // narrowed to A. + obj1.foo; + obj1.bar; +} + +var obj2: any; +if (obj2 instanceof A) { // can't narrow type from 'any' + obj2.foo; + obj2.bar; +} + +// a construct signature with generics +interface BConstructor { + new (): B; +} +interface B { + foo: T; +} +declare var B: BConstructor; + +var obj3: B | string; +if (obj3 instanceof B) { // narrowed to B. + obj3.foo = 1; + obj3.foo = "str"; + obj3.bar = "str"; +} + +var obj4: any; +if (obj4 instanceof B) { // can't narrow type from 'any' + obj4.foo = "str"; + obj4.foo = 1; + obj4.bar = "str"; +} + +// has multiple construct signature +interface CConstructor { + new (value: string): C1; + new (value: number): C2; +} +interface C1 { + foo: string; + c: string; + bar1: number; +} +interface C2 { + foo: string; + c: string; + bar2: number; +} +declare var C: CConstructor; + +var obj5: C1 | A; +if (obj5 instanceof C) { // narrowed to C1|C2. + obj5.foo; + obj5.c; + obj5.bar1; + obj5.bar2; +} + +var obj6: any; +if (obj6 instanceof C) { // can't narrow type from 'any' + obj6.foo; + obj6.bar1; + obj6.bar2; +} + +// with object type literal +interface D { + foo: string; +} +declare var D: { new (): D; }; + +var obj7: D | string; +if (obj7 instanceof D) { // narrowed to D. + obj7.foo; + obj7.bar; +} + +var obj8: any; +if (obj8 instanceof D) { // can't narrow type from 'any' + obj8.foo; + obj8.bar; +} + +// a construct signature that returns a union type +interface EConstructor { + new (): E1 | E2; +} +interface E1 { + foo: string; + bar1: number; +} +interface E2 { + foo: string; + bar2: number; +} +declare var E: EConstructor; + +var obj9: E1 | A; +if (obj9 instanceof E) { // narrowed to E1 | E2 + obj9.foo; + obj9.bar1; + obj9.bar2; +} + +var obj10: any; +if (obj10 instanceof E) { // can't narrow type from 'any' + obj10.foo; + obj10.bar1; + obj10.bar2; +} + +// a construct signature that returns any +interface FConstructor { + new (): any; +} +interface F { + foo: string; + bar: number; +} +declare var F: FConstructor; + +var obj11: F | string; +if (obj11 instanceof F) { // can't type narrowing, construct signature returns any. + obj11.foo; + obj11.bar; +} + +var obj12: any; +if (obj12 instanceof F) { // can't narrow type from 'any' + obj12.foo; + obj12.bar; +} + +// a type with a prototype, it overrides the construct signature +interface GConstructor { + prototype: G1; // high priority + new (): G2; // low priority +} +interface G1 { + foo1: number; +} +interface G2 { + foo2: boolean; +} +declare var G: GConstructor; + +var obj13: G1 | G2; +if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property. + obj13.foo1; + obj13.foo2; +} + +var obj14: any; +if (obj14 instanceof G) { // can't narrow type from 'any' + obj14.foo1; + obj14.foo2; +} + +// a type with a prototype that has any type +interface HConstructor { + prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`. + new (): H; // low priority +} +interface H { + foo: number; +} +declare var H: HConstructor; + +var obj15: H | string; +if (obj15 instanceof H) { // narrowed to H. + obj15.foo; + obj15.bar; +} + +var obj16: any; +if (obj16 instanceof H) { // can't narrow type from 'any' + obj16.foo1; + obj16.foo2; +} + + +//// [typeGuardsWithInstanceOfByConstructorSignature.js] +var obj1; +if (obj1 instanceof A) { + obj1.foo; + obj1.bar; +} +var obj2; +if (obj2 instanceof A) { + obj2.foo; + obj2.bar; +} +var obj3; +if (obj3 instanceof B) { + obj3.foo = 1; + obj3.foo = "str"; + obj3.bar = "str"; +} +var obj4; +if (obj4 instanceof B) { + obj4.foo = "str"; + obj4.foo = 1; + obj4.bar = "str"; +} +var obj5; +if (obj5 instanceof C) { + obj5.foo; + obj5.c; + obj5.bar1; + obj5.bar2; +} +var obj6; +if (obj6 instanceof C) { + obj6.foo; + obj6.bar1; + obj6.bar2; +} +var obj7; +if (obj7 instanceof D) { + obj7.foo; + obj7.bar; +} +var obj8; +if (obj8 instanceof D) { + obj8.foo; + obj8.bar; +} +var obj9; +if (obj9 instanceof E) { + obj9.foo; + obj9.bar1; + obj9.bar2; +} +var obj10; +if (obj10 instanceof E) { + obj10.foo; + obj10.bar1; + obj10.bar2; +} +var obj11; +if (obj11 instanceof F) { + obj11.foo; + obj11.bar; +} +var obj12; +if (obj12 instanceof F) { + obj12.foo; + obj12.bar; +} +var obj13; +if (obj13 instanceof G) { + obj13.foo1; + obj13.foo2; +} +var obj14; +if (obj14 instanceof G) { + obj14.foo1; + obj14.foo2; +} +var obj15; +if (obj15 instanceof H) { + obj15.foo; + obj15.bar; +} +var obj16; +if (obj16 instanceof H) { + obj16.foo1; + obj16.foo2; +} diff --git a/tests/baselines/reference/typeofANonExportedType.js b/tests/baselines/reference/typeofANonExportedType.js index bb41ddfab7a..5b24d9bc102 100644 --- a/tests/baselines/reference/typeofANonExportedType.js +++ b/tests/baselines/reference/typeofANonExportedType.js @@ -53,23 +53,14 @@ export var r13: typeof foo; //// [typeofANonExportedType.js] var x = 1; -exports.r1; var y = { foo: '' }; -exports.r2; var C = (function () { function C() { } return C; })(); -exports.c; var c2; -exports.r3; -exports.r4; -exports.r4b; -exports.i; var i2; -exports.r5; -exports.r5; var M; (function (M) { M.foo = ''; @@ -80,17 +71,10 @@ var M; })(); M.C = C; })(M || (M = {})); -exports.r6; -exports.r7; -exports.r8; -exports.r9; var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); -exports.r10; -exports.r11; -exports.r12; function foo() { } var foo; (function (foo) { @@ -102,4 +86,3 @@ var foo; })(); foo.C = C; })(foo || (foo = {})); -exports.r13; diff --git a/tests/baselines/reference/typeofAnExportedType.js b/tests/baselines/reference/typeofAnExportedType.js index af6c405a3cf..54de4f7566b 100644 --- a/tests/baselines/reference/typeofAnExportedType.js +++ b/tests/baselines/reference/typeofAnExportedType.js @@ -53,24 +53,15 @@ export var r13: typeof foo; //// [typeofAnExportedType.js] exports.x = 1; -exports.r1; exports.y = { foo: '' }; -exports.r2; var C = (function () { function C() { } return C; })(); exports.C = C; -exports.c; var c2; -exports.r3; -exports.r4; -exports.r4b; -exports.i; var i2; -exports.r5; -exports.r5; var M; (function (M) { M.foo = ''; @@ -81,18 +72,11 @@ var M; })(); M.C = C; })(M = exports.M || (exports.M = {})); -exports.r6; -exports.r7; exports.Z = M; -exports.r8; -exports.r9; (function (E) { E[E["A"] = 0] = "A"; })(exports.E || (exports.E = {})); var E = exports.E; -exports.r10; -exports.r11; -exports.r12; function foo() { } exports.foo = foo; var foo; @@ -105,4 +89,3 @@ var foo; })(); foo.C = C; })(foo = exports.foo || (exports.foo = {})); -exports.r13; diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js index a497519f249..1c66c5f4d1e 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js @@ -96,7 +96,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index 82af3eac26f..c0538b78b14 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -62,7 +62,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index 14b45ab518f..b980b820ce1 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -70,7 +70,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index 381205ff8c1..9b5cbb20b36 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -70,7 +70,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js new file mode 100644 index 00000000000..f8a5cd96b48 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js @@ -0,0 +1,44 @@ +//// [unionTypeWithRecursiveSubtypeReduction1.ts] +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var t: Class | Property; +t.parent; + + +//// [unionTypeWithRecursiveSubtypeReduction1.js] +var Module = (function () { + function Module() { + } + return Module; +})(); +var Namespace = (function () { + function Namespace() { + } + return Namespace; +})(); +var Class = (function () { + function Class() { + } + return Class; +})(); +var Property = (function () { + function Property() { + } + return Property; +})(); +var t; +t.parent; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols new file mode 100644 index 00000000000..24ba3b8a8cd --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols @@ -0,0 +1,45 @@ +=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts === +class Module { +>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) + + public members: Class[]; +>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 14)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +} + +class Namespace { +>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) + + public members: (Class | Property)[]; +>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 4, 17)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) +} + +class Class { +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) + + public parent: Namespace; +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13)) +>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) +} + +class Property { +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) + + public parent: Module | Class; +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) +>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +} + +var t: Class | Property; +>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 16, 3)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) + +t.parent; +>t.parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) +>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 16, 3)) +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) + diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types new file mode 100644 index 00000000000..c6fa610e68a --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts === +class Module { +>Module : Module + + public members: Class[]; +>members : Class[] +>Class : Class +} + +class Namespace { +>Namespace : Namespace + + public members: (Class | Property)[]; +>members : (Class | Property)[] +>Class : Class +>Property : Property +} + +class Class { +>Class : Class + + public parent: Namespace; +>parent : Namespace +>Namespace : Namespace +} + +class Property { +>Property : Property + + public parent: Module | Class; +>parent : Module | Class +>Module : Module +>Class : Class +} + +var t: Class | Property; +>t : Class | Property +>Class : Class +>Property : Property + +t.parent; +>t.parent : Class | Namespace +>t : Class | Property +>parent : Class | Namespace + diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt new file mode 100644 index 00000000000..d481b88810c --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt @@ -0,0 +1,46 @@ +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(19,1): error TS2322: Type 'Property' is not assignable to type 'Class'. + Types of property 'parent' are incompatible. + Type 'Module | Class' is not assignable to type 'Namespace'. + Type 'Class' is not assignable to type 'Namespace'. + Property 'members' is missing in type 'Class'. +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is not assignable to type 'Property'. + Types of property 'parent' are incompatible. + Type 'Namespace' is not assignable to type 'Module | Class'. + Type 'Namespace' is not assignable to type 'Class'. + Property 'parent' is missing in type 'Namespace'. + + +==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ==== + class Module { + public members: Class[]; + } + + class Namespace { + public members: (Class | Property)[]; + } + + class Class { + public parent: Namespace; + } + + class Property { + public parent: Module | Class; + } + + var c: Class; + var p: Property; + c = p; + ~ +!!! error TS2322: Type 'Property' is not assignable to type 'Class'. +!!! error TS2322: Types of property 'parent' are incompatible. +!!! error TS2322: Type 'Module | Class' is not assignable to type 'Namespace'. +!!! error TS2322: Type 'Class' is not assignable to type 'Namespace'. +!!! error TS2322: Property 'members' is missing in type 'Class'. + p = c; + ~ +!!! error TS2322: Type 'Class' is not assignable to type 'Property'. +!!! error TS2322: Types of property 'parent' are incompatible. +!!! error TS2322: Type 'Namespace' is not assignable to type 'Module | Class'. +!!! error TS2322: Type 'Namespace' is not assignable to type 'Class'. +!!! error TS2322: Property 'parent' is missing in type 'Namespace'. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js new file mode 100644 index 00000000000..69411b1ffcb --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js @@ -0,0 +1,48 @@ +//// [unionTypeWithRecursiveSubtypeReduction2.ts] +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var c: Class; +var p: Property; +c = p; +p = c; + + +//// [unionTypeWithRecursiveSubtypeReduction2.js] +var Module = (function () { + function Module() { + } + return Module; +})(); +var Namespace = (function () { + function Namespace() { + } + return Namespace; +})(); +var Class = (function () { + function Class() { + } + return Class; +})(); +var Property = (function () { + function Property() { + } + return Property; +})(); +var c; +var p; +c = p; +p = c; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt new file mode 100644 index 00000000000..279119e679a --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts(5,5): error TS2322: Type '{ prop: number; } | { prop: { prop: number; } | any; }' is not assignable to type 'string'. + Type '{ prop: number; }' is not assignable to type 'string'. + + +==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts (1 errors) ==== + var a27: { prop: number } | { prop: T27 }; + type T27 = typeof a27; + + var b: T27; + var s: string = b; + ~ +!!! error TS2322: Type '{ prop: number; } | { prop: { prop: number; } | any; }' is not assignable to type 'string'. +!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js new file mode 100644 index 00000000000..7c336015059 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js @@ -0,0 +1,12 @@ +//// [unionTypeWithRecursiveSubtypeReduction3.ts] +var a27: { prop: number } | { prop: T27 }; +type T27 = typeof a27; + +var b: T27; +var s: string = b; + + +//// [unionTypeWithRecursiveSubtypeReduction3.js] +var a27; +var b; +var s = b; diff --git a/tests/baselines/reference/unknownSymbols2.errors.txt b/tests/baselines/reference/unknownSymbols2.errors.txt index e78b4a14b61..e85d3c2f3bc 100644 --- a/tests/baselines/reference/unknownSymbols2.errors.txt +++ b/tests/baselines/reference/unknownSymbols2.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/unknownSymbols2.ts(15,13): error TS2304: Cannot find name ' tests/cases/compiler/unknownSymbols2.ts(16,14): error TS2304: Cannot find name 'qwerty'. tests/cases/compiler/unknownSymbols2.ts(22,19): error TS2304: Cannot find name 'asdf'. tests/cases/compiler/unknownSymbols2.ts(23,32): error TS2304: Cannot find name 'qwerty'. -tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2304: Cannot find name 'asdf'. +tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2503: Cannot find namespace 'asdf'. ==== tests/cases/compiler/unknownSymbols2.ts (10 errors) ==== @@ -59,5 +59,5 @@ tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2304: Cannot find name ' import c = N; import d = asdf; ~~~~ -!!! error TS2304: Cannot find name 'asdf'. +!!! error TS2503: Cannot find namespace 'asdf'. } \ No newline at end of file diff --git a/tests/baselines/reference/varBlock.js b/tests/baselines/reference/varBlock.js index 25ee5001d70..a3309338ecb 100644 --- a/tests/baselines/reference/varBlock.js +++ b/tests/baselines/reference/varBlock.js @@ -42,7 +42,7 @@ declare var c = 10; //// [varBlock.js] var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; })(m2 || (m2 = {})); var m3; (function (m3) { diff --git a/tests/baselines/reference/vardecl.js b/tests/baselines/reference/vardecl.js index 3ff8f4e8ab3..9b19e1000a9 100644 --- a/tests/baselines/reference/vardecl.js +++ b/tests/baselines/reference/vardecl.js @@ -130,7 +130,7 @@ var n4; var d4; var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; var m1; var a2, b22 = 10, b222; var m3; @@ -149,8 +149,6 @@ var m2; m2.C2 = C2; var m; var b23; - m2.mE; - m2.b2E; })(m2 || (m2 = {})); var a22, b22 = 10, c22 = 30; var nn; diff --git a/tests/baselines/reference/voidOperatorWithAnyOtherType.js b/tests/baselines/reference/voidOperatorWithAnyOtherType.js index e06aae7fe46..fbe85326d3a 100644 --- a/tests/baselines/reference/voidOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/voidOperatorWithAnyOtherType.js @@ -82,7 +82,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 69c609c1280..25099108b9b 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index 2426690489d..9a0a31d4fe5 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 9f30d1fcb0c..5949c93acd4 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/withExportDecl.js b/tests/baselines/reference/withExportDecl.js index ccd13123721..8d8b8b817ea 100644 --- a/tests/baselines/reference/withExportDecl.js +++ b/tests/baselines/reference/withExportDecl.js @@ -61,7 +61,6 @@ export var eVar3 = 10, eVar4, eVar5; //// [withExportDecl.js] define(["require", "exports"], function (require, exports) { var simpleVar; - exports.exportedSimpleVar; var anotherVar; var varWithSimpleType; var varWithArrayType; @@ -70,7 +69,6 @@ define(["require", "exports"], function (require, exports) { var withComplicatedValue = { x: 30, y: 70, desc: "position" }; exports.exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" }; var arrayVar = ['a', 'b']; - exports.exportedArrayVar; exports.exportedArrayVar.push({ x: 30, y: 'hello world' }); function simpleFunction() { return { @@ -97,9 +95,9 @@ define(["require", "exports"], function (require, exports) { } m3.foo = foo; })(m3 = exports.m3 || (exports.m3 = {})); - exports.eVar1, exports.eVar2 = 10; + exports.eVar2 = 10; var eVar22; - exports.eVar3 = 10, exports.eVar4, exports.eVar5; + exports.eVar3 = 10; }); diff --git a/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts b/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts new file mode 100644 index 00000000000..9d4a2331b45 --- /dev/null +++ b/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration1.ts @@ -0,0 +1,10 @@ +// @target: es5 + +function f0(a, [a, [b]], {b}) { } +function f1([a, a]) { } +function f2({b}, {b}) { } +function f3([c,[c],[[c]]]) { } +function f4({d, d:{d}}) { } +function f5({e, e: {e}}, {e}, [d,e, [[e]]], ...e) { } +function f6([f, ...f]) { } +function f7(a, func = (a) => { return 1 }) { } // not error \ No newline at end of file diff --git a/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts b/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts new file mode 100644 index 00000000000..f42e490dae1 --- /dev/null +++ b/tests/cases/compiler/duplicateIdentifierBindingElementInParameterDeclaration2.ts @@ -0,0 +1,11 @@ +// @target: es5 + +"use strict" +function f0(a, [a, [b]], {b}) { } +function f1([a, a]) { } +function f2({b}, {b}) { } +function f3([c, [c], [[c]]]) { } +function f4({d, d: {d}}) { } +function f5({e, e: {e}}, {e}, [d, e, [[e]]], ...e) { } +function f6([f, ...f]) { } +function f7(a, func = (a) => { return 1 }){ } // not error \ No newline at end of file diff --git a/tests/cases/compiler/narrowTypeByInstanceof.ts b/tests/cases/compiler/narrowTypeByInstanceof.ts new file mode 100644 index 00000000000..6fe6693dd96 --- /dev/null +++ b/tests/cases/compiler/narrowTypeByInstanceof.ts @@ -0,0 +1,24 @@ + class Match { + public range(): any { + return undefined; + } + } + + class FileMatch { + public resource(): any { + return undefined; + } + } + +type FileMatchOrMatch = FileMatch | Match; + + +let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; + +if (elementA instanceof FileMatch && elementB instanceof FileMatch) { + let a = elementA.resource().path; + let b = elementB.resource().path; +} else if (elementA instanceof Match && elementB instanceof Match) { + let a = elementA.range(); + let b = elementB.range(); +} diff --git a/tests/cases/compiler/promiseVoidErrorCallback.ts b/tests/cases/compiler/promiseVoidErrorCallback.ts new file mode 100644 index 00000000000..3169288f79a --- /dev/null +++ b/tests/cases/compiler/promiseVoidErrorCallback.ts @@ -0,0 +1,28 @@ +//@target: ES6 +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; +}); \ No newline at end of file diff --git a/tests/cases/compiler/separateCompilationSourceMap.ts b/tests/cases/compiler/separateCompilationSourceMap.ts index 7becf7cbdaf..84c6290caf5 100644 --- a/tests/cases/compiler/separateCompilationSourceMap.ts +++ b/tests/cases/compiler/separateCompilationSourceMap.ts @@ -1,5 +1,5 @@ // @separateCompilation: true -// @sourceMap:sourcemap.map +// @sourceMap:true // @target: es6 // @filename: file1.ts diff --git a/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..d12e894b0a9 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts @@ -0,0 +1,7 @@ +//@sourceMap: true +module Q { + function P() { + // Test this + var a = 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..e883b202ca1 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts @@ -0,0 +1,5 @@ +//@sourceMap: true +function P() { + // Test this + var a = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/systemModuleAmbientDeclarations.ts b/tests/cases/compiler/systemModuleAmbientDeclarations.ts new file mode 100644 index 00000000000..05f78592780 --- /dev/null +++ b/tests/cases/compiler/systemModuleAmbientDeclarations.ts @@ -0,0 +1,28 @@ +// @module: system +// @separateCompilation: true + +// @filename: file1.ts +declare class Promise { } +declare function Foo(): void; +declare class C {} +declare enum E {X = 1}; + +export var promise = Promise; +export var foo = Foo; +export var c = C; +export var e = E; + +// @filename: file2.ts +export declare function foo(); + +// @filename: file3.ts +export declare class C {} + +// @filename: file4.ts +export declare var v: number; + +// @filename: file5.ts +export declare enum E {X = 1} + +// @filename: file6.ts +export declare module M { var v: number; } diff --git a/tests/cases/compiler/systemModuleConstEnums.ts b/tests/cases/compiler/systemModuleConstEnums.ts new file mode 100644 index 00000000000..6ad7f31ef91 --- /dev/null +++ b/tests/cases/compiler/systemModuleConstEnums.ts @@ -0,0 +1,13 @@ +// @module: system + +declare function use(a: any); +const enum TopLevelConstEnum { X } + +export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); +} + +module M { + export const enum NonTopLevelConstEnum { X } +} \ No newline at end of file diff --git a/tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts b/tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts new file mode 100644 index 00000000000..2fc4707b78e --- /dev/null +++ b/tests/cases/compiler/systemModuleConstEnumsSeparateCompilation.ts @@ -0,0 +1,14 @@ +// @module: system +// @separateCompilation: true + +declare function use(a: any); +const enum TopLevelConstEnum { X } + +export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); +} + +module M { + export const enum NonTopLevelConstEnum { X } +} \ No newline at end of file diff --git a/tests/cases/compiler/systemModuleDeclarationMerging.ts b/tests/cases/compiler/systemModuleDeclarationMerging.ts new file mode 100644 index 00000000000..45c59c5b5dc --- /dev/null +++ b/tests/cases/compiler/systemModuleDeclarationMerging.ts @@ -0,0 +1,11 @@ +// @module: system +// @separateCompilation: true + +export function F() {} +export module F { var x; } + +export class C {} +export module C { var x; } + +export enum E {} +export module E { var x; } \ No newline at end of file diff --git a/tests/cases/compiler/systemModuleExportDefault.ts b/tests/cases/compiler/systemModuleExportDefault.ts new file mode 100644 index 00000000000..102c03f0bcd --- /dev/null +++ b/tests/cases/compiler/systemModuleExportDefault.ts @@ -0,0 +1,14 @@ +// @module: system + +// @filename: file1.ts +export default function() {} + +// @filename: file2.ts +export default function foo() {} + +// @filename: file3.ts +export default class {} + +// @filename: file4.ts +export default class C {} + diff --git a/tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts b/tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts new file mode 100644 index 00000000000..756d430a2de --- /dev/null +++ b/tests/cases/compiler/systemModuleNonTopLevelModuleMembers.ts @@ -0,0 +1,14 @@ +// @module: system +// @separateCompilation: true + +export class TopLevelClass {} +export module TopLevelModule {var v;} +export function TopLevelFunction(): void {} +export enum TopLevelEnum {E} + +export module TopLevelModule2 { + export class NonTopLevelClass {} + export module NonTopLevelModule {var v;} + export function NonTopLevelFunction(): void {} + export enum NonTopLevelEnum {E} +} \ No newline at end of file diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts new file mode 100644 index 00000000000..acdb91c9935 --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts @@ -0,0 +1,18 @@ +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var t: Class | Property; +t.parent; diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts new file mode 100644 index 00000000000..cddcf4d4566 --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts @@ -0,0 +1,20 @@ +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var c: Class; +var p: Property; +c = p; +p = c; diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts new file mode 100644 index 00000000000..4bac9ca1b9c --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts @@ -0,0 +1,5 @@ +var a27: { prop: number } | { prop: T27 }; +type T27 = typeof a27; + +var b: T27; +var s: string = b; diff --git a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts index 58d69729b98..b66e14f017b 100644 --- a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts +++ b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES6.ts @@ -94,6 +94,6 @@ function e3({x}: { x?: number }) { } // x is an optional with type number function e4({x: [number,string,any] }) { } // x has type [any, any, any] function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] -function e6({x: [number, number, number]}) { } // should be an error, duplicate identifier; +function e6({x: [number, number, number]}) { } // error, duplicate identifier; diff --git a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts index 19f508c0625..48858044932 100644 --- a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts +++ b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts @@ -62,6 +62,6 @@ class C4 implements F2 { // as such annotations would conflict with the already established meaning of colons in object literals. // Type annotations must instead be written on the top- level parameter declaration -function e0({x: [number, number, number]}) { } // should be an error, duplicate identifier; +function e0({x: [number, number, number]}) { } // error, duplicate identifier; diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts new file mode 100644 index 00000000000..b81dd26652b --- /dev/null +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts @@ -0,0 +1,189 @@ +interface AConstructor { + new (): A; +} +interface A { + foo: string; +} +declare var A: AConstructor; + +var obj1: A | string; +if (obj1 instanceof A) { // narrowed to A. + obj1.foo; + obj1.bar; +} + +var obj2: any; +if (obj2 instanceof A) { // can't narrow type from 'any' + obj2.foo; + obj2.bar; +} + +// a construct signature with generics +interface BConstructor { + new (): B; +} +interface B { + foo: T; +} +declare var B: BConstructor; + +var obj3: B | string; +if (obj3 instanceof B) { // narrowed to B. + obj3.foo = 1; + obj3.foo = "str"; + obj3.bar = "str"; +} + +var obj4: any; +if (obj4 instanceof B) { // can't narrow type from 'any' + obj4.foo = "str"; + obj4.foo = 1; + obj4.bar = "str"; +} + +// has multiple construct signature +interface CConstructor { + new (value: string): C1; + new (value: number): C2; +} +interface C1 { + foo: string; + c: string; + bar1: number; +} +interface C2 { + foo: string; + c: string; + bar2: number; +} +declare var C: CConstructor; + +var obj5: C1 | A; +if (obj5 instanceof C) { // narrowed to C1|C2. + obj5.foo; + obj5.c; + obj5.bar1; + obj5.bar2; +} + +var obj6: any; +if (obj6 instanceof C) { // can't narrow type from 'any' + obj6.foo; + obj6.bar1; + obj6.bar2; +} + +// with object type literal +interface D { + foo: string; +} +declare var D: { new (): D; }; + +var obj7: D | string; +if (obj7 instanceof D) { // narrowed to D. + obj7.foo; + obj7.bar; +} + +var obj8: any; +if (obj8 instanceof D) { // can't narrow type from 'any' + obj8.foo; + obj8.bar; +} + +// a construct signature that returns a union type +interface EConstructor { + new (): E1 | E2; +} +interface E1 { + foo: string; + bar1: number; +} +interface E2 { + foo: string; + bar2: number; +} +declare var E: EConstructor; + +var obj9: E1 | A; +if (obj9 instanceof E) { // narrowed to E1 | E2 + obj9.foo; + obj9.bar1; + obj9.bar2; +} + +var obj10: any; +if (obj10 instanceof E) { // can't narrow type from 'any' + obj10.foo; + obj10.bar1; + obj10.bar2; +} + +// a construct signature that returns any +interface FConstructor { + new (): any; +} +interface F { + foo: string; + bar: number; +} +declare var F: FConstructor; + +var obj11: F | string; +if (obj11 instanceof F) { // can't type narrowing, construct signature returns any. + obj11.foo; + obj11.bar; +} + +var obj12: any; +if (obj12 instanceof F) { // can't narrow type from 'any' + obj12.foo; + obj12.bar; +} + +// a type with a prototype, it overrides the construct signature +interface GConstructor { + prototype: G1; // high priority + new (): G2; // low priority +} +interface G1 { + foo1: number; +} +interface G2 { + foo2: boolean; +} +declare var G: GConstructor; + +var obj13: G1 | G2; +if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype property. + obj13.foo1; + obj13.foo2; +} + +var obj14: any; +if (obj14 instanceof G) { // can't narrow type from 'any' + obj14.foo1; + obj14.foo2; +} + +// a type with a prototype that has any type +interface HConstructor { + prototype: any; // high priority, but any type is ignored. interface has implicit `prototype: any`. + new (): H; // low priority +} +interface H { + foo: number; +} +declare var H: HConstructor; + +var obj15: H | string; +if (obj15 instanceof H) { // narrowed to H. + obj15.foo; + obj15.bar; +} + +var obj16: any; +if (obj16 instanceof H) { // can't narrow type from 'any' + obj16.foo1; + obj16.foo2; +} diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts new file mode 100644 index 00000000000..f6ad233d4f6 --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts @@ -0,0 +1,34 @@ +//@module: amd + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts new file mode 100644 index 00000000000..dd43474972c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts @@ -0,0 +1,34 @@ +//@module: commonjs + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts new file mode 100644 index 00000000000..86319311f96 --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts @@ -0,0 +1,34 @@ +//@target: ES6 + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts new file mode 100644 index 00000000000..2105dd61b1c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts @@ -0,0 +1,34 @@ +//@module: system + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts new file mode 100644 index 00000000000..b4d767a223c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts @@ -0,0 +1,34 @@ +//@module: umd + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts b/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts new file mode 100644 index 00000000000..cd08ae00041 --- /dev/null +++ b/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts @@ -0,0 +1,35 @@ + +module Inner { + var; + let; + const; + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; +} \ No newline at end of file diff --git a/tests/cases/fourslash/aliasMergingWithNamespace.ts b/tests/cases/fourslash/aliasMergingWithNamespace.ts new file mode 100644 index 00000000000..66ab97890ce --- /dev/null +++ b/tests/cases/fourslash/aliasMergingWithNamespace.ts @@ -0,0 +1,9 @@ +/// + +////namespace bar { } +////import bar = bar/**/; + +goTo.marker(); +verify.quickInfoIs( +`namespace bar +import bar = bar`); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtInvalidLocations.ts b/tests/cases/fourslash/completionListAtInvalidLocations.ts index 96368280371..6e4b4056a7d 100644 --- a/tests/cases/fourslash/completionListAtInvalidLocations.ts +++ b/tests/cases/fourslash/completionListAtInvalidLocations.ts @@ -18,7 +18,8 @@ /////* /*inComment5*/ ////var v11 = ''; //// // /*inComment6*/ -//// +////var v12 = ''; +////type htm/*inTypeAlias*/ /// ////// /*inComment7*/ ////foo; diff --git a/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts b/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts new file mode 100644 index 00000000000..753d6c7d4d2 --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts @@ -0,0 +1,6 @@ +/// + +////var { x:html/*1*/ + +goTo.marker("1"); +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts new file mode 100644 index 00000000000..8a9a5bfb9ed --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts @@ -0,0 +1,9 @@ +/// + +////function F(pref: (a/*1*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.not.completionListIsEmpty(); + verify.completionListAllowsNewIdentifier(); +}); diff --git a/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts b/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts new file mode 100644 index 00000000000..534011b7ee1 --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts @@ -0,0 +1,11 @@ +/// + +////var x : (s/*1*/ + +////var y : (s:string, list/*2*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.not.completionListIsEmpty(); + verify.completionListAllowsNewIdentifier(); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputOut.ts b/tests/cases/fourslash/getEmitOutputOut.ts new file mode 100644 index 00000000000..077b257e4de --- /dev/null +++ b/tests/cases/fourslash/getEmitOutputOut.ts @@ -0,0 +1,23 @@ +/// + +// @BaselineFile: getEmitOutputOut.baseline +// @out: out.js + +// @Filename: my.d.ts +// @emitThisFile: false +////declare module foo.bar { +//// class Baz { } +////} + +// @Filename: input0.ts +// @emitThisFile: false +/////// +////module foo.bar { +//// var baz1 = Baz.prototype; // Should emit as bar.Baz.prototype +////} + +// @Filename: input1.ts +// @emitThisFile: true +////var x; + +verify.baselineGetEmitOutput(); \ No newline at end of file