diff --git a/.settings/tasks.json b/.vscode/tasks.json similarity index 100% rename from .settings/tasks.json rename to .vscode/tasks.json diff --git a/Jakefile.js b/Jakefile.js index ea13cce6685..3ac2e8fad13 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -588,9 +588,10 @@ function deleteTemporaryProjectOutput() { } var testTimeout = 20000; -desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]'."); +desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]', debug=true."); task("runtests", ["tests", builtLocalDirectory], function() { cleanTestDirs(); + var debug = process.env.debug || process.env.d; host = "mocha" tests = process.env.test || process.env.tests || process.env.t; var light = process.env.light || false; @@ -613,7 +614,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter'; // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer - var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run; + var cmd = host + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run; console.log(cmd); exec(cmd, deleteTemporaryProjectOutput); }, {async: true}); diff --git a/lib/tsc.js b/lib/tsc.js index 0ccb839c2ef..591a22bceb9 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1573,6 +1573,7 @@ var ts; Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, + Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -12680,7 +12681,7 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true))); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -12972,25 +12973,6 @@ var ts; } return undefined; } - function isKnownProperty(type, name) { - if (type.flags & 80896 && type !== globalObjectType) { - var resolved = resolveStructuredTypeMembers(type); - return !!(resolved.properties.length === 0 || - resolved.stringIndexType || - resolved.numberIndexType || - getPropertyOfType(type, name)); - } - if (type.flags & 49152) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (isKnownProperty(t, name)) { - return true; - } - } - return false; - } - return true; - } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); @@ -13446,7 +13428,7 @@ var ts; } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyObjectType + return globalTypedPropertyDescriptorType !== emptyGenericType ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } @@ -13499,68 +13481,19 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isObjectLiteralTypeDuplicateOf(source, target) { - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); - if (sourceProperties.length !== targetProperties.length) { - return false; - } - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; - var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || - getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) || - !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { - return false; - } - } - return true; - } - function isTupleTypeDuplicateOf(source, target) { - var sourceTypes = source.elementTypes; - var targetTypes = target.elementTypes; - if (sourceTypes.length !== targetTypes.length) { - return false; - } - for (var i = 0; i < sourceTypes.length; i++) { - if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { - return false; - } - } - return true; - } - function isTypeDuplicateOf(source, target) { - if (source === target) { - return true; - } - if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) { - return true; - } - if (source.flags & 524288 && target.flags & 80896) { - return isObjectLiteralTypeDuplicateOf(source, target); - } - if (isArrayType(source) && isArrayType(target)) { - return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); - } - if (isTupleType(source) && isTupleType(target)) { - return isTupleTypeDuplicateOf(source, target); - } - return isTypeIdenticalTo(source, target); - } - function isTypeDuplicateOfSomeType(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; - if (candidate !== type && isTypeDuplicateOf(candidate, type)) { + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { return true; } } return false; } - function removeDuplicateTypes(types) { + function removeSubtypes(types) { var i = types.length; while (i > 0) { i--; - if (isTypeDuplicateOfSomeType(types[i], types)) { + if (isSubtypeOfAny(types[i], types)) { types.splice(i, 1); } } @@ -13583,7 +13516,7 @@ var ts; } } } - function getUnionType(types, noDeduplication) { + function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyObjectType; } @@ -13592,12 +13525,12 @@ var ts; if (containsTypeAny(typeSet)) { return anyType; } - if (noDeduplication) { + if (noSubtypeReduction) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeDuplicateTypes(typeSet); + removeSubtypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -14091,6 +14024,26 @@ var ts; } return 0; } + function isKnownProperty(type, name) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + return true; + } + return false; + } + if (type.flags & 49152) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function hasExcessProperties(source, target, reportErrors) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; @@ -14763,7 +14716,7 @@ var ts; return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType)); + return getUnionType(ts.map(type.types, getWidenedType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -15973,7 +15926,7 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); - var typeFlags; + var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -16014,7 +15967,8 @@ var ts; var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -17260,7 +17214,7 @@ var ts; } function createPromiseType(promisedType) { var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyObjectType) { + if (globalPromiseType !== emptyGenericType) { promisedType = getAwaitedType(promisedType); return createTypeReference(globalPromiseType, [promisedType]); } @@ -19714,6 +19668,7 @@ var ts; if (baseTypes.length && produceDiagnostics) { var baseType = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { @@ -20613,6 +20568,8 @@ var ts; case 209: case 210: case 212: + case 241: + case 186: case 215: case 245: case 225: @@ -21338,7 +21295,7 @@ var ts; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyObjectType) { + if (promiseLikeType !== emptyGenericType) { return createTypeReference(promiseLikeType, [anyType]); } return emptyObjectType; @@ -24454,8 +24411,12 @@ var ts; } } function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(67); + syntheticReactRef.text = 'React'; + syntheticReactRef.parent = openingNode; emitLeadingComments(openingNode); - write("React.createElement("); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); emitTagName(openingNode.tagName); write(", "); if (openingNode.attributes.length === 0) { @@ -24464,7 +24425,8 @@ var ts; else { var attrs = openingNode.attributes; if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { - write("React.__spread("); + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); var haveOpenedObjectLiteral = false; for (var i_1 = 0; i_1 < attrs.length; i_1++) { if (attrs[i_1].kind === 237) { @@ -30376,6 +30338,12 @@ var ts; description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + experimental: true + }, { name: "suppressImplicitAnyIndexErrors", type: "boolean", @@ -30450,7 +30418,7 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; - function parseCommandLine(commandLine) { + function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; var errors = []; @@ -30509,7 +30477,7 @@ var ts; } } function parseResponseFile(fileName) { - var text = ts.sys.readFile(fileName); + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); if (!text) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); return; diff --git a/lib/tsserver.js b/lib/tsserver.js index 3c339e6d661..78836160678 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -1573,6 +1573,7 @@ var ts; Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, + Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -3163,6 +3164,12 @@ var ts; description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + experimental: true + }, { name: "suppressImplicitAnyIndexErrors", type: "boolean", @@ -3237,7 +3244,7 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; - function parseCommandLine(commandLine) { + function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; var errors = []; @@ -3296,7 +3303,7 @@ var ts; } } function parseResponseFile(fileName) { - var text = ts.sys.readFile(fileName); + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); if (!text) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); return; @@ -13136,7 +13143,7 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true))); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -13428,25 +13435,6 @@ var ts; } return undefined; } - function isKnownProperty(type, name) { - if (type.flags & 80896 && type !== globalObjectType) { - var resolved = resolveStructuredTypeMembers(type); - return !!(resolved.properties.length === 0 || - resolved.stringIndexType || - resolved.numberIndexType || - getPropertyOfType(type, name)); - } - if (type.flags & 49152) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (isKnownProperty(t, name)) { - return true; - } - } - return false; - } - return true; - } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); @@ -13902,7 +13890,7 @@ var ts; } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyObjectType + return globalTypedPropertyDescriptorType !== emptyGenericType ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } @@ -13955,68 +13943,19 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isObjectLiteralTypeDuplicateOf(source, target) { - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); - if (sourceProperties.length !== targetProperties.length) { - return false; - } - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; - var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || - getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) || - !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { - return false; - } - } - return true; - } - function isTupleTypeDuplicateOf(source, target) { - var sourceTypes = source.elementTypes; - var targetTypes = target.elementTypes; - if (sourceTypes.length !== targetTypes.length) { - return false; - } - for (var i = 0; i < sourceTypes.length; i++) { - if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { - return false; - } - } - return true; - } - function isTypeDuplicateOf(source, target) { - if (source === target) { - return true; - } - if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) { - return true; - } - if (source.flags & 524288 && target.flags & 80896) { - return isObjectLiteralTypeDuplicateOf(source, target); - } - if (isArrayType(source) && isArrayType(target)) { - return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); - } - if (isTupleType(source) && isTupleType(target)) { - return isTupleTypeDuplicateOf(source, target); - } - return isTypeIdenticalTo(source, target); - } - function isTypeDuplicateOfSomeType(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; - if (candidate !== type && isTypeDuplicateOf(candidate, type)) { + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { return true; } } return false; } - function removeDuplicateTypes(types) { + function removeSubtypes(types) { var i = types.length; while (i > 0) { i--; - if (isTypeDuplicateOfSomeType(types[i], types)) { + if (isSubtypeOfAny(types[i], types)) { types.splice(i, 1); } } @@ -14039,7 +13978,7 @@ var ts; } } } - function getUnionType(types, noDeduplication) { + function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyObjectType; } @@ -14048,12 +13987,12 @@ var ts; if (containsTypeAny(typeSet)) { return anyType; } - if (noDeduplication) { + if (noSubtypeReduction) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeDuplicateTypes(typeSet); + removeSubtypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -14547,6 +14486,26 @@ var ts; } return 0; } + function isKnownProperty(type, name) { + if (type.flags & 80896) { + var resolved = resolveStructuredTypeMembers(type); + if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + return true; + } + return false; + } + if (type.flags & 49152) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function hasExcessProperties(source, target, reportErrors) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; @@ -15219,7 +15178,7 @@ var ts; return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType)); + return getUnionType(ts.map(type.types, getWidenedType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -16429,7 +16388,7 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); - var typeFlags; + var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -16470,7 +16429,8 @@ var ts; var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -17716,7 +17676,7 @@ var ts; } function createPromiseType(promisedType) { var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyObjectType) { + if (globalPromiseType !== emptyGenericType) { promisedType = getAwaitedType(promisedType); return createTypeReference(globalPromiseType, [promisedType]); } @@ -20170,6 +20130,7 @@ var ts; if (baseTypes.length && produceDiagnostics) { var baseType = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { @@ -21069,6 +21030,8 @@ var ts; case 209: case 210: case 212: + case 241: + case 186: case 215: case 245: case 225: @@ -21794,7 +21757,7 @@ var ts; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyObjectType) { + if (promiseLikeType !== emptyGenericType) { return createTypeReference(promiseLikeType, [anyType]); } return emptyObjectType; @@ -24910,8 +24873,12 @@ var ts; } } function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(67); + syntheticReactRef.text = 'React'; + syntheticReactRef.parent = openingNode; emitLeadingComments(openingNode); - write("React.createElement("); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); emitTagName(openingNode.tagName); write(", "); if (openingNode.attributes.length === 0) { @@ -24920,7 +24887,8 @@ var ts; else { var attrs = openingNode.attributes; if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { - write("React.__spread("); + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); var haveOpenedObjectLiteral = false; for (var i_1 = 0; i_1 < attrs.length; i_1++) { if (attrs[i_1].kind === 237) { diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index f94d24269f1..bf0510cf1c8 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -1329,6 +1329,7 @@ declare module "typescript" { rootDir?: string; sourceMap?: boolean; sourceRoot?: string; + suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; target?: ScriptTarget; version?: boolean; @@ -1524,7 +1525,7 @@ declare module "typescript" { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare module "typescript" { - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file diff --git a/lib/typescript.js b/lib/typescript.js index c1105bb262a..b4d21639d3b 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -2442,6 +2442,7 @@ var ts; Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, + Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -15702,7 +15703,7 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true))); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -16023,29 +16024,6 @@ var ts; } return undefined; } - // Check if a property with the given name is known anywhere in the given type. In an object - // type, a property is considered known if the object type is empty, if it has any index - // signatures, or if the property is actually declared in the type. In a union or intersection - // type, a property is considered known if it is known in any constituent type. - function isKnownProperty(type, name) { - if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) { - var resolved = resolveStructuredTypeMembers(type); - return !!(resolved.properties.length === 0 || - resolved.stringIndexType || - resolved.numberIndexType || - getPropertyOfType(type, name)); - } - if (type.flags & 49152 /* UnionOrIntersection */) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (isKnownProperty(t, name)) { - return true; - } - } - return false; - } - return true; - } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); @@ -16559,7 +16537,7 @@ var ts; */ function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyObjectType + return globalTypedPropertyDescriptorType !== emptyGenericType ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } @@ -16617,71 +16595,19 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isObjectLiteralTypeDuplicateOf(source, target) { - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); - if (sourceProperties.length !== targetProperties.length) { - return false; - } - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; - var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || - getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) || - !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { - return false; - } - } - return true; - } - function isTupleTypeDuplicateOf(source, target) { - var sourceTypes = source.elementTypes; - var targetTypes = target.elementTypes; - if (sourceTypes.length !== targetTypes.length) { - return false; - } - for (var i = 0; i < sourceTypes.length; i++) { - if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { - return false; - } - } - return true; - } - // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of - // a target type if the the two are identical, with the exception that the source type may have null or - // undefined in places where the target type doesn't. This is by design an asymmetric relationship. - function isTypeDuplicateOf(source, target) { - if (source === target) { - return true; - } - if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) { - return true; - } - if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) { - return isObjectLiteralTypeDuplicateOf(source, target); - } - if (isArrayType(source) && isArrayType(target)) { - return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); - } - if (isTupleType(source) && isTupleType(target)) { - return isTupleTypeDuplicateOf(source, target); - } - return isTypeIdenticalTo(source, target); - } - function isTypeDuplicateOfSomeType(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; - if (candidate !== type && isTypeDuplicateOf(candidate, type)) { + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { return true; } } return false; } - function removeDuplicateTypes(types) { + function removeSubtypes(types) { var i = types.length; while (i > 0) { i--; - if (isTypeDuplicateOfSomeType(types[i], types)) { + if (isSubtypeOfAny(types[i], types)) { types.splice(i, 1); } } @@ -16704,12 +16630,14 @@ var ts; } } } - // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate - // based on the structure of the types unless the noDeduplication flag is true, which is the case when - // creating a union type from a type node and when instantiating a union type. In both of those cases, - // structural deduplication has to be deferred to properly support recursive union types. For example, - // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. - function getUnionType(types, noDeduplication) { + // We reduce the constituent type set to only include types that aren't subtypes of other types, unless + // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on + // object identity. Subtype reduction is possible only when union types are known not to circularly + // reference themselves (as is the case with union types created by expression constructs such as array + // literals and the || and ?: operators). Named types can circularly reference themselves and therefore + // cannot be deduplicated during their declaration. For example, "type Item = string | (() => Item" is + // a named type that circularly references itself. + function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyObjectType; } @@ -16718,12 +16646,12 @@ var ts; if (containsTypeAny(typeSet)) { return anyType; } - if (noDeduplication) { + if (noSubtypeReduction) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeDuplicateTypes(typeSet); + removeSubtypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -16739,7 +16667,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -17010,7 +16938,7 @@ var ts; return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); } if (type.flags & 16384 /* Union */) { - return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true); + return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noSubtypeReduction*/ true); } if (type.flags & 32768 /* Intersection */) { return getIntersectionType(instantiateList(type.types, mapper, instantiateType)); @@ -17271,6 +17199,30 @@ var ts; } return 0 /* False */; } + // Check if a property with the given name is known anywhere in the given type. In an object type, a property + // is considered known if the object type is empty and the check is for assignability, if the object type has + // index signatures, or if the property is actually declared in the object type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type, name) { + if (type.flags & 80896 /* ObjectType */) { + var resolved = resolveStructuredTypeMembers(type); + if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + return true; + } + return false; + } + if (type.flags & 49152 /* UnionOrIntersection */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function hasExcessProperties(source, target, reportErrors) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; @@ -17999,7 +17951,7 @@ var ts; return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType)); + return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -19438,7 +19390,7 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); - var typeFlags; + var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -19484,7 +19436,8 @@ var ts; var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; + result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -21216,7 +21169,7 @@ var ts; function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyObjectType) { + if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type promisedType = getAwaitedType(promisedType); return createTypeReference(globalPromiseType, [promisedType]); @@ -24248,6 +24201,7 @@ var ts; if (baseTypes.length && produceDiagnostics) { var baseType = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { @@ -25227,6 +25181,8 @@ var ts; case 209 /* VariableDeclaration */: case 210 /* VariableDeclarationList */: case 212 /* ClassDeclaration */: + case 241 /* HeritageClause */: + case 186 /* ExpressionWithTypeArguments */: case 215 /* EnumDeclaration */: case 245 /* EnumMember */: case 225 /* ExportAssignment */: @@ -26049,7 +26005,7 @@ var ts; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyObjectType) { + if (promiseLikeType !== emptyGenericType) { return createTypeReference(promiseLikeType, [anyType]); } return emptyObjectType; @@ -29500,9 +29456,13 @@ var ts; } } function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */); + syntheticReactRef.text = 'React'; + syntheticReactRef.parent = openingNode; // Call React.createElement(tag, ... emitLeadingComments(openingNode); - write("React.createElement("); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); emitTagName(openingNode.tagName); write(", "); // Attribute list @@ -29515,7 +29475,8 @@ var ts; // a call to React.__spread var attrs = openingNode.attributes; if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { - write("React.__spread("); + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); var haveOpenedObjectLiteral = false; for (var i_1 = 0; i_1 < attrs.length; i_1++) { if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { @@ -36231,6 +36192,12 @@ var ts; description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + experimental: true + }, { name: "suppressImplicitAnyIndexErrors", type: "boolean", @@ -36306,7 +36273,7 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; - function parseCommandLine(commandLine) { + function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; var errors = []; @@ -36368,7 +36335,7 @@ var ts; } } function parseResponseFile(fileName) { - var text = ts.sys.readFile(fileName); + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); if (!text) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); return; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 812305c8a68..3d4418a9750 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -1329,6 +1329,7 @@ declare namespace ts { rootDir?: string; sourceMap?: boolean; sourceRoot?: string; + suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; target?: ScriptTarget; version?: boolean; @@ -1524,7 +1525,7 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { - function parseCommandLine(commandLine: string[]): ParsedCommandLine; + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index c1105bb262a..b4d21639d3b 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -2442,6 +2442,7 @@ var ts; Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, + Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -15702,7 +15703,7 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, /*noSubtypeReduction*/ true))); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -16023,29 +16024,6 @@ var ts; } return undefined; } - // Check if a property with the given name is known anywhere in the given type. In an object - // type, a property is considered known if the object type is empty, if it has any index - // signatures, or if the property is actually declared in the type. In a union or intersection - // type, a property is considered known if it is known in any constituent type. - function isKnownProperty(type, name) { - if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) { - var resolved = resolveStructuredTypeMembers(type); - return !!(resolved.properties.length === 0 || - resolved.stringIndexType || - resolved.numberIndexType || - getPropertyOfType(type, name)); - } - if (type.flags & 49152 /* UnionOrIntersection */) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (isKnownProperty(t, name)) { - return true; - } - } - return false; - } - return true; - } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); @@ -16559,7 +16537,7 @@ var ts; */ function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyObjectType + return globalTypedPropertyDescriptorType !== emptyGenericType ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } @@ -16617,71 +16595,19 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isObjectLiteralTypeDuplicateOf(source, target) { - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); - if (sourceProperties.length !== targetProperties.length) { - return false; - } - for (var _i = 0; _i < sourceProperties.length; _i++) { - var sourceProp = sourceProperties[_i]; - var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || - getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) || - !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { - return false; - } - } - return true; - } - function isTupleTypeDuplicateOf(source, target) { - var sourceTypes = source.elementTypes; - var targetTypes = target.elementTypes; - if (sourceTypes.length !== targetTypes.length) { - return false; - } - for (var i = 0; i < sourceTypes.length; i++) { - if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { - return false; - } - } - return true; - } - // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of - // a target type if the the two are identical, with the exception that the source type may have null or - // undefined in places where the target type doesn't. This is by design an asymmetric relationship. - function isTypeDuplicateOf(source, target) { - if (source === target) { - return true; - } - if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) { - return true; - } - if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) { - return isObjectLiteralTypeDuplicateOf(source, target); - } - if (isArrayType(source) && isArrayType(target)) { - return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); - } - if (isTupleType(source) && isTupleType(target)) { - return isTupleTypeDuplicateOf(source, target); - } - return isTypeIdenticalTo(source, target); - } - function isTypeDuplicateOfSomeType(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; - if (candidate !== type && isTypeDuplicateOf(candidate, type)) { + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { return true; } } return false; } - function removeDuplicateTypes(types) { + function removeSubtypes(types) { var i = types.length; while (i > 0) { i--; - if (isTypeDuplicateOfSomeType(types[i], types)) { + if (isSubtypeOfAny(types[i], types)) { types.splice(i, 1); } } @@ -16704,12 +16630,14 @@ var ts; } } } - // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate - // based on the structure of the types unless the noDeduplication flag is true, which is the case when - // creating a union type from a type node and when instantiating a union type. In both of those cases, - // structural deduplication has to be deferred to properly support recursive union types. For example, - // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. - function getUnionType(types, noDeduplication) { + // We reduce the constituent type set to only include types that aren't subtypes of other types, unless + // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on + // object identity. Subtype reduction is possible only when union types are known not to circularly + // reference themselves (as is the case with union types created by expression constructs such as array + // literals and the || and ?: operators). Named types can circularly reference themselves and therefore + // cannot be deduplicated during their declaration. For example, "type Item = string | (() => Item" is + // a named type that circularly references itself. + function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyObjectType; } @@ -16718,12 +16646,12 @@ var ts; if (containsTypeAny(typeSet)) { return anyType; } - if (noDeduplication) { + if (noSubtypeReduction) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeDuplicateTypes(typeSet); + removeSubtypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -16739,7 +16667,7 @@ var ts; function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); } return links.resolvedType; } @@ -17010,7 +16938,7 @@ var ts; return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); } if (type.flags & 16384 /* Union */) { - return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true); + return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noSubtypeReduction*/ true); } if (type.flags & 32768 /* Intersection */) { return getIntersectionType(instantiateList(type.types, mapper, instantiateType)); @@ -17271,6 +17199,30 @@ var ts; } return 0 /* False */; } + // Check if a property with the given name is known anywhere in the given type. In an object type, a property + // is considered known if the object type is empty and the check is for assignability, if the object type has + // index signatures, or if the property is actually declared in the object type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type, name) { + if (type.flags & 80896 /* ObjectType */) { + var resolved = resolveStructuredTypeMembers(type); + if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { + return true; + } + return false; + } + if (type.flags & 49152 /* UnionOrIntersection */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function hasExcessProperties(source, target, reportErrors) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; @@ -17999,7 +17951,7 @@ var ts; return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType)); + return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -19438,7 +19390,7 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); - var typeFlags; + var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; @@ -19484,7 +19436,8 @@ var ts; var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; + result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -21216,7 +21169,7 @@ var ts; function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyObjectType) { + if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type promisedType = getAwaitedType(promisedType); return createTypeReference(globalPromiseType, [promisedType]); @@ -24248,6 +24201,7 @@ var ts; if (baseTypes.length && produceDiagnostics) { var baseType = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); + checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { @@ -25227,6 +25181,8 @@ var ts; case 209 /* VariableDeclaration */: case 210 /* VariableDeclarationList */: case 212 /* ClassDeclaration */: + case 241 /* HeritageClause */: + case 186 /* ExpressionWithTypeArguments */: case 215 /* EnumDeclaration */: case 245 /* EnumMember */: case 225 /* ExportAssignment */: @@ -26049,7 +26005,7 @@ var ts; } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyObjectType) { + if (promiseLikeType !== emptyGenericType) { return createTypeReference(promiseLikeType, [anyType]); } return emptyObjectType; @@ -29500,9 +29456,13 @@ var ts; } } function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(67 /* Identifier */); + syntheticReactRef.text = 'React'; + syntheticReactRef.parent = openingNode; // Call React.createElement(tag, ... emitLeadingComments(openingNode); - write("React.createElement("); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); emitTagName(openingNode.tagName); write(", "); // Attribute list @@ -29515,7 +29475,8 @@ var ts; // a call to React.__spread var attrs = openingNode.attributes; if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { - write("React.__spread("); + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); var haveOpenedObjectLiteral = false; for (var i_1 = 0; i_1 < attrs.length; i_1++) { if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { @@ -36231,6 +36192,12 @@ var ts; description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + experimental: true + }, { name: "suppressImplicitAnyIndexErrors", type: "boolean", @@ -36306,7 +36273,7 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; - function parseCommandLine(commandLine) { + function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; var errors = []; @@ -36368,7 +36335,7 @@ var ts; } } function parseResponseFile(fileName) { - var text = ts.sys.readFile(fileName); + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); if (!text) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); return; diff --git a/package.json b/package.json index b743b04838d..abd81e12f47 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.7.0", + "version": "1.6.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d795be0091..c214239117e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -967,7 +967,7 @@ namespace ts { // Escape the name in the "require(...)" clause to ensure we find the right symbol. let moduleName = escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } let isRelative = isExternalModuleNameRelative(moduleName); @@ -978,8 +978,8 @@ namespace ts { } } - let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - let sourceFile = fileName && host.getSourceFile(fileName); + let resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + let sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -2320,8 +2320,8 @@ namespace ts { // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || - getIndexTypeOfType(parentType, IndexKind.String); + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || + getIndexTypeOfType(parentType, IndexKind.String); if (!type) { error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name)); return unknownType; @@ -2408,7 +2408,7 @@ namespace ts { // If the declaration specifies a binding pattern, use the type implied by the binding pattern if (isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ false); } // No type specified and nothing can be inferred @@ -2418,48 +2418,47 @@ namespace ts { // Return the type implied by a binding pattern element. This is the type of the initializer of the element if // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding // pattern. Otherwise, it is the type any. - function getTypeFromBindingElement(element: BindingElement): Type { + function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean): Type { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } // Return the type implied by an object binding pattern - function getTypeFromObjectBindingPattern(pattern: BindingPattern): Type { + function getTypeFromObjectBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type { let members: SymbolTable = {}; forEach(pattern.elements, e => { let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); let name = e.propertyName || e.name; let symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + let result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } // Return the type implied by an array binding pattern - function getTypeFromArrayBindingPattern(pattern: BindingPattern): Type { - let hasSpreadElement: boolean = false; - let elementTypes: Type[] = []; - forEach(pattern.elements, e => { - elementTypes.push(e.kind === SyntaxKind.OmittedExpression || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type { + let elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= ScriptTarget.ES6 ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - let unionOfElements = getUnionType(elementTypes); - return languageVersion >= ScriptTarget.ES6 ? createIterableType(unionOfElements) : createArrayType(unionOfElements); - } - // If the pattern has at least one element, and no rest element, then it should imply a tuple type. + let elementTypes = map(elements, e => e.kind === SyntaxKind.OmittedExpression ? anyType : getTypeFromBindingElement(e, includePatternInType)); + if (includePatternInType) { + let result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; + } return createTupleType(elementTypes); } @@ -2470,10 +2469,10 @@ namespace ts { // used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. - function getTypeFromBindingPattern(pattern: BindingPattern): Type { + function getTypeFromBindingPattern(pattern: BindingPattern, includePatternInType?: boolean): Type { return pattern.kind === SyntaxKind.ObjectBindingPattern - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } // Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type @@ -3128,7 +3127,7 @@ namespace ts { } function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature { - for (let s of signatureList) { + for (let s of signatureList) { if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } @@ -4015,7 +4014,7 @@ namespace ts { */ function createTypedPropertyDescriptorType(propertyType: Type): Type { let globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyObjectType + return globalTypedPropertyDescriptorType !== emptyGenericType ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } @@ -4049,11 +4048,12 @@ namespace ts { function createTupleType(elementTypes: Type[]) { let id = getTypeListId(elementTypes); - let type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + + function createNewTupleType(elementTypes: Type[]) { + let type = createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } @@ -4642,7 +4642,9 @@ namespace ts { // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & TypeFlags.UnionOrIntersection) { + source = getRegularTypeOfObjectLiteral(source); + } } let saveErrorInfo = errorInfo; @@ -5113,8 +5115,8 @@ namespace ts { function abstractSignatureRelatedTo(source: Type, sourceSig: Signature, target: Type, targetSig: Signature) { if (sourceSig && targetSig) { - let sourceDecl = source.symbol && getDeclarationOfKind(source.symbol, SyntaxKind.ClassDeclaration); - let targetDecl = target.symbol && getDeclarationOfKind(target.symbol, SyntaxKind.ClassDeclaration); + let sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + let targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { // If the source object isn't itself a class declaration, it can be freely assigned, regardless @@ -5128,8 +5130,8 @@ namespace ts { let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration); - let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration); + let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + let targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract; let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract; @@ -5513,6 +5515,7 @@ namespace ts { regularType.constructSignatures = (type).constructSignatures; regularType.stringIndexType = (type).stringIndexType; regularType.numberIndexType = (type).numberIndexType; + (type).regularType = regularType; } return regularType; } @@ -6615,7 +6618,7 @@ namespace ts { } } if (isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } } return undefined; @@ -7011,11 +7014,13 @@ namespace ts { return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } + function hasDefaultValue(node: BindingElement | Expression): boolean { + return (node.kind === SyntaxKind.BindingElement && !!(node).initializer) || + (node.kind === SyntaxKind.BinaryExpression && (node).operatorToken.kind === SyntaxKind.EqualsToken); + } + function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type { let elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } let hasSpreadElement = false; let elementTypes: Type[] = []; let inDestructuringPattern = isAssignmentTarget(node); @@ -7047,12 +7052,39 @@ namespace ts { hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElementExpression; } if (!hasSpreadElement) { + // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such + // that we get the same behavior for "var [x, y] = []" and "[x, y] = []". + if (inDestructuringPattern && elementTypes.length) { + let type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } let contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + let pattern = contextualType.pattern; + // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting + // tuple type with the corresponding binding or assignment element types to make the lengths equal. + if (pattern && (pattern.kind === SyntaxKind.ArrayBindingPattern || pattern.kind === SyntaxKind.ArrayLiteralExpression)) { + let patternElements = (pattern).elements; + for (let i = elementTypes.length; i < patternElements.length; i++) { + let patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push((contextualType).elementTypes[i]); + } + else { + if (patternElement.kind !== SyntaxKind.OmittedExpression) { + error(patternElement, Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType) } function isNumericName(name: DeclarationName): boolean { @@ -7119,6 +7151,9 @@ namespace ts { let propertiesTable: SymbolTable = {}; let propertiesArray: Symbol[] = []; let contextualType = getContextualType(node); + let contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression); + let inDestructuringPattern = isAssignmentTarget(node); let typeFlags: TypeFlags = 0; for (let memberDecl of node.properties) { @@ -7139,6 +7174,25 @@ namespace ts { } typeFlags |= type.flags; let prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); + if (inDestructuringPattern) { + // If object literal is an assignment pattern and if the assignment pattern specifies a default value + // for the property, make the property optional. + if (memberDecl.kind === SyntaxKind.PropertyAssignment && hasDefaultValue((memberDecl).initializer)) { + prop.flags |= SymbolFlags.Optional; + } + } + else if (contextualTypeHasPattern) { + // If object literal is contextually typed by the implied type of a binding pattern, and if the + // binding pattern specifies a default value for the property, make the property optional. + let impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & SymbolFlags.Optional; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, + symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -7165,11 +7219,29 @@ namespace ts { propertiesArray.push(member); } + // If object literal is contextually typed by the implied type of a binding pattern, augment the result + // type with those properties for which the binding pattern specifies a default value. + if (contextualTypeHasPattern) { + for (let prop of getPropertiesOfType(contextualType)) { + if (!hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & SymbolFlags.Optional)) { + error(prop.valueDeclaration || (prop).bindingElement, + Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } + let stringIndexType = getIndexType(IndexKind.String); let numberIndexType = getIndexType(IndexKind.Number); let result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); let freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral; result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind: IndexKind) { @@ -8880,7 +8952,7 @@ namespace ts { // Note, only class declarations can be declared abstract. // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. - let valueDecl = expressionType.symbol && getDeclarationOfKind(expressionType.symbol, SyntaxKind.ClassDeclaration); + let valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & NodeFlags.Abstract) { error(node, Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -9133,7 +9205,7 @@ namespace ts { function createPromiseType(promisedType: Type): Type { // creates a `Promise` type where `T` is the promisedType argument let globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyObjectType) { + if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type promisedType = getAwaitedType(promisedType); return createTypeReference(globalPromiseType, [promisedType]); @@ -12623,6 +12695,10 @@ namespace ts { return s.flags & SymbolFlags.Instantiated ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol: Symbol): Declaration { + return forEach(symbol.declarations, d => isClassLike(d) ? d : undefined); + } + function checkKindsOfPropertyMemberOverrides(type: InterfaceType, baseType: ObjectType): void { // TypeScript 1.0 spec (April 2014): 8.2.3 @@ -12660,14 +12736,20 @@ namespace ts { if (derived === base) { // derived class inherits base without override/redeclaration - let derivedClassDecl = getDeclarationOfKind(type.symbol, SyntaxKind.ClassDeclaration); + let derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if ( baseDeclarationFlags & NodeFlags.Abstract && (!derivedClassDecl || !(derivedClassDecl.flags & NodeFlags.Abstract))) { - error(derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, - typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (baseDeclarationFlags & NodeFlags.Abstract && (!derivedClassDecl || !(derivedClassDecl.flags & NodeFlags.Abstract))) { + if (derivedClassDecl.kind === SyntaxKind.ClassExpression) { + error(derivedClassDecl, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, + symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, + typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -14581,7 +14663,7 @@ namespace ts { function createInstantiatedPromiseLikeType(): ObjectType { let promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyObjectType) { + if (promiseLikeType !== emptyGenericType) { return createTypeReference(promiseLikeType, [anyType]); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index c773be4dfb8..7117aaea180 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -399,10 +399,10 @@ namespace ts { * Read tsconfig.json file * @param fileName The path to the config file */ - export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { + export function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic } { let text = ""; try { - text = sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2fc382c1ea9..0e26d748c2e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -244,7 +244,7 @@ namespace ts { Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -415,6 +415,7 @@ namespace ts { The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -427,6 +428,10 @@ namespace ts { Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, 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}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d62b837ea5b..592b6e6dcb7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -965,7 +965,7 @@ "category": "Error", "code": 2341 }, - "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": { + "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.": { "category": "Error", "code": 2342 }, @@ -1649,6 +1649,10 @@ "category": "Error", "code": 2524 }, + "Initializer provides no value for this binding element and the binding element has no default value.": { + "category": "Error", + "code": 2525 + }, "JSX element attributes type '{0}' must be an object type.": { "category": "Error", "code": 2600 @@ -1692,11 +1696,27 @@ "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.": { "category": "Error", "code": 2651 - }, + }, "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": { "category": "Error", "code": 2652 }, + "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": { + "category": "Error", + "code": 2653 + }, + "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { + "category": "Error", + "code": 2654 + }, + "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": { + "category": "Error", + "code": 2655 + }, + "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": { + "category": "Error", + "code": 2656 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index eeaab6d2123..5410cd9c681 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -186,6 +186,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi /** Sourcemap data that will get encoded */ let sourceMapData: SourceMapData; + /** If removeComments is true, no leading-comments needed to be emitted **/ + let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker; + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -1292,8 +1295,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) { function emitJsxAttribute(node: JsxAttribute) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node: JsxSpreadAttribute) { @@ -2352,7 +2357,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi operand.kind !== SyntaxKind.PostfixUnaryExpression && operand.kind !== SyntaxKind.NewExpression && !(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) && - !(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression)) { + !(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression) && + !(operand.kind === SyntaxKind.NumericLiteral && node.parent.kind === SyntaxKind.PropertyAccessExpression)) { emit(operand); return; } @@ -3142,6 +3148,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void { Debug.assert(compilerOptions.module === ModuleKind.System); + + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) { + return; + } writeLine(); emitStart(specifier.name); @@ -3666,7 +3676,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitFunctionDeclaration(node: FunctionLikeDeclaration) { if (nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } // TODO (yuisu) : we should not have special cases to condition emitting comments @@ -4143,7 +4153,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) { if (!(member).body) { - return emitOnlyPinnedOrTripleSlashComments(member); + return emitCommentsOnNotEmittedNode(member); } writeLine(); @@ -4210,7 +4220,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitMemberFunctionsForES6AndHigher(node: ClassLikeDeclaration) { for (let member of node.members) { if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(member).body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } else if (member.kind === SyntaxKind.MethodDeclaration || member.kind === SyntaxKind.GetAccessor || @@ -4267,7 +4277,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Emit the constructor overload pinned comments forEach(node.members, member => { if (member.kind === SyntaxKind.Constructor && !(member).body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment if (member.kind === SyntaxKind.PropertyDeclaration && (member).initializer && (member.flags & NodeFlags.Static) === 0) { @@ -4939,63 +4949,61 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitSerializedTypeNode(node: TypeNode) { - if (!node) { - return; + if (node) { + + switch (node.kind) { + case SyntaxKind.VoidKeyword: + write("void 0"); + return; + + case SyntaxKind.ParenthesizedType: + emitSerializedTypeNode((node).type); + return; + + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructorType: + write("Function"); + return; + + case SyntaxKind.ArrayType: + case SyntaxKind.TupleType: + write("Array"); + return; + + case SyntaxKind.TypePredicate: + case SyntaxKind.BooleanKeyword: + write("Boolean"); + return; + + case SyntaxKind.StringKeyword: + case SyntaxKind.StringLiteral: + write("String"); + return; + + case SyntaxKind.NumberKeyword: + write("Number"); + return; + + case SyntaxKind.SymbolKeyword: + write("Symbol"); + return; + + case SyntaxKind.TypeReference: + emitSerializedTypeReferenceNode(node); + return; + + case SyntaxKind.TypeQuery: + case SyntaxKind.TypeLiteral: + case SyntaxKind.UnionType: + case SyntaxKind.IntersectionType: + case SyntaxKind.AnyKeyword: + break; + + default: + Debug.fail("Cannot serialize unexpected type node."); + break; + } } - - switch (node.kind) { - case SyntaxKind.VoidKeyword: - write("void 0"); - return; - - case SyntaxKind.ParenthesizedType: - emitSerializedTypeNode((node).type); - return; - - case SyntaxKind.FunctionType: - case SyntaxKind.ConstructorType: - write("Function"); - return; - - case SyntaxKind.ArrayType: - case SyntaxKind.TupleType: - write("Array"); - return; - - case SyntaxKind.TypePredicate: - case SyntaxKind.BooleanKeyword: - write("Boolean"); - return; - - case SyntaxKind.StringKeyword: - case SyntaxKind.StringLiteral: - write("String"); - return; - - case SyntaxKind.NumberKeyword: - write("Number"); - return; - - case SyntaxKind.SymbolKeyword: - write("Symbol"); - return; - - case SyntaxKind.TypeReference: - emitSerializedTypeReferenceNode(node); - return; - - case SyntaxKind.TypeQuery: - case SyntaxKind.TypeLiteral: - case SyntaxKind.UnionType: - case SyntaxKind.IntersectionType: - case SyntaxKind.AnyKeyword: - break; - - default: - Debug.fail("Cannot serialize unexpected type node."); - break; - } - write("Object"); } @@ -5168,7 +5176,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitInterfaceDeclaration(node: InterfaceDeclaration) { - emitOnlyPinnedOrTripleSlashComments(node); + emitCommentsOnNotEmittedNode(node); } function shouldEmitEnumDeclaration(node: EnumDeclaration) { @@ -5290,7 +5298,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } let hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); let emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); @@ -6091,7 +6099,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return; } - if (isInternalModuleImportEqualsDeclaration(node)) { + if (isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } @@ -6720,7 +6728,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void { if (node) { if (node.flags & NodeFlags.Ambient) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { @@ -6987,22 +6995,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return leadingComments; } - /** - * Removes all but the pinned or triple slash comments. - * @param ranges The array to be filtered - * @param onlyPinnedOrTripleSlashComments whether the filtering should be performed. - */ - function filterComments(ranges: CommentRange[], onlyPinnedOrTripleSlashComments: boolean): CommentRange[] { - // If we're removing comments, then we want to strip out all but the pinned or - // triple slash comments. - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } - } + function isPinnedComments(comment: CommentRange) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && + currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; + } - return ranges; + /** + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(comment: CommentRange) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash) { + let textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(fullTripleSlashReferencePathRegEx) || + textSubStr.match(fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; } function getLeadingCommentsToEmit(node: Node) { @@ -7030,28 +7044,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function emitOnlyPinnedOrTripleSlashComments(node: Node) { - emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true); + /** + * Emit comments associated with node that will not be emitted into JS file + */ + function emitCommentsOnNotEmittedNode(node: Node) { + emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); } function emitLeadingComments(node: Node) { - return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); } - function emitLeadingCommentsWorker(node: Node, onlyPinnedOrTripleSlashComments: boolean) { - // If the caller only wants pinned or triple slash comments, then always filter - // down to that set. Otherwise, filter based on the current compiler options. - let leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); + function emitLeadingCommentsWorker(node: Node, isEmittedNode: boolean) { + if (compilerOptions.removeComments) { + return; + } + + let leadingComments: CommentRange[]; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + if (node.pos === 0) { + leadingComments = filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node: Node) { + if (compilerOptions.removeComments) { + return; + } + // Emit the trailing comments only if the parent's end doesn't match - let trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + let trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); @@ -7063,13 +7102,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi * ^ => pos; the function will emit "comment1" in the emitJS */ function emitTrailingCommentsOfPosition(pos: number) { - let trailingComments = filterComments(getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + + let trailingComments = getTrailingCommentRanges(currentSourceFile.text, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitLeadingCommentsOfPosition(pos: number) { + function emitLeadingCommentsOfPositionWorker(pos: number) { + if (compilerOptions.removeComments) { + return; + } + let leadingComments: CommentRange[]; if (hasDetachedComments(pos)) { // get comments without detached comments @@ -7080,7 +7127,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi leadingComments = getLeadingCommentRanges(currentSourceFile.text, pos); } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space @@ -7088,7 +7134,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitDetachedComments(node: TextRange) { - let leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); + let leadingComments: CommentRange[]; + if (compilerOptions.removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = filter(getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { let detachedComments: CommentRange[] = []; let lastComment: CommentRange; @@ -7138,20 +7199,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(shebang); } } - - function isPinnedOrTripleSlashComment(comment: CommentRange) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; - } - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text - // so that we don't end up computing comment string and doing match for all // comments - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash && - currentSourceFile.text.substring(comment.pos, comment.end).match(fullTripleSlashReferencePathRegEx)) { - return true; - } - } } function emitFile(jsFilePath: string, sourceFile?: SourceFile) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 350b9d450b8..330ad05518b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1058,11 +1058,11 @@ namespace ts { } function parseIdentifierName(): Identifier { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName(): boolean { - return isIdentifierOrKeyword() || + return tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral; } @@ -1086,7 +1086,7 @@ namespace ts { } function isSimplePropertyName() { - return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || isIdentifierOrKeyword(); + return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName(): ComputedPropertyName { @@ -1213,9 +1213,9 @@ namespace ts { case ParsingContext.HeritageClauses: return isHeritageClause(); case ParsingContext.ImportOrExportSpecifiers: - return isIdentifierOrKeyword(); + return tokenIsIdentifierOrKeyword(token); case ParsingContext.JsxAttributes: - return isIdentifierOrKeyword() || token === SyntaxKind.OpenBraceToken; + return tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.OpenBraceToken; case ParsingContext.JsxChildren: return true; case ParsingContext.JSDocFunctionParameters: @@ -1254,7 +1254,7 @@ namespace ts { function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword(): boolean { @@ -1824,7 +1824,7 @@ namespace ts { // the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword". // In the first case though, ASI will not take effect because there is not a // line terminator after the identifier or keyword. - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token)) { let matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { @@ -2282,7 +2282,7 @@ namespace ts { } } - if (isIdentifierOrKeyword()) { + if (tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -4101,13 +4101,9 @@ namespace ts { } } - function isIdentifierOrKeyword() { - return token >= SyntaxKind.Identifier; - } - function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { @@ -4117,7 +4113,7 @@ namespace ts { function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak(); + return (tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak(); } function isDeclaration(): boolean { @@ -4170,7 +4166,7 @@ namespace ts { case SyntaxKind.ImportKeyword: nextToken(); return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken || - token === SyntaxKind.OpenBraceToken || isIdentifierOrKeyword(); + token === SyntaxKind.OpenBraceToken || tokenIsIdentifierOrKeyword(token); case SyntaxKind.ExportKeyword: nextToken(); if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken || @@ -4777,7 +4773,7 @@ namespace ts { // It is very important that we check this *after* checking indexers because // the [ token can start an index signature or a computed property name - if (isIdentifierOrKeyword() || + if (tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || token === SyntaxKind.AsteriskToken || @@ -5320,7 +5316,7 @@ namespace ts { return true; } - return isIdentifierOrKeyword(); + return tokenIsIdentifierOrKeyword(token); } export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 402b413dd9c..1ac4151e834 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -12,7 +12,7 @@ namespace ts { let emptyArray: any[] = []; - export const version = "1.7.0"; + export const version = "1.6.0"; export function findConfigFile(searchPath: string): string { let fileName = "tsconfig.json"; @@ -36,7 +36,7 @@ namespace ts { return normalizePath(referencedFileName); } - export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let moduleResolution = compilerOptions.moduleResolution !== undefined ? compilerOptions.moduleResolution : compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; @@ -47,7 +47,7 @@ namespace ts { } } - export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule { + export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let containingDirectory = getDirectoryPath(containingFile); if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { @@ -56,11 +56,13 @@ namespace ts { let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName, failedLookupLocations }; + return { resolvedModule: { resolvedFileName }, failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); - return { resolvedFileName, failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName }, failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -117,7 +119,7 @@ namespace ts { return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); } - function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule { + function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let failedLookupLocations: string[] = []; directory = normalizeSlashes(directory); while (true) { @@ -127,12 +129,12 @@ namespace ts { let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } } @@ -144,47 +146,19 @@ namespace ts { directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations }; - } - - export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule { - Debug.assert(baseUrl !== undefined); - - let normalizedModuleName = normalizeSlashes(moduleName); - let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile); - let candidate = normalizePath(combinePaths(basePart, moduleName)); - - let failedLookupLocations: string[] = []; - - return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations }; - - function tryLoadFile(location: string): ResolvedModule { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } + return { resolvedModule: undefined, failedLookupLocations }; } function nameStartsWithDotSlashOrDotDotSlash(name: string) { let i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot); } - - function useBaseUrl(moduleName: string): boolean { - // path is not rooted - // module name does not start with './' or '../' - return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } - export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } let searchPath = getDirectoryPath(containingFile); @@ -222,7 +196,9 @@ namespace ts { searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations }; } /* @internal */ @@ -358,7 +334,8 @@ namespace ts { export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program { let program: Program; let files: SourceFile[] = []; - let diagnostics = createDiagnosticCollection(); + let fileProcessingDiagnostics = createDiagnosticCollection(); + let programDiagnostics = createDiagnosticCollection(); let commonSourceDirectory: string; let diagnosticsProducingTypeChecker: TypeChecker; @@ -371,9 +348,9 @@ namespace ts { host = host || createCompilerHost(options); - const resolveModuleNamesWorker = - host.resolveModuleNames || - ((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName)); + const resolveModuleNamesWorker = host.resolveModuleNames + ? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile)) + : ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule)); let filesByName = createFileMap(fileName => host.getCanonicalFileName(fileName)); @@ -428,6 +405,7 @@ namespace ts { getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(), getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(), getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(), + getFileProcessingDiagnostics: () => fileProcessingDiagnostics }; return program; @@ -460,6 +438,7 @@ namespace ts { // check if program source files has changed in the way that can affect structure of the program let newSourceFiles: SourceFile[] = []; + let modifiedSourceFiles: SourceFile[] = []; for (let oldSourceFile of oldProgram.getSourceFiles()) { let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { @@ -491,14 +470,22 @@ namespace ts { let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); // ensure that module resolution results are still correct for (let i = 0; i < moduleNames.length; ++i) { - let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + let newResolution = resolutions[i]; + let oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]); + let resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport + : newResolution; + + if (resolutionChanged) { return false; - } + } } } // pass the cache of module resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { // file has no changes - use it as is @@ -515,7 +502,11 @@ namespace ts { } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (let modifiedFile of modifiedSourceFiles) { + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; @@ -645,9 +636,10 @@ namespace ts { Debug.assert(!!sourceFile.bindDiagnostics); let bindDiagnostics = sourceFile.bindDiagnostics; let checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - let programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + let fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + let programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } @@ -664,7 +656,8 @@ namespace ts { function getOptionsDiagnostics(): Diagnostic[] { let allDiagnostics: Diagnostic[] = []; - addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()) + addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return sortAndDeduplicateDiagnostics(allDiagnostics); } @@ -772,10 +765,10 @@ namespace ts { if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument)); + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument)); } else { - diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); } } } @@ -797,11 +790,11 @@ namespace ts { // We haven't looked for this file, do so now and cache result let file = host.getSourceFile(fileName, options.target, hostErrorMessage => { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -837,11 +830,11 @@ namespace ts { let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -864,9 +857,23 @@ namespace ts { let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (let i = 0; i < file.imports.length; ++i) { let resolution = resolutions[i]; - setResolvedModuleName(file, moduleNames[i], resolution); + setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.isExternalLibraryImport) { + if (!isExternalModule(importedFile)) { + let start = getTokenPosOfNode(file.imports[i], file) + fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + } + else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) { + let start = getTokenPosOfNode(file.imports[i], file) + fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + } + else if (importedFile.referencedFiles.length) { + let firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } } } } @@ -877,7 +884,7 @@ namespace ts { return; function findModuleSourceFile(fileName: string, nameLiteral: Expression) { - return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, /* isDefaultLib */ false, file, skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } @@ -902,7 +909,7 @@ namespace ts { for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } @@ -931,7 +938,7 @@ namespace ts { if (!isDeclarationFile(sourceFile)) { let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -944,52 +951,52 @@ namespace ts { function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -1000,24 +1007,24 @@ namespace ts { let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { if (!options.module && languageVersion < ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); if (firstNonExternalModuleSourceFile) { let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot @@ -1046,30 +1053,30 @@ namespace ts { if (options.noEmit) { if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 199e7e9b638..82fbc8c2a59 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -6,6 +6,11 @@ namespace ts { (message: DiagnosticMessage, length: number): void; } + /* @internal */ + export function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean { + return token >= SyntaxKind.Identifier; + } + export interface Scanner { getStartPos(): number; getToken(): SyntaxKind; @@ -1590,7 +1595,7 @@ namespace ts { // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes function scanJsxIdentifier(): SyntaxKind { - if (token === SyntaxKind.Identifier) { + if (tokenIsIdentifierOrKeyword(token)) { let firstCharPosition = pos; while (pos < end) { let ch = text.charCodeAt(pos); diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 8c0a6d4e8c4..96759b68250 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -216,7 +216,7 @@ namespace ts { if (!cachedProgram) { if (configFileName) { - let result = readConfigFile(configFileName); + let result = readConfigFile(configFileName, sys.readFile); if (result.error) { reportDiagnostic(result.error); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0d2526cef98..58228679d3b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1286,7 +1286,7 @@ namespace ts { // Stores a mapping 'external module reference text' -> 'resolved file name' | undefined // It is used to resolve module names in the checker. // Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead - /* @internal */ resolvedModules: Map; + /* @internal */ resolvedModules: Map; /* @internal */ imports: LiteralExpression[]; } @@ -1361,6 +1361,7 @@ namespace ts { /* @internal */ getSymbolCount(): number; /* @internal */ getTypeCount(): number; + /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; // For testing purposes only. /* @internal */ structureIsReused?: boolean; } @@ -1716,6 +1717,7 @@ namespace ts { resolvedExports?: SymbolTable; // Resolved exports of module exportsChecked?: boolean; // True if exports of external module have been checked isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration + bindingElement?: BindingElement; // Binding element associated with property symbol } /* @internal */ @@ -1813,11 +1815,14 @@ namespace ts { PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType } + export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; + // Properties common to all types export interface Type { - flags: TypeFlags; // Flags - /* @internal */ id: number; // Unique ID - symbol?: Symbol; // Symbol associated with type (if any) + flags: TypeFlags; // Flags + /* @internal */ id: number; // Unique ID + symbol?: Symbol; // Symbol associated with type (if any) + pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any) } /* @internal */ @@ -1866,8 +1871,7 @@ namespace ts { } export interface TupleType extends ObjectType { - elementTypes: Type[]; // Element types - baseArrayType: TypeReference; // Array where T is best common type of element types + elementTypes: Type[]; // Element types } export interface UnionOrIntersectionType extends Type { @@ -2275,11 +2279,20 @@ namespace ts { export interface ResolvedModule { resolvedFileName: string; + /* + * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be proper external module: + * - be a .d.ts file + * - use top level imports\exports + * - don't use tripleslash references + */ + isExternalLibraryImport?: boolean; + } + + export interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModule; failedLookupLocations: string[]; } - export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; - export interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; @@ -2297,7 +2310,7 @@ namespace ts { * If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just * 'throw new Error("NotImplemented")' */ - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } export interface TextSpan { @@ -2328,5 +2341,7 @@ namespace ts { // operation caused diagnostics to be returned by storing and comparing the return value // of this method before/after the operation is performed. getModificationCount(): number; + + /* @internal */ reattachFileDiagnostics(newFile: SourceFile): void; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 99ea06532a0..ed8b516b7f3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -99,20 +99,20 @@ namespace ts { return true; } - export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean { + export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean { return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText); } - export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void { + export function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } // Returns true if this node contains a parse error anywhere underneath it. @@ -435,6 +435,7 @@ namespace ts { } export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + export let fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; export function isTypeNode(node: Node): boolean { if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { @@ -1507,12 +1508,23 @@ namespace ts { add, getGlobalDiagnostics, getDiagnostics, - getModificationCount + getModificationCount, + reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + + function reattachFileDiagnostics(newFile: SourceFile): void { + if (!hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + + for (let diagnostic of fileDiagnostics[newFile.fileName]) { + diagnostic.file = newFile; + } + } function add(diagnostic: Diagnostic): void { let diagnostics: Diagnostic[]; diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 87e22e08cfa..a24ed30ae14 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -44,10 +44,10 @@ class CompilerBaselineRunner extends RunnerBase { // Everything declared here should be cleared out in the "after" callback. let justName: string; let content: string; - let testCaseContent: { settings: Harness.TestCaseParser.CompilerSetting[]; testUnitData: Harness.TestCaseParser.TestUnitData[]; }; + let testCaseContent: { settings: Harness.TestCaseParser.CompilerSettings; testUnitData: Harness.TestCaseParser.TestUnitData[]; }; let units: Harness.TestCaseParser.TestUnitData[]; - let tcSettings: Harness.TestCaseParser.CompilerSetting[]; + let tcSettings: Harness.TestCaseParser.CompilerSettings; let lastUnit: Harness.TestCaseParser.TestUnitData; let rootDir: string; @@ -61,15 +61,12 @@ class CompilerBaselineRunner extends RunnerBase { let otherFiles: { unitName: string; content: string }[]; let harnessCompiler: Harness.Compiler.HarnessCompiler; - let createNewInstance = false; - before(() => { justName = fileName.replace(/^.*[\\\/]/, ""); // strips the fileName from the path. content = Harness.IO.readFile(fileName); testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName); units = testCaseContent.testUnitData; tcSettings = testCaseContent.settings; - createNewInstance = false; lastUnit = units[units.length - 1]; rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/"; harnessCompiler = Harness.Compiler.getCompiler(); @@ -100,27 +97,6 @@ class CompilerBaselineRunner extends RunnerBase { }); }); - beforeEach(() => { - /* The compiler doesn't handle certain flags flipping during a single compilation setting. Tests on these flags will need - a fresh compiler instance for themselves and then create a fresh one for the next test. Would be nice to get dev fixes - eventually to remove this limitation. */ - for (let i = 0; i < tcSettings.length; ++i) { - // noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings - if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === "target")) { - harnessCompiler = Harness.Compiler.getCompiler(); - harnessCompiler.setCompilerSettings(tcSettings); - createNewInstance = true; - } - } - }); - - afterEach(() => { - if (createNewInstance) { - harnessCompiler = Harness.Compiler.getCompiler(); - createNewInstance = false; - } - }); - after(() => { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Therefore we have to clean out large objects after the test is done. @@ -402,10 +378,6 @@ class CompilerBaselineRunner extends RunnerBase { else { this.tests.forEach(test => this.checkTestCodeOutput(test)); } - - describe("Cleanup after compiler baselines", () => { - let harnessCompiler = Harness.Compiler.getCompiler(); - }); }); } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 5bfac3d9bb5..1d333a29ccb 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -29,13 +29,13 @@ module FourSlash { fileName: string; version: number; // File-specific options (name/value pairs) - fileOptions: { [index: string]: string; }; + fileOptions: Harness.TestCaseParser.CompilerSettings; } // Represents a set of parsed source files and options export interface FourSlashData { // Global options (name/value pairs) - globalOptions: { [index: string]: string; }; + globalOptions: Harness.TestCaseParser.CompilerSettings; files: FourSlashFile[]; @@ -117,89 +117,17 @@ module FourSlash { // Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data let metadataOptionNames = { baselineFile: "BaselineFile", - declaration: "declaration", emitThisFile: "emitThisFile", // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project fileName: "Filename", - mapRoot: "mapRoot", - module: "module", - out: "out", - outFile: "outFile", - outDir: "outDir", - sourceMap: "sourceMap", - sourceRoot: "sourceRoot", - allowNonTsExtensions: "allowNonTsExtensions", resolveReference: "ResolveReference", // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file - jsx: "jsx", }; // List of allowed metadata names let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference]; - let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration, - metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,metadataOptionNames.outFile, - metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot, metadataOptionNames.jsx]; - function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions { + function convertGlobalOptionsToCompilerOptions(globalOptions: Harness.TestCaseParser.CompilerSettings): ts.CompilerOptions { let settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 }; - // Convert all property in globalOptions into ts.CompilationSettings - for (let prop in globalOptions) { - if (globalOptions.hasOwnProperty(prop)) { - switch (prop) { - case metadataOptionNames.allowNonTsExtensions: - settings.allowNonTsExtensions = globalOptions[prop] === "true"; - break; - case metadataOptionNames.declaration: - settings.declaration = globalOptions[prop] === "true"; - break; - case metadataOptionNames.mapRoot: - settings.mapRoot = globalOptions[prop]; - break; - case metadataOptionNames.module: - // create appropriate external module target for CompilationSettings - switch (globalOptions[prop]) { - case "AMD": - settings.module = ts.ModuleKind.AMD; - break; - case "CommonJS": - settings.module = ts.ModuleKind.CommonJS; - break; - default: - ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None"); - settings.module = ts.ModuleKind.None; - break; - } - break; - case metadataOptionNames.out: - settings.out = globalOptions[prop]; - break; - case metadataOptionNames.outFile: - settings.outFile = globalOptions[prop]; - break; - case metadataOptionNames.outDir: - settings.outDir = globalOptions[prop]; - break; - case metadataOptionNames.sourceMap: - settings.sourceMap = globalOptions[prop] === "true"; - break; - case metadataOptionNames.sourceRoot: - settings.sourceRoot = globalOptions[prop]; - break; - case metadataOptionNames.jsx: - switch (globalOptions[prop].toLowerCase()) { - case "react": - settings.jsx = ts.JsxEmit.React; - break; - case "preserve": - settings.jsx = ts.JsxEmit.Preserve; - break; - default: - ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None"); - settings.jsx = ts.JsxEmit.None; - break; - } - break; - } - } - } + Harness.Compiler.setCompilerOptionsFromHarnessSetting(globalOptions, settings); return settings; } @@ -2514,12 +2442,16 @@ module FourSlash { // Comment line, check for global/file @options and record them let match = optionRegex.exec(line.substr(2)); if (match) { - let globalMetadataNamesIndex = globalMetadataNames.indexOf(match[1]); let fileMetadataNamesIndex = fileMetadataNames.indexOf(match[1]); - if (globalMetadataNamesIndex === -1) { - if (fileMetadataNamesIndex === -1) { - throw new Error(`Unrecognized metadata name "${match[1]}". Available global metadata names are: ${globalMetadataNames.join(", ")}; file metadata names are: ${fileMetadataNames.join(", ")}`); - } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) { + if (fileMetadataNamesIndex === -1) { + // Check if the match is already existed in the global options + if (globalOptions[match[1]] !== undefined) { + throw new Error("Global Option : '" + match[1] + "' is already existed"); + } + globalOptions[match[1]] = match[2]; + } + else { + if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) { // Found an @FileName directive, if this is not the first then create a new subfile if (currentFileContent) { let file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); @@ -2540,12 +2472,6 @@ module FourSlash { // Add other fileMetadata flag currentFileOptions[match[1]] = match[2]; } - } else { - // Check if the match is already existed in the global options - if (globalOptions[match[1]] !== undefined) { - throw new Error("Global Option : '" + match[1] + "' is already existed"); - } - globalOptions[match[1]] = match[2]; } } // TODO: should be '==='? diff --git a/src/harness/harness.ts b/src/harness/harness.ts index a23f19e36b7..01b583d64e1 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -851,9 +851,9 @@ module Harness { } export function createSourceFileAndAssertInvariants( - fileName: string, - sourceText: string, - languageVersion: ts.ScriptTarget) { + fileName: string, + sourceText: string, + languageVersion: ts.ScriptTarget) { // We'll only assert inletiants outside of light mode. const shouldAssertInvariants = !Harness.lightMode; @@ -883,13 +883,13 @@ module Harness { } export function createCompilerHost( - inputFiles: { unitName: string; content: string; }[], - writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void, - scriptTarget: ts.ScriptTarget, - useCaseSensitiveFileNames: boolean, - // the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host - currentDirectory?: string, - newLineKind?: ts.NewLineKind): ts.CompilerHost { + inputFiles: { unitName: string; content: string; }[], + writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void, + scriptTarget: ts.ScriptTarget, + useCaseSensitiveFileNames: boolean, + // the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host + currentDirectory?: string, + newLineKind?: ts.NewLineKind): ts.CompilerHost { // Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames function getCanonicalFileName(fileName: string): string { @@ -907,7 +907,7 @@ module Harness { } }; inputFiles.forEach(register); - + function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) { fn = ts.normalizePath(fn); if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) { @@ -949,16 +949,79 @@ module Harness { }; } + interface HarnessOptions { + useCaseSensitiveFileNames?: boolean; + includeBuiltFile?: string; + baselineFile?: string; + } + + // Additional options not already in ts.optionDeclarations + const harnessOptionDeclarations: ts.CommandLineOption[] = [ + { name: "allowNonTsExtensions", type: "boolean" }, + { name: "useCaseSensitiveFileNames", type: "boolean" }, + { name: "baselineFile", type: "string" }, + { name: "includeBuiltFile", type: "string" }, + { name: "fileName", type: "string" }, + { name: "noErrorTruncation", type: "boolean" } + ]; + + let optionsIndex: ts.Map; + function getCommandLineOption(name: string): ts.CommandLineOption { + if (!optionsIndex) { + optionsIndex = {}; + let optionDeclarations = harnessOptionDeclarations.concat(ts.optionDeclarations); + for (let option of optionDeclarations) { + optionsIndex[option.name.toLowerCase()] = option; + } + } + return ts.lookUp(optionsIndex, name.toLowerCase()); + } + + export function setCompilerOptionsFromHarnessSetting(settings: Harness.TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void { + for (let name in settings) { + if (settings.hasOwnProperty(name)) { + let value = settings[name]; + if (value === undefined) { + throw new Error(`Cannot have undefined value for compiler option '${name}'.`); + } + let option = getCommandLineOption(name); + if (option) { + switch (option.type) { + case "boolean": + options[option.name] = value.toLowerCase() === "true"; + break; + case "string": + options[option.name] = value; + break; + // If not a primitive, the possible types are specified in what is effectively a map of options. + default: + let map = >option.type; + let key = value.toLowerCase(); + if (ts.hasProperty(map, key)) { + options[option.name] = map[key]; + } + else { + throw new Error(`Unknown value '${value}' for compiler option '${name}'.`); + } + } + } + else { + throw new Error(`Unknown compiler option '${name}'.`); + } + } + } + } + export class HarnessCompiler { private inputFiles: { unitName: string; content: string }[] = []; private compileOptions: ts.CompilerOptions; - private settings: Harness.TestCaseParser.CompilerSetting[] = []; + private settings: Harness.TestCaseParser.CompilerSettings = {}; private lastErrors: ts.Diagnostic[]; public reset() { this.inputFiles = []; - this.settings = []; + this.settings = {}; this.lastErrors = []; } @@ -966,11 +1029,7 @@ module Harness { return this.lastErrors; } - public setCompilerSettingsFromOptions(tcSettings: ts.CompilerOptions) { - this.settings = Object.keys(tcSettings).map(k => ({ flag: k, value: (tcSettings)[k] })); - } - - public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSetting[]) { + public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSettings) { this.settings = tcSettings; } @@ -1006,7 +1065,7 @@ module Harness { otherFiles: { unitName: string; content: string }[], onComplete: (result: CompilerResult, program: ts.Program) => void, settingsCallback?: (settings: ts.CompilerOptions) => void, - options?: ts.CompilerOptions, + options?: ts.CompilerOptions & HarnessOptions, // Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file currentDirectory?: string) { @@ -1015,21 +1074,27 @@ module Harness { options.module = options.module || ts.ModuleKind.None; options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; options.noErrorTruncation = true; + options.skipDefaultLibCheck = true; if (settingsCallback) { settingsCallback(null); } let newLine = "\r\n"; - options.skipDefaultLibCheck = true; + + // Parse settings + setCompilerOptionsFromHarnessSetting(this.settings, options); // Files from built\local that are requested by test "@includeBuiltFiles" to be in the context. // Treat them as library files, so include them in build, but not in baselines. let includeBuiltFiles: { unitName: string; content: string }[] = []; + if (options.includeBuiltFile) { + let builtFileName = libFolder + options.includeBuiltFile; + includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) }); + } - let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames(); - this.settings.forEach(setCompilerOptionForSetting); - + let useCaseSensitiveFileNames = options.useCaseSensitiveFileNames !== undefined ? options.useCaseSensitiveFileNames : Harness.IO.useCaseSensitiveFileNames(); + let fileOutputs: GeneratedFile[] = []; let programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName); @@ -1049,216 +1114,6 @@ module Harness { onComplete(result, program); return options; - - function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) { - switch (setting.flag.toLowerCase()) { - // "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" - case "module": - case "modulegentarget": - if (typeof setting.value === "string") { - if (setting.value.toLowerCase() === "amd") { - options.module = ts.ModuleKind.AMD; - } else if (setting.value.toLowerCase() === "umd") { - options.module = ts.ModuleKind.UMD; - } else if (setting.value.toLowerCase() === "commonjs") { - options.module = ts.ModuleKind.CommonJS; - if (options.moduleResolution === undefined) { - // TODO: currently we have relative module names pretty much in all tests that use CommonJS module target. - // Such names could never be resolved in Node however classic resolution strategy still can handle them. - // Changing all module names to relative will be a major overhaul in code (but we'll do this anyway) so as a temporary measure - // we'll use ts.ModuleResolutionKind.Classic for CommonJS modules. - options.moduleResolution = ts.ModuleResolutionKind.Classic; - } - } else if (setting.value.toLowerCase() === "system") { - options.module = ts.ModuleKind.System; - } else if (setting.value.toLowerCase() === "unspecified") { - options.module = ts.ModuleKind.None; - } else { - throw new Error("Unknown module type " + setting.value); - } - } else { - options.module = setting.value; - } - break; - case "moduleresolution": - switch((setting.value || "").toLowerCase()) { - case "classic": - options.moduleResolution = ts.ModuleResolutionKind.Classic; - break; - case "node": - options.moduleResolution = ts.ModuleResolutionKind.NodeJs; - break; - } - break; - case "target": - case "codegentarget": - if (typeof setting.value === "string") { - if (setting.value.toLowerCase() === "es3") { - options.target = ts.ScriptTarget.ES3; - } else if (setting.value.toLowerCase() === "es5") { - options.target = ts.ScriptTarget.ES5; - } else if (setting.value.toLowerCase() === "es6") { - options.target = ts.ScriptTarget.ES6; - } else { - throw new Error("Unknown compile target " + setting.value); - } - } else { - options.target = setting.value; - } - break; - - case "experimentaldecorators": - options.experimentalDecorators = setting.value === "true"; - break; - - case "emitdecoratormetadata": - options.emitDecoratorMetadata = setting.value === "true"; - break; - - case "experimentalasyncfunctions": - options.experimentalAsyncFunctions = setting.value === "true"; - break; - - case "noemithelpers": - options.noEmitHelpers = setting.value === "true"; - break; - - case "noemitonerror": - options.noEmitOnError = setting.value === "true"; - break; - - case "noresolve": - options.noResolve = setting.value === "true"; - break; - - case "noimplicitany": - options.noImplicitAny = setting.value === "true"; - break; - - case "nolib": - options.noLib = setting.value === "true"; - break; - - case "out": - case "outfileoption": - options.out = setting.value; - break; - - case "outfile": - options.outFile = setting.value; - break; - - case "outdiroption": - case "outdir": - options.outDir = setting.value; - break; - - case "skipdefaultlibcheck": - options.skipDefaultLibCheck = setting.value === "true"; - break; - - case "sourceroot": - options.sourceRoot = setting.value; - break; - - case "maproot": - options.mapRoot = setting.value; - break; - - case "sourcemap": - options.sourceMap = setting.value === "true"; - break; - - case "declaration": - options.declaration = setting.value === "true"; - break; - - case "newline": - if (setting.value.toLowerCase() === "crlf") { - options.newLine = ts.NewLineKind.CarriageReturnLineFeed; - } - else if (setting.value.toLowerCase() === "lf") { - options.newLine = ts.NewLineKind.LineFeed; - } - else { - throw new Error("Unknown option for newLine: " + setting.value); - } - break; - - case "comments": - options.removeComments = setting.value === "false"; - break; - - case "stripinternal": - options.stripInternal = setting.value === "true"; - - case "usecasesensitivefilenames": - useCaseSensitiveFileNames = setting.value === "true"; - break; - - case "filename": - // Not supported yet - break; - - case "emitbom": - options.emitBOM = setting.value === "true"; - break; - - case "errortruncation": - options.noErrorTruncation = setting.value === "false"; - break; - - case "preserveconstenums": - options.preserveConstEnums = setting.value === "true"; - break; - - case "isolatedmodules": - options.isolatedModules = setting.value === "true"; - break; - - case "suppressexcesspropertyerrors": - options.suppressExcessPropertyErrors = setting.value === "true"; - break; - - case "suppressimplicitanyindexerrors": - options.suppressImplicitAnyIndexErrors = setting.value === "true"; - break; - - case "includebuiltfile": - let builtFileName = libFolder + setting.value; - includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) }); - break; - - case "inlinesourcemap": - options.inlineSourceMap = setting.value === "true"; - break; - - case "inlinesources": - options.inlineSources = setting.value === "true"; - break; - - case "jsx": - options.jsx = setting.value.toLowerCase() === "react" ? ts.JsxEmit.React : - setting.value.toLowerCase() === "preserve" ? ts.JsxEmit.Preserve : - ts.JsxEmit.None; - break; - case "nounusedlabels": - options.noUnusedLabels = setting.value === "true" - break; - case "noimplicitreturns": - options.noImplicitReturns = setting.value === "true" - break; - case "nofallthroughcasesinswitch": - options.noFallthroughCasesInSwitch = setting.value === "true" - break; - case "nounreachablecode": - options.noUnreachableCode = setting.value === "true" - break; - - default: - throw new Error("Unsupported compiler setting " + setting.flag); - } - } } public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[], @@ -1583,9 +1438,8 @@ module Harness { export module TestCaseParser { /** all the necessary information to set the right compiler settings */ - export interface CompilerSetting { - flag: string; - value: string; + export interface CompilerSettings { + [name: string]: string; } /** All the necessary information to turn a multi file test into useful units for later compilation */ @@ -1600,30 +1454,19 @@ module Harness { // Regex for parsing options in the format "@Alpha: Value of any sort" let optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines - // List of allowed metadata names - let fileMetadataNames = ["filename", "comments", "declaration", "module", - "nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror", - "noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom", - "errortruncation", "usecasesensitivefilenames", "preserveconstenums", - "includebuiltfile", "suppressexcesspropertyerrors", "suppressimplicitanyindexerrors", "stripinternal", - "isolatedmodules", "inlinesourcemap", "maproot", "sourceroot", - "inlinesources", "emitdecoratormetadata", "experimentaldecorators", - "skipdefaultlibcheck", "jsx"]; - - function extractCompilerSettings(content: string): CompilerSetting[] { - - let opts: CompilerSetting[] = []; + function extractCompilerSettings(content: string): CompilerSettings { + let opts: CompilerSettings = {}; let match: RegExpExecArray; while ((match = optionRegex.exec(content)) != null) { - opts.push({ flag: match[1], value: match[2] }); + opts[match[1]] = match[2]; } return opts; } /** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */ - export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } { + export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSettings; testUnitData: TestUnitData[]; } { let settings = extractCompilerSettings(code); // List of all the subfiles we've parsed out diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index f228bc862d8..c97ce50d275 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -225,8 +225,8 @@ module Harness.LanguageService { let imports: ts.Map = {}; for (let module of preprocessInfo.importedFiles) { let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); - if (resolutionInfo.resolvedFileName) { - imports[module.fileName] = resolutionInfo.resolvedFileName; + if (resolutionInfo.resolvedModule) { + imports[module.fileName] = resolutionInfo.resolvedModule.resolvedFileName; } } return JSON.stringify(imports); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 76bc586b8bb..7ab46fc689e 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -79,7 +79,7 @@ namespace ts.server { } } - interface TimestampedResolvedModule extends ResolvedModule { + interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations { lastCheckTime: number; } @@ -99,11 +99,11 @@ namespace ts.server { } } - resolveModuleNames(moduleNames: string[], containingFile: string): string[] { + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); let newResolutions: Map = {}; - let resolvedFileNames: string[] = []; + let resolvedModules: ResolvedModule[] = []; let compilerOptions = this.getCompilationSettings(); @@ -119,25 +119,25 @@ namespace ts.server { else { resolution = resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[moduleName] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedFileNames.push(resolution.resolvedFileName); + resolvedModules.push(resolution.resolvedModule); } // replace old results with a new one this.resolvedModuleNames.set(containingFile, newResolutions); - return resolvedFileNames; + return resolvedModules; function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean { if (!resolution) { return false; } - if (resolution.resolvedFileName) { + if (resolution.resolvedModule) { // TODO: consider checking failedLookupLocations // TODO: use lastCheckTime to track expiration for module name resolution return true; diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 66cdbd53750..fad3ebe6e2b 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -32,7 +32,7 @@ namespace ts.formatting { */ interface DynamicIndentation { getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind): number; - getIndentationForComment(owningToken: SyntaxKind): number; + getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number): number; /** * Indentation for open and close tokens of the node if it is block or another node that needs special indentation * ... { @@ -455,7 +455,7 @@ namespace ts.formatting { function getDynamicIndentation(node: Node, nodeStartLine: number, indentation: number, delta: number): DynamicIndentation { return { - getIndentationForComment: kind => { + getIndentationForComment: (kind, tokenIndentation) => { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -463,9 +463,10 @@ namespace ts.formatting { // } case SyntaxKind.CloseBraceToken: case SyntaxKind.CloseBracketToken: + case SyntaxKind.CloseParenToken: return indentation + delta; } - return indentation; + return tokenIndentation !== Constants.Unknown ? tokenIndentation : indentation; }, getIndentationForToken: (line, kind) => { if (nodeStartLine !== line && node.decorators) { @@ -716,8 +717,14 @@ namespace ts.formatting { } if (indentToken) { - let indentNextTokenOrTrivia = true; + let tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + Constants.Unknown; + if (currentTokenInfo.leadingTrivia) { + let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + let indentNextTokenOrTrivia = true; + for (let triviaItem of currentTokenInfo.leadingTrivia) { if (!rangeContainsRange(originalRange, triviaItem)) { continue; @@ -725,13 +732,11 @@ namespace ts.formatting { switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: - let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case SyntaxKind.SingleLineCommentTrivia: if (indentNextTokenOrTrivia) { - let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } @@ -744,8 +749,7 @@ namespace ts.formatting { } // indent token only if is it is in target range and does not overlap with any error ranges - if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - let tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + if (tokenIndentation !== Constants.Unknown) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 7e77878051c..6f6167d6ba9 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -17,7 +17,8 @@ namespace ts.formatting { Scan, RescanGreaterThanToken, RescanSlashToken, - RescanTemplateToken + RescanTemplateToken, + RescanJsxIdentifier } export function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner { @@ -108,6 +109,20 @@ namespace ts.formatting { return false; } + + function shouldRescanJsxIdentifier(node: Node): boolean { + if (node.parent) { + switch(node.parent.kind) { + case SyntaxKind.JsxAttribute: + case SyntaxKind.JsxOpeningElement: + case SyntaxKind.JsxClosingElement: + case SyntaxKind.JsxSelfClosingElement: + return node.kind === SyntaxKind.Identifier; + } + } + + return false; + } function shouldRescanSlashToken(container: Node): boolean { return container.kind === SyntaxKind.RegularExpressionLiteral; @@ -141,7 +156,9 @@ namespace ts.formatting { ? ScanAction.RescanSlashToken : shouldRescanTemplateToken(n) ? ScanAction.RescanTemplateToken - : ScanAction.Scan + : shouldRescanJsxIdentifier(n) + ? ScanAction.RescanJsxIdentifier + : ScanAction.Scan if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. @@ -176,6 +193,10 @@ namespace ts.formatting { currentToken = scanner.reScanTemplateToken(); lastScanAction = ScanAction.RescanTemplateToken; } + else if (expectedScanAction === ScanAction.RescanJsxIdentifier && currentToken === SyntaxKind.Identifier) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = ScanAction.RescanJsxIdentifier; + } else { lastScanAction = ScanAction.Scan; } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index f609edb0501..02e785f6b3e 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -213,25 +213,11 @@ namespace ts.formatting { public NoSpaceBetweenYieldKeywordAndStar: Rule; public SpaceBetweenYieldOrYieldStarAndOperand: Rule; - // Async-await + // Async functions public SpaceBetweenAsyncAndFunctionKeyword: Rule; - public NoSpaceBetweenAsyncAndFunctionKeyword: Rule; - public SpaceAfterAwaitKeyword: Rule; - public NoSpaceAfterAwaitKeyword: Rule; - - // Type alias declaration - public SpaceAfterTypeKeyword: Rule; - public NoSpaceAfterTypeKeyword: Rule; // Tagged template string public SpaceBetweenTagAndTemplateString: Rule; - public NoSpaceBetweenTagAndTemplateString: Rule; - - // Union type - public SpaceBeforeBar: Rule; - public NoSpaceBeforeBar: Rule; - public SpaceAfterBar: Rule; - public NoSpaceAfterBar: Rule; constructor() { /// @@ -272,7 +258,7 @@ namespace ts.formatting { this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia]); + this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a control flow construct @@ -313,7 +299,7 @@ namespace ts.formatting { this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword, SyntaxKind.AwaitKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space)); this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete)); this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); @@ -346,7 +332,7 @@ namespace ts.formatting { this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.AbstractKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword, SyntaxKind.TypeKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { @@ -382,24 +368,9 @@ namespace ts.formatting { // Async-await this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.SpaceAfterAwaitKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.AwaitKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterAwaitKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.AwaitKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - - // Type alias declaration - this.SpaceAfterTypeKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.TypeKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterTypeKeyword = new Rule(RuleDescriptor.create3(SyntaxKind.TypeKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); // template string this.SpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - - // union type - this.SpaceBeforeBar = new Rule(RuleDescriptor.create3(SyntaxKind.BarToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceBeforeBar = new Rule(RuleDescriptor.create3(SyntaxKind.BarToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.SpaceAfterBar = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.BarToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterBar = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.BarToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = @@ -427,11 +398,8 @@ namespace ts.formatting { this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword, - this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword, - this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, - this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, + this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, @@ -535,6 +503,8 @@ namespace ts.formatting { case SyntaxKind.ConditionalExpression: case SyntaxKind.AsExpression: case SyntaxKind.TypePredicate: + case SyntaxKind.UnionType: + case SyntaxKind.IntersectionType: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) @@ -663,6 +633,7 @@ namespace ts.formatting { static NodeIsTypeScriptDeclWithBlockContext(node: Node): boolean { switch (node.kind) { case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.TypeLiteral: diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 760ee16a507..117eb8f3af2 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -405,6 +405,7 @@ namespace ts.formatting { function nodeContentIsAlwaysIndented(kind: SyntaxKind): boolean { switch (kind) { case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.TypeAliasDeclaration: @@ -429,13 +430,13 @@ namespace ts.formatting { case SyntaxKind.ArrayBindingPattern: case SyntaxKind.ObjectBindingPattern: case SyntaxKind.JsxElement: + case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.MethodSignature: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: case SyntaxKind.Parameter: case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: - case SyntaxKind.UnionType: case SyntaxKind.ParenthesizedType: case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.AwaitExpression: diff --git a/src/services/services.ts b/src/services/services.ts index 44d9786566b..6f4ae2cdb1a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -802,7 +802,7 @@ namespace ts { public languageVariant: LanguageVariant; public identifiers: Map; public nameTable: Map; - public resolvedModules: Map; + public resolvedModules: Map; public imports: LiteralExpression[]; private namedDeclarations: Map; @@ -1022,7 +1022,7 @@ namespace ts { * if implementation is omitted then language service will use built-in module resolution logic and get answers to * host specific questions using 'getScriptSnapshot'. */ - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } // @@ -1866,7 +1866,7 @@ namespace ts { let sourceMapText: string; // Create a compilerHost object to allow the compiler to read and write files let compilerHost: CompilerHost = { - getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined, + getSourceFile: (fileName, target) => fileName === normalizeSlashes(inputFileName) ? sourceFile : undefined, writeFile: (name, text, writeByteOrderMark) => { if (fileExtensionIs(name, ".map")) { Debug.assert(sourceMapText === undefined, `Unexpected multiple source map outputs for the file '${name}'`); diff --git a/src/services/shims.ts b/src/services/shims.ts index ace438b2778..f1fb109ba7e 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -273,7 +273,7 @@ namespace ts { private loggingEnabled = false; private tracingEnabled = false; - public resolveModuleNames: (moduleName: string[], containingFile: string) => string[]; + public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; constructor(private shimHost: LanguageServiceShimHost) { // if shimHost is a COM object then property check will become method call with no arguments. @@ -281,7 +281,10 @@ namespace ts { if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = (moduleNames: string[], containingFile: string) => { let resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); - return map(moduleNames, name => lookUp(resolutionsInFile, name)); + return map(moduleNames, name => { + const result = lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); }; } } @@ -941,7 +944,11 @@ namespace ts { public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string { return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => { let compilerOptions = JSON.parse(compilerOptionsJson); - return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); + const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName: undefined, + failedLookupLocations: result.failedLookupLocations + }; }); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index d5ad93260cd..8b77dcb953b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -360,7 +360,7 @@ namespace ts { return find(startNode || sourceFile); function findRightmostToken(n: Node): Node { - if (isToken(n)) { + if (isToken(n) || n.kind === SyntaxKind.JsxText) { return n; } @@ -371,24 +371,35 @@ namespace ts { } function find(n: Node): Node { - if (isToken(n)) { + if (isToken(n) || n.kind === SyntaxKind.JsxText) { return n; } - let children = n.getChildren(); + const children = n.getChildren(); for (let i = 0, len = children.length; i < len; i++) { let child = children[i]; - if (nodeHasTokens(child)) { - if (position <= child.end) { - if (child.getStart(sourceFile) >= position) { - // actual start of the node is past the position - previous token should be at the end of previous child - let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); - return candidate && findRightmostToken(candidate) - } - else { - // candidate should be in this node - return find(child); - } + // condition 'position < child.end' checks if child node end after the position + // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' + // aaaa___bbbb___$__ccc + // after we found child node with end after the position we check if start of the node is after the position. + // if yes - then position is in the trivia and we need to look into the previous child to find the token in question. + // if no - position is in the node itself so we should recurse in it. + // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). + // if this is the case - then we should assume that token in question is located in previous child. + if (position < child.end && (nodeHasTokens(child) || child.kind === SyntaxKind.JsxText)) { + const start = child.getStart(sourceFile); + const lookInPreviousChild = + (start >= position) || // cursor in the leading trivia + (child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText + + if (lookInPreviousChild) { + // actual start of the node is past the position - previous token should be at the end of previous child + let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + return candidate && findRightmostToken(candidate) + } + else { + // candidate should be in this node + return find(child); } } } diff --git a/tests/baselines/reference/aliasAssignments.errors.txt b/tests/baselines/reference/aliasAssignments.errors.txt index 90a3672780f..fe13faba581 100644 --- a/tests/baselines/reference/aliasAssignments.errors.txt +++ b/tests/baselines/reference/aliasAssignments.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes ==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ==== - import moduleA = require("aliasAssignments_moduleA"); + import moduleA = require("./aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error ~ diff --git a/tests/baselines/reference/aliasAssignments.js b/tests/baselines/reference/aliasAssignments.js index a019d03f990..5283fe1bd99 100644 --- a/tests/baselines/reference/aliasAssignments.js +++ b/tests/baselines/reference/aliasAssignments.js @@ -6,7 +6,7 @@ export class someClass { } //// [aliasAssignments_1.ts] -import moduleA = require("aliasAssignments_moduleA"); +import moduleA = require("./aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error var y = 1; @@ -21,7 +21,7 @@ var someClass = (function () { })(); exports.someClass = someClass; //// [aliasAssignments_1.js] -var moduleA = require("aliasAssignments_moduleA"); +var moduleA = require("./aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error var y = 1; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 11e02297e47..bf7a7280f35 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsage1_moduleA.ts] -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsage1_main.ts] -import Backbone = require("aliasUsage1_backbone"); -import moduleA = require("aliasUsage1_moduleA"); +import Backbone = require("./aliasUsage1_backbone"); +import moduleA = require("./aliasUsage1_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -40,7 +40,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsage1_backbone"); +var Backbone = require("./aliasUsage1_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -50,7 +50,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsage1_main.js] -var moduleA = require("aliasUsage1_moduleA"); +var moduleA = require("./aliasUsage1_moduleA"); var C2 = (function () { function C2() { } diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols b/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols index 3524b1ce31e..62a2396e2b2 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsage1_main.ts === -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0)) -import moduleA = require("aliasUsage1_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50)) +import moduleA = require("./aliasUsage1_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34)) @@ -19,7 +19,7 @@ class C2 { x: IHasVisualizationModel; >x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) get A() { >A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) @@ -35,7 +35,7 @@ class C2 { x = moduleA; >x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10)) ->moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50)) +>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52)) } } === tests/cases/compiler/aliasUsage1_backbone.ts === @@ -47,11 +47,11 @@ export class Model { } === tests/cases/compiler/aliasUsage1_moduleA.ts === -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 50)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 52)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types index 092643002e4..ea6ab451b11 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsage1_main.ts === -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsage1_moduleA"); +import moduleA = require("./aliasUsage1_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -48,7 +48,7 @@ export class Model { } === tests/cases/compiler/aliasUsage1_moduleA.ts === -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index ba0c954a3c2..108407345b7 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInArray_moduleA.ts] -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInArray_main.ts] -import Backbone = require("aliasUsageInArray_backbone"); -import moduleA = require("aliasUsageInArray_moduleA"); +import Backbone = require("./aliasUsageInArray_backbone"); +import moduleA = require("./aliasUsageInArray_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInArray_backbone"); +var Backbone = require("./aliasUsageInArray_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -44,6 +44,6 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInArray_main.js] -var moduleA = require("aliasUsageInArray_moduleA"); +var moduleA = require("./aliasUsageInArray_moduleA"); var xs = [moduleA]; var xs2 = [moduleA]; diff --git a/tests/baselines/reference/aliasUsageInArray.symbols b/tests/baselines/reference/aliasUsageInArray.symbols index 7f1e31d2277..9bca1bc8864 100644 --- a/tests/baselines/reference/aliasUsageInArray.symbols +++ b/tests/baselines/reference/aliasUsageInArray.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInArray_main.ts === -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInArray_main.ts, 0, 0)) -import moduleA = require("aliasUsageInArray_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56)) +import moduleA = require("./aliasUsageInArray_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34)) @@ -17,13 +17,13 @@ interface IHasVisualizationModel { var xs: IHasVisualizationModel[] = [moduleA]; >xs : Symbol(xs, Decl(aliasUsageInArray_main.ts, 6, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58)) var xs2: typeof moduleA[] = [moduleA]; >xs2 : Symbol(xs2, Decl(aliasUsageInArray_main.ts, 7, 3)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58)) === tests/cases/compiler/aliasUsageInArray_backbone.ts === export class Model { @@ -34,11 +34,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInArray_moduleA.ts === -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 56)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 58)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInArray.types b/tests/baselines/reference/aliasUsageInArray.types index 488cc97d07f..218df8e10ed 100644 --- a/tests/baselines/reference/aliasUsageInArray.types +++ b/tests/baselines/reference/aliasUsageInArray.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInArray_main.ts === -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInArray_moduleA"); +import moduleA = require("./aliasUsageInArray_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -36,7 +36,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInArray_moduleA.ts === -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 702cbe4d53f..4229491c4c5 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInFunctionExpression_moduleA.ts] -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInFunctionExpression_main.ts] -import Backbone = require("aliasUsageInFunctionExpression_backbone"); -import moduleA = require("aliasUsageInFunctionExpression_moduleA"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); +import moduleA = require("./aliasUsageInFunctionExpression_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInFunctionExpression_backbone"); +var Backbone = require("./aliasUsageInFunctionExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -43,6 +43,6 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInFunctionExpression_main.js] -var moduleA = require("aliasUsageInFunctionExpression_moduleA"); +var moduleA = require("./aliasUsageInFunctionExpression_moduleA"); var f = function (x) { return x; }; f = function (x) { return moduleA; }; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.symbols b/tests/baselines/reference/aliasUsageInFunctionExpression.symbols index 2afb6be55c5..bd791d4d38f 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.symbols +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInFunctionExpression_main.ts === -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_main.ts, 0, 0)) -import moduleA = require("aliasUsageInFunctionExpression_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69)) +import moduleA = require("./aliasUsageInFunctionExpression_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 2, 34)) @@ -17,13 +17,13 @@ interface IHasVisualizationModel { var f = (x: IHasVisualizationModel) => x; >f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3)) >x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69)) >x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9)) f = (x) => moduleA; >f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3)) >x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 6, 5)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71)) === tests/cases/compiler/aliasUsageInFunctionExpression_backbone.ts === export class Model { @@ -34,11 +34,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts === -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 69)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 71)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.types b/tests/baselines/reference/aliasUsageInFunctionExpression.types index eec4341fd67..15716de5330 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.types +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInFunctionExpression_main.ts === -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInFunctionExpression_moduleA"); +import moduleA = require("./aliasUsageInFunctionExpression_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -37,7 +37,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts === -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 8706dd592eb..7091c6d27c6 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInGenericFunction_moduleA.ts] -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInGenericFunction_main.ts] -import Backbone = require("aliasUsageInGenericFunction_backbone"); -import moduleA = require("aliasUsageInGenericFunction_moduleA"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); +import moduleA = require("./aliasUsageInGenericFunction_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInGenericFunction_backbone"); +var Backbone = require("./aliasUsageInGenericFunction_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInGenericFunction_main.js] -var moduleA = require("aliasUsageInGenericFunction_moduleA"); +var moduleA = require("./aliasUsageInGenericFunction_moduleA"); function foo(x) { return x; } diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.symbols b/tests/baselines/reference/aliasUsageInGenericFunction.symbols index 3f001e8bd1a..fccf60c3514 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.symbols +++ b/tests/baselines/reference/aliasUsageInGenericFunction.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInGenericFunction_main.ts === -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_main.ts, 0, 0)) -import moduleA = require("aliasUsageInGenericFunction_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66)) +import moduleA = require("./aliasUsageInGenericFunction_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 2, 34)) @@ -18,7 +18,7 @@ function foo(x: T) { >foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1)) >T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13)) >a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 5, 24)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66)) >x : Symbol(x, Decl(aliasUsageInGenericFunction_main.ts, 5, 54)) >T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13)) @@ -29,13 +29,13 @@ var r = foo({ a: moduleA }); >r : Symbol(r, Decl(aliasUsageInGenericFunction_main.ts, 8, 3)) >foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1)) >a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 8, 13)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68)) var r2 = foo({ a: null }); >r2 : Symbol(r2, Decl(aliasUsageInGenericFunction_main.ts, 9, 3)) >foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1)) >a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 9, 14)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66)) === tests/cases/compiler/aliasUsageInGenericFunction_backbone.ts === export class Model { @@ -46,11 +46,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts === -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 66)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 68)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.types b/tests/baselines/reference/aliasUsageInGenericFunction.types index c21e691d773..5fe7a3e49ef 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.types +++ b/tests/baselines/reference/aliasUsageInGenericFunction.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInGenericFunction_main.ts === -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInGenericFunction_moduleA"); +import moduleA = require("./aliasUsageInGenericFunction_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -52,7 +52,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts === -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 78ddd2d4a94..82490739687 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInIndexerOfClass_moduleA.ts] -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInIndexerOfClass_main.ts] -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); -import moduleA = require("aliasUsageInIndexerOfClass_moduleA"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); +import moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -39,7 +39,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInIndexerOfClass_backbone"); +var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -49,7 +49,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInIndexerOfClass_main.js] -var moduleA = require("aliasUsageInIndexerOfClass_moduleA"); +var moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); var N = (function () { function N() { this.x = moduleA; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols b/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols index 900653c7fd1..37529d2ead2 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts === -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 0)) -import moduleA = require("aliasUsageInIndexerOfClass_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65)) +import moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 2, 34)) @@ -19,22 +19,22 @@ class N { [idx: string]: IHasVisualizationModel >idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 5)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) x = moduleA; >x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 41)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67)) } class N2 { >N2 : Symbol(N2, Decl(aliasUsageInIndexerOfClass_main.ts, 8, 1)) [idx: string]: typeof moduleA >idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 5)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67)) x: IHasVisualizationModel; >x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 33)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65)) } === tests/cases/compiler/aliasUsageInIndexerOfClass_backbone.ts === export class Model { @@ -45,11 +45,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts === -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 65)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 67)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.types b/tests/baselines/reference/aliasUsageInIndexerOfClass.types index b7e4873ba34..d6040a90410 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.types +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts === -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInIndexerOfClass_moduleA"); +import moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -45,7 +45,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts === -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index f38cdf2111c..f1bb99018df 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInObjectLiteral_moduleA.ts] -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInObjectLiteral_main.ts] -import Backbone = require("aliasUsageInObjectLiteral_backbone"); -import moduleA = require("aliasUsageInObjectLiteral_moduleA"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); +import moduleA = require("./aliasUsageInObjectLiteral_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInObjectLiteral_backbone"); +var Backbone = require("./aliasUsageInObjectLiteral_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -44,7 +44,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInObjectLiteral_main.js] -var moduleA = require("aliasUsageInObjectLiteral_moduleA"); +var moduleA = require("./aliasUsageInObjectLiteral_moduleA"); var a = { x: moduleA }; var b = { x: moduleA }; var c = { y: { z: moduleA } }; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.symbols b/tests/baselines/reference/aliasUsageInObjectLiteral.symbols index a508e9fafc1..ef94a9037ad 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.symbols +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInObjectLiteral_main.ts === -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_main.ts, 0, 0)) -import moduleA = require("aliasUsageInObjectLiteral_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64)) +import moduleA = require("./aliasUsageInObjectLiteral_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 2, 34)) @@ -17,25 +17,25 @@ interface IHasVisualizationModel { var a: { x: typeof moduleA } = { x: moduleA }; >a : Symbol(a, Decl(aliasUsageInObjectLiteral_main.ts, 5, 3)) >x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 8)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66)) >x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 32)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66)) var b: { x: IHasVisualizationModel } = { x: moduleA }; >b : Symbol(b, Decl(aliasUsageInObjectLiteral_main.ts, 6, 3)) >x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 8)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64)) >x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 40)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66)) var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } }; >c : Symbol(c, Decl(aliasUsageInObjectLiteral_main.ts, 7, 3)) >y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 8)) >z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 13)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64)) >y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 47)) >z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 52)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66)) === tests/cases/compiler/aliasUsageInObjectLiteral_backbone.ts === export class Model { @@ -46,11 +46,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts === -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 64)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 66)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.types b/tests/baselines/reference/aliasUsageInObjectLiteral.types index 5ab294b7350..5c8f08a6af2 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.types +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInObjectLiteral_main.ts === -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInObjectLiteral_moduleA"); +import moduleA = require("./aliasUsageInObjectLiteral_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -50,7 +50,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts === -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 906a2c019d7..817ad95aaea 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInOrExpression_moduleA.ts] -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInOrExpression_main.ts] -import Backbone = require("aliasUsageInOrExpression_backbone"); -import moduleA = require("aliasUsageInOrExpression_moduleA"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); +import moduleA = require("./aliasUsageInOrExpression_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInOrExpression_backbone"); +var Backbone = require("./aliasUsageInOrExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInOrExpression_main.js] -var moduleA = require("aliasUsageInOrExpression_moduleA"); +var moduleA = require("./aliasUsageInOrExpression_moduleA"); var i; var d1 = i || moduleA; var d2 = i || moduleA; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.symbols b/tests/baselines/reference/aliasUsageInOrExpression.symbols index adfba01a119..3d9331b1fa9 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.symbols +++ b/tests/baselines/reference/aliasUsageInOrExpression.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInOrExpression_main.ts === -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_main.ts, 0, 0)) -import moduleA = require("aliasUsageInOrExpression_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +import moduleA = require("./aliasUsageInOrExpression_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 2, 34)) @@ -16,42 +16,42 @@ interface IHasVisualizationModel { } var i: IHasVisualizationModel; >i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) var d1 = i || moduleA; >d1 : Symbol(d1, Decl(aliasUsageInOrExpression_main.ts, 6, 3)) >i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) var d2: IHasVisualizationModel = i || moduleA; >d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) >i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) var d2: IHasVisualizationModel = moduleA || i; >d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) >i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3)) var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { x: moduleA }; >e : Symbol(e, Decl(aliasUsageInOrExpression_main.ts, 9, 3)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 8)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 41)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 79)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null; >f : Symbol(f, Decl(aliasUsageInOrExpression_main.ts, 10, 3)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 8)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 41)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63)) >x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 78)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65)) === tests/cases/compiler/aliasUsageInOrExpression_backbone.ts === export class Model { @@ -62,11 +62,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts === -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 63)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 65)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index f009e7084eb..c43b7889cc5 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInOrExpression_main.ts === -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInOrExpression_moduleA"); +import moduleA = require("./aliasUsageInOrExpression_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -74,7 +74,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts === -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 27f85bb5fcd..270a2807319 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts] -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInTypeArgumentOfExtendsClause_main.ts] -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); -import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -52,7 +52,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); var C = (function () { function C() { } diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols index f3ca1f7ec37..6fc639da2c1 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts === -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 0)) -import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78)) +import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 2, 34)) @@ -17,7 +17,7 @@ interface IHasVisualizationModel { class C { >C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1)) >T : Symbol(T, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 8)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) x: T; >x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 43)) @@ -26,11 +26,11 @@ class C { class D extends C { >D : Symbol(D, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 7, 1)) >C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78)) x = moduleA; >x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 8, 43)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80)) } === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone.ts === export class Model { @@ -41,11 +41,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts === -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 78)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 80)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types index ae20caa9c37..3d3d3b6d3f5 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts === -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -41,7 +41,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts === -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index bfc63868ff4..f7949348cdd 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -6,14 +6,14 @@ export class Model { } //// [aliasUsageInVarAssignment_moduleA.ts] -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [aliasUsageInVarAssignment_main.ts] -import Backbone = require("aliasUsageInVarAssignment_backbone"); -import moduleA = require("aliasUsageInVarAssignment_moduleA"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); +import moduleA = require("./aliasUsageInVarAssignment_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("aliasUsageInVarAssignment_backbone"); +var Backbone = require("./aliasUsageInVarAssignment_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.symbols b/tests/baselines/reference/aliasUsageInVarAssignment.symbols index d1996fe8ecb..d0e7f6b7d05 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.symbols +++ b/tests/baselines/reference/aliasUsageInVarAssignment.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/aliasUsageInVarAssignment_main.ts === -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_main.ts, 0, 0)) -import moduleA = require("aliasUsageInVarAssignment_moduleA"); ->moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64)) +import moduleA = require("./aliasUsageInVarAssignment_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 2, 34)) @@ -16,11 +16,11 @@ interface IHasVisualizationModel { } var i: IHasVisualizationModel; >i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64)) var m: typeof moduleA = i; >m : Symbol(m, Decl(aliasUsageInVarAssignment_main.ts, 6, 3)) ->moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64)) +>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66)) >i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3)) === tests/cases/compiler/aliasUsageInVarAssignment_backbone.ts === @@ -32,11 +32,11 @@ export class Model { } === tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts === -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); >Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 64)) +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 66)) >Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.types b/tests/baselines/reference/aliasUsageInVarAssignment.types index 6a23293ea7c..cf636a15240 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.types +++ b/tests/baselines/reference/aliasUsageInVarAssignment.types @@ -1,8 +1,8 @@ === tests/cases/compiler/aliasUsageInVarAssignment_main.ts === -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); >Backbone : typeof Backbone -import moduleA = require("aliasUsageInVarAssignment_moduleA"); +import moduleA = require("./aliasUsageInVarAssignment_moduleA"); >moduleA : typeof moduleA interface IHasVisualizationModel { @@ -32,7 +32,7 @@ export class Model { } === tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts === -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index c93acb43fa6..9893eae6e1c 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -9,8 +9,8 @@ export function b(a: any): any { return null; } //// [aliasUsedAsNameValue_2.ts] /// /// -import mod = require("aliasUsedAsNameValue_0"); -import b = require("aliasUsedAsNameValue_1"); +import mod = require("./aliasUsedAsNameValue_0"); +import b = require("./aliasUsedAsNameValue_1"); export var a = function () { //var x = mod.id; // TODO needed hack that mod is loaded @@ -25,8 +25,8 @@ exports.b = b; //// [aliasUsedAsNameValue_2.js] /// /// -var mod = require("aliasUsedAsNameValue_0"); -var b = require("aliasUsedAsNameValue_1"); +var mod = require("./aliasUsedAsNameValue_0"); +var b = require("./aliasUsedAsNameValue_1"); exports.a = function () { //var x = mod.id; // TODO needed hack that mod is loaded b.b(mod); diff --git a/tests/baselines/reference/aliasUsedAsNameValue.symbols b/tests/baselines/reference/aliasUsedAsNameValue.symbols index a816e2b2c63..314780eba7c 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.symbols +++ b/tests/baselines/reference/aliasUsedAsNameValue.symbols @@ -1,11 +1,11 @@ === tests/cases/compiler/aliasUsedAsNameValue_2.ts === /// /// -import mod = require("aliasUsedAsNameValue_0"); +import mod = require("./aliasUsedAsNameValue_0"); >mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0)) -import b = require("aliasUsedAsNameValue_1"); ->b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47)) +import b = require("./aliasUsedAsNameValue_1"); +>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49)) export var a = function () { >a : Symbol(a, Decl(aliasUsedAsNameValue_2.ts, 5, 10)) @@ -13,7 +13,7 @@ export var a = function () { //var x = mod.id; // TODO needed hack that mod is loaded b.b(mod); >b.b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0)) ->b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47)) +>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49)) >b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0)) >mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0)) } diff --git a/tests/baselines/reference/aliasUsedAsNameValue.types b/tests/baselines/reference/aliasUsedAsNameValue.types index 9c519786c76..86e1eeee9f5 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.types +++ b/tests/baselines/reference/aliasUsedAsNameValue.types @@ -1,10 +1,10 @@ === tests/cases/compiler/aliasUsedAsNameValue_2.ts === /// /// -import mod = require("aliasUsedAsNameValue_0"); +import mod = require("./aliasUsedAsNameValue_0"); >mod : typeof mod -import b = require("aliasUsedAsNameValue_1"); +import b = require("./aliasUsedAsNameValue_1"); >b : typeof b export var a = function () { diff --git a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt index a2532be9344..1a9d7d26168 100644 --- a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt +++ b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts ==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts (1 errors) ==== - import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); + import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); var d = b.q3; ~ !!! error TS2304: Cannot find name 'b'. diff --git a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.js b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.js index bd76945438f..19534b279c0 100644 --- a/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.js +++ b/tests/baselines/reference/aliasWithInterfaceExportAssignmentUsedInVarInitializer.js @@ -7,7 +7,7 @@ interface c { export = c; //// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts] -import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); +import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); var d = b.q3; //// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.js] diff --git a/tests/baselines/reference/arrayOfExportedClass.js b/tests/baselines/reference/arrayOfExportedClass.js index 7fde4aa6775..c3f81aca7b0 100644 --- a/tests/baselines/reference/arrayOfExportedClass.js +++ b/tests/baselines/reference/arrayOfExportedClass.js @@ -9,7 +9,7 @@ export = Car; //// [arrayOfExportedClass_1.ts] /// -import Car = require('arrayOfExportedClass_0'); +import Car = require('./arrayOfExportedClass_0'); class Road { diff --git a/tests/baselines/reference/arrayOfExportedClass.symbols b/tests/baselines/reference/arrayOfExportedClass.symbols index 3d0905a1e2d..bdcaf98eb0d 100644 --- a/tests/baselines/reference/arrayOfExportedClass.symbols +++ b/tests/baselines/reference/arrayOfExportedClass.symbols @@ -1,10 +1,10 @@ === tests/cases/compiler/arrayOfExportedClass_1.ts === /// -import Car = require('arrayOfExportedClass_0'); +import Car = require('./arrayOfExportedClass_0'); >Car : Symbol(Car, Decl(arrayOfExportedClass_1.ts, 0, 0)) class Road { ->Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47)) +>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49)) public cars: Car[]; >cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) @@ -17,14 +17,14 @@ class Road { this.cars = cars; >this.cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) ->this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47)) +>this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49)) >cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12)) >cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 7, 19)) } } export = Road; ->Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47)) +>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49)) === tests/cases/compiler/arrayOfExportedClass_0.ts === class Car { diff --git a/tests/baselines/reference/arrayOfExportedClass.types b/tests/baselines/reference/arrayOfExportedClass.types index 3d542b88d80..1e41e82e448 100644 --- a/tests/baselines/reference/arrayOfExportedClass.types +++ b/tests/baselines/reference/arrayOfExportedClass.types @@ -1,6 +1,6 @@ === tests/cases/compiler/arrayOfExportedClass_1.ts === /// -import Car = require('arrayOfExportedClass_0'); +import Car = require('./arrayOfExportedClass_0'); >Car : typeof Car class Road { diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types index fc9fdb8a3bd..6ac405e6d7e 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.types +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -100,12 +100,12 @@ var p8 = ({ a = 1 }) => { }; >1 : number var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; ->p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void ->({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void +>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void +>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void >a : any >b : number >1 : number ->{ b: 1 } : { b: number; } +>{ b: 1 } : { b?: number; } >b : number >1 : number diff --git a/tests/baselines/reference/castExpressionParentheses.js b/tests/baselines/reference/castExpressionParentheses.js index ec18d6e373e..b4754d0ad41 100644 --- a/tests/baselines/reference/castExpressionParentheses.js +++ b/tests/baselines/reference/castExpressionParentheses.js @@ -7,6 +7,11 @@ declare var a; ([1,3,]); ("string"); (23.0); +(1); +(1.); +(1.0); +(12e+34); +(0xff); (/regexp/g); (false); (true); @@ -23,6 +28,12 @@ declare var a; declare var A; // should keep the parentheses in emit +(1).foo; +(1.).foo; +(1.0).foo; +(12e+34).foo; +(0xff).foo; +((1.0)); (new A).foo; (typeof A).x; (-A).x; @@ -46,6 +57,11 @@ new (A()); [1, 3,]; "string"; 23.0; +1; +1.; +1.0; +12e+34; +0xff; /regexp/g; false; true; @@ -59,6 +75,12 @@ a[0]; a.b["0"]; a().x; // should keep the parentheses in emit +(1).foo; +(1.).foo; +(1.0).foo; +(12e+34).foo; +(0xff).foo; +(1.0); (new A).foo; (typeof A).x; (-A).x; diff --git a/tests/baselines/reference/castExpressionParentheses.symbols b/tests/baselines/reference/castExpressionParentheses.symbols index 7bc8169e40f..ef31ee0f226 100644 --- a/tests/baselines/reference/castExpressionParentheses.symbols +++ b/tests/baselines/reference/castExpressionParentheses.symbols @@ -10,6 +10,11 @@ declare var a; ([1,3,]); ("string"); (23.0); +(1); +(1.); +(1.0); +(12e+34); +(0xff); (/regexp/g); (false); (true); @@ -33,36 +38,42 @@ declare var a; >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) declare var A; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) // should keep the parentheses in emit +(1).foo; +(1.).foo; +(1.0).foo; +(12e+34).foo; +(0xff).foo; +((1.0)); (new A).foo; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) (typeof A).x; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) (-A).x; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) new (A()); ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) (()=> {})(); ->Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 28, 2)) +>Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 39, 2)) (function foo() { })(); ->foo : Symbol(foo, Decl(castExpressionParentheses.ts, 29, 6)) +>foo : Symbol(foo, Decl(castExpressionParentheses.ts, 40, 6)) (-A).x; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) // nested cast, should keep one pair of parenthese ((-A)).x; ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) // nested parenthesized expression, should keep one pair of parenthese ((A)) ->A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) +>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11)) diff --git a/tests/baselines/reference/castExpressionParentheses.types b/tests/baselines/reference/castExpressionParentheses.types index ab563a4e8b7..cdfbf4f7db2 100644 --- a/tests/baselines/reference/castExpressionParentheses.types +++ b/tests/baselines/reference/castExpressionParentheses.types @@ -28,6 +28,31 @@ declare var a; >23.0 : any >23.0 : number +(1); +>(1) : any +>1 : any +>1 : number + +(1.); +>(1.) : any +>1. : any +>1. : number + +(1.0); +>(1.0) : any +>1.0 : any +>1.0 : number + +(12e+34); +>(12e+34) : any +>12e+34 : any +>12e+34 : number + +(0xff); +>(0xff) : any +>0xff : any +>0xff : number + (/regexp/g); >(/regexp/g) : any >/regexp/g : any @@ -104,6 +129,47 @@ declare var A; >A : any // should keep the parentheses in emit +(1).foo; +>(1).foo : any +>(1) : any +>1 : any +>1 : number +>foo : any + +(1.).foo; +>(1.).foo : any +>(1.) : any +>1. : any +>1. : number +>foo : any + +(1.0).foo; +>(1.0).foo : any +>(1.0) : any +>1.0 : any +>1.0 : number +>foo : any + +(12e+34).foo; +>(12e+34).foo : any +>(12e+34) : any +>12e+34 : any +>12e+34 : number +>foo : any + +(0xff).foo; +>(0xff).foo : any +>(0xff) : any +>0xff : any +>0xff : number +>foo : any + +((1.0)); +>((1.0)) : any +>(1.0) : any +>(1.0) : number +>1.0 : number + (new A).foo; >(new A).foo : any >(new A) : any diff --git a/tests/baselines/reference/chainedImportAlias.js b/tests/baselines/reference/chainedImportAlias.js index 077a92d7450..ec751b0329a 100644 --- a/tests/baselines/reference/chainedImportAlias.js +++ b/tests/baselines/reference/chainedImportAlias.js @@ -6,7 +6,7 @@ export module m { } //// [chainedImportAlias_file1.ts] -import x = require('chainedImportAlias_file0'); +import x = require('./chainedImportAlias_file0'); import y = x; y.m.foo(); @@ -18,6 +18,6 @@ var m; m.foo = foo; })(m = exports.m || (exports.m = {})); //// [chainedImportAlias_file1.js] -var x = require('chainedImportAlias_file0'); +var x = require('./chainedImportAlias_file0'); var y = x; y.m.foo(); diff --git a/tests/baselines/reference/chainedImportAlias.symbols b/tests/baselines/reference/chainedImportAlias.symbols index 3aebb4502f8..0f374305aeb 100644 --- a/tests/baselines/reference/chainedImportAlias.symbols +++ b/tests/baselines/reference/chainedImportAlias.symbols @@ -1,15 +1,15 @@ === tests/cases/compiler/chainedImportAlias_file1.ts === -import x = require('chainedImportAlias_file0'); +import x = require('./chainedImportAlias_file0'); >x : Symbol(x, Decl(chainedImportAlias_file1.ts, 0, 0)) import y = x; ->y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47)) +>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49)) >x : Symbol(x, Decl(chainedImportAlias_file0.ts, 0, 0)) y.m.foo(); >y.m.foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17)) >y.m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0)) ->y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47)) +>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49)) >m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0)) >foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17)) diff --git a/tests/baselines/reference/chainedImportAlias.types b/tests/baselines/reference/chainedImportAlias.types index 1435776fff2..db06c833d0b 100644 --- a/tests/baselines/reference/chainedImportAlias.types +++ b/tests/baselines/reference/chainedImportAlias.types @@ -1,5 +1,5 @@ === tests/cases/compiler/chainedImportAlias_file1.ts === -import x = require('chainedImportAlias_file0'); +import x = require('./chainedImportAlias_file0'); >x : typeof x import y = x; diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.errors.txt b/tests/baselines/reference/classExpressionExtendingAbstractClass.errors.txt new file mode 100644 index 00000000000..b5d709fbf60 --- /dev/null +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/classExpressionExtendingAbstractClass.ts(5,9): error TS2653: Non-abstract class expression does not implement inherited abstract member 'foo' from class 'A'. + + +==== tests/cases/compiler/classExpressionExtendingAbstractClass.ts (1 errors) ==== + abstract class A { + abstract foo(): void; + } + + var C = class extends A { // no error reported! + ~~~~~ +!!! error TS2653: Non-abstract class expression does not implement inherited abstract member 'foo' from class 'A'. + }; + + \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js new file mode 100644 index 00000000000..a5149538da2 --- /dev/null +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -0,0 +1,28 @@ +//// [classExpressionExtendingAbstractClass.ts] +abstract class A { + abstract foo(): void; +} + +var C = class extends A { // no error reported! +}; + + + +//// [classExpressionExtendingAbstractClass.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + } + return A; +})(); +var C = (function (_super) { + __extends(class_1, _super); + function class_1() { + _super.apply(this, arguments); + } + return class_1; +})(A); diff --git a/tests/baselines/reference/commentOnAmbientClass1.js b/tests/baselines/reference/commentOnAmbientClass1.js index beacc71335c..9837da4c371 100644 --- a/tests/baselines/reference/commentOnAmbientClass1.js +++ b/tests/baselines/reference/commentOnAmbientClass1.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnAmbientClass1.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare class C { } @@ -15,6 +20,9 @@ declare class E extends C { } //// [a.js] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnAmbientClass1.symbols b/tests/baselines/reference/commentOnAmbientClass1.symbols index 899c5f19a24..a08bb744df4 100644 --- a/tests/baselines/reference/commentOnAmbientClass1.symbols +++ b/tests/baselines/reference/commentOnAmbientClass1.symbols @@ -5,13 +5,18 @@ declare class E extends C { >C : Symbol(C, Decl(a.ts, 0, 0)) } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare class C { >C : Symbol(C, Decl(a.ts, 0, 0)) } // Don't keep this comment. declare class D { ->D : Symbol(D, Decl(a.ts, 2, 1)) +>D : Symbol(D, Decl(a.ts, 7, 1)) } diff --git a/tests/baselines/reference/commentOnAmbientClass1.types b/tests/baselines/reference/commentOnAmbientClass1.types index 44c0334ef6c..b0212056505 100644 --- a/tests/baselines/reference/commentOnAmbientClass1.types +++ b/tests/baselines/reference/commentOnAmbientClass1.types @@ -5,7 +5,12 @@ declare class E extends C { >C : C } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare class C { >C : C } diff --git a/tests/baselines/reference/commentOnAmbientEnum.js b/tests/baselines/reference/commentOnAmbientEnum.js index d602c68a0e5..f6c9d92ebff 100644 --- a/tests/baselines/reference/commentOnAmbientEnum.js +++ b/tests/baselines/reference/commentOnAmbientEnum.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnAmbientEnum.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare enum C { a, b, @@ -18,6 +23,9 @@ declare enum E { } //// [a.js] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnAmbientEnum.symbols b/tests/baselines/reference/commentOnAmbientEnum.symbols index d86d490113d..3a6e8089d4b 100644 --- a/tests/baselines/reference/commentOnAmbientEnum.symbols +++ b/tests/baselines/reference/commentOnAmbientEnum.symbols @@ -4,22 +4,27 @@ declare enum E { >E : Symbol(E, Decl(b.ts, 0, 0)) } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare enum C { >C : Symbol(C, Decl(a.ts, 0, 0)) a, ->a : Symbol(C.a, Decl(a.ts, 1, 16)) +>a : Symbol(C.a, Decl(a.ts, 6, 16)) b, ->b : Symbol(C.b, Decl(a.ts, 2, 6)) +>b : Symbol(C.b, Decl(a.ts, 7, 6)) c ->c : Symbol(C.c, Decl(a.ts, 3, 6)) +>c : Symbol(C.c, Decl(a.ts, 8, 6)) } // Don't keep this comment. declare enum D { ->D : Symbol(D, Decl(a.ts, 5, 1)) +>D : Symbol(D, Decl(a.ts, 10, 1)) } diff --git a/tests/baselines/reference/commentOnAmbientEnum.types b/tests/baselines/reference/commentOnAmbientEnum.types index 4a0193b7937..95f3d61b75f 100644 --- a/tests/baselines/reference/commentOnAmbientEnum.types +++ b/tests/baselines/reference/commentOnAmbientEnum.types @@ -4,7 +4,12 @@ declare enum E { >E : E } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare enum C { >C : C diff --git a/tests/baselines/reference/commentOnAmbientModule.js b/tests/baselines/reference/commentOnAmbientModule.js index d5a536302b5..2d43b502f29 100644 --- a/tests/baselines/reference/commentOnAmbientModule.js +++ b/tests/baselines/reference/commentOnAmbientModule.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnAmbientModule.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare module C { function foo(); } @@ -20,6 +25,9 @@ declare module E { } //// [a.js] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnAmbientModule.symbols b/tests/baselines/reference/commentOnAmbientModule.symbols index c1412c17880..e7525e6306f 100644 --- a/tests/baselines/reference/commentOnAmbientModule.symbols +++ b/tests/baselines/reference/commentOnAmbientModule.symbols @@ -5,28 +5,33 @@ declare module E { class foobar extends D.bar { >foobar : Symbol(foobar, Decl(b.ts, 1, 18)) ->D.bar : Symbol(D.bar, Decl(a.ts, 6, 18)) ->D : Symbol(D, Decl(a.ts, 3, 1)) ->bar : Symbol(D.bar, Decl(a.ts, 6, 18)) +>D.bar : Symbol(D.bar, Decl(a.ts, 11, 18)) +>D : Symbol(D, Decl(a.ts, 8, 1)) +>bar : Symbol(D.bar, Decl(a.ts, 11, 18)) foo(); >foo : Symbol(foo, Decl(b.ts, 2, 32)) } } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare module C { >C : Symbol(C, Decl(a.ts, 0, 0)) function foo(); ->foo : Symbol(foo, Decl(a.ts, 1, 18)) +>foo : Symbol(foo, Decl(a.ts, 6, 18)) } // Don't keep this comment. declare module D { ->D : Symbol(D, Decl(a.ts, 3, 1)) +>D : Symbol(D, Decl(a.ts, 8, 1)) class bar { } ->bar : Symbol(bar, Decl(a.ts, 6, 18)) +>bar : Symbol(bar, Decl(a.ts, 11, 18)) } diff --git a/tests/baselines/reference/commentOnAmbientModule.types b/tests/baselines/reference/commentOnAmbientModule.types index 629395a4e80..f54d248b461 100644 --- a/tests/baselines/reference/commentOnAmbientModule.types +++ b/tests/baselines/reference/commentOnAmbientModule.types @@ -14,7 +14,12 @@ declare module E { } } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare module C { >C : typeof C diff --git a/tests/baselines/reference/commentOnAmbientVariable1.js b/tests/baselines/reference/commentOnAmbientVariable1.js index b76fd3345b5..79c5dc85f23 100644 --- a/tests/baselines/reference/commentOnAmbientVariable1.js +++ b/tests/baselines/reference/commentOnAmbientVariable1.js @@ -1,9 +1,17 @@ //// [commentOnAmbientVariable1.ts] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare var v: number; // Don't keep this comment. declare var y: number; //// [commentOnAmbientVariable1.js] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ diff --git a/tests/baselines/reference/commentOnAmbientVariable1.symbols b/tests/baselines/reference/commentOnAmbientVariable1.symbols index 153653e7827..7847b4b85ad 100644 --- a/tests/baselines/reference/commentOnAmbientVariable1.symbols +++ b/tests/baselines/reference/commentOnAmbientVariable1.symbols @@ -1,9 +1,14 @@ === tests/cases/compiler/commentOnAmbientVariable1.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare var v: number; ->v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 1, 11)) +>v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 6, 11)) // Don't keep this comment. declare var y: number; ->y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 4, 11)) +>y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 9, 11)) diff --git a/tests/baselines/reference/commentOnAmbientVariable1.types b/tests/baselines/reference/commentOnAmbientVariable1.types index feff50f4293..645e1f099d4 100644 --- a/tests/baselines/reference/commentOnAmbientVariable1.types +++ b/tests/baselines/reference/commentOnAmbientVariable1.types @@ -1,5 +1,10 @@ === tests/cases/compiler/commentOnAmbientVariable1.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare var v: number; >v : number diff --git a/tests/baselines/reference/commentOnAmbientfunction.js b/tests/baselines/reference/commentOnAmbientfunction.js index 6290d407727..22613236941 100644 --- a/tests/baselines/reference/commentOnAmbientfunction.js +++ b/tests/baselines/reference/commentOnAmbientfunction.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnAmbientfunction.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare function foo(); // Don't keep this comment. @@ -12,6 +17,9 @@ declare function bar(); declare function foobar(a: typeof foo): typeof bar; //// [a.js] -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnAmbientfunction.symbols b/tests/baselines/reference/commentOnAmbientfunction.symbols index c6afb72eb9c..4d83d2794a0 100644 --- a/tests/baselines/reference/commentOnAmbientfunction.symbols +++ b/tests/baselines/reference/commentOnAmbientfunction.symbols @@ -4,14 +4,19 @@ declare function foobar(a: typeof foo): typeof bar; >foobar : Symbol(foobar, Decl(b.ts, 0, 0)) >a : Symbol(a, Decl(b.ts, 1, 24)) >foo : Symbol(foo, Decl(a.ts, 0, 0)) ->bar : Symbol(bar, Decl(a.ts, 1, 23)) +>bar : Symbol(bar, Decl(a.ts, 6, 23)) === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare function foo(); >foo : Symbol(foo, Decl(a.ts, 0, 0)) // Don't keep this comment. declare function bar(); ->bar : Symbol(bar, Decl(a.ts, 1, 23)) +>bar : Symbol(bar, Decl(a.ts, 6, 23)) diff --git a/tests/baselines/reference/commentOnAmbientfunction.types b/tests/baselines/reference/commentOnAmbientfunction.types index f75f7b377fb..3347a55bf68 100644 --- a/tests/baselines/reference/commentOnAmbientfunction.types +++ b/tests/baselines/reference/commentOnAmbientfunction.types @@ -7,7 +7,12 @@ declare function foobar(a: typeof foo): typeof bar; >bar : () => any === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare function foo(); >foo : () => any diff --git a/tests/baselines/reference/commentOnElidedModule1.js b/tests/baselines/reference/commentOnElidedModule1.js index 8a7b8d91b4c..72585e6a9e8 100644 --- a/tests/baselines/reference/commentOnElidedModule1.js +++ b/tests/baselines/reference/commentOnElidedModule1.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnElidedModule1.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ module ElidedModule { } @@ -15,6 +20,9 @@ module ElidedModule3 { } //// [a.js] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnElidedModule1.symbols b/tests/baselines/reference/commentOnElidedModule1.symbols index 63ce4dadf97..57b55adeee4 100644 --- a/tests/baselines/reference/commentOnElidedModule1.symbols +++ b/tests/baselines/reference/commentOnElidedModule1.symbols @@ -4,13 +4,18 @@ module ElidedModule3 { >ElidedModule3 : Symbol(ElidedModule3, Decl(b.ts, 0, 0)) } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ module ElidedModule { >ElidedModule : Symbol(ElidedModule, Decl(a.ts, 0, 0)) } // Don't keep this comment. module ElidedModule2 { ->ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 2, 1)) +>ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 7, 1)) } diff --git a/tests/baselines/reference/commentOnElidedModule1.types b/tests/baselines/reference/commentOnElidedModule1.types index 8e095b8102f..d028b62519a 100644 --- a/tests/baselines/reference/commentOnElidedModule1.types +++ b/tests/baselines/reference/commentOnElidedModule1.types @@ -4,7 +4,12 @@ module ElidedModule3 { >ElidedModule3 : any } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ module ElidedModule { >ElidedModule : any } diff --git a/tests/baselines/reference/commentOnInterface1.js b/tests/baselines/reference/commentOnInterface1.js index bde6202f03f..c51658e2dfa 100644 --- a/tests/baselines/reference/commentOnInterface1.js +++ b/tests/baselines/reference/commentOnInterface1.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnInterface1.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ interface I { } @@ -15,6 +20,9 @@ interface I3 { } //// [a.js] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ //// [b.js] /// diff --git a/tests/baselines/reference/commentOnInterface1.symbols b/tests/baselines/reference/commentOnInterface1.symbols index 9564d9b4cfa..8ed7e020712 100644 --- a/tests/baselines/reference/commentOnInterface1.symbols +++ b/tests/baselines/reference/commentOnInterface1.symbols @@ -4,13 +4,18 @@ interface I3 { >I3 : Symbol(I3, Decl(b.ts, 0, 0)) } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ interface I { >I : Symbol(I, Decl(a.ts, 0, 0)) } // Don't keep this comment. interface I2 { ->I2 : Symbol(I2, Decl(a.ts, 2, 1)) +>I2 : Symbol(I2, Decl(a.ts, 7, 1)) } diff --git a/tests/baselines/reference/commentOnInterface1.types b/tests/baselines/reference/commentOnInterface1.types index d03b1939026..34b0e0ce14f 100644 --- a/tests/baselines/reference/commentOnInterface1.types +++ b/tests/baselines/reference/commentOnInterface1.types @@ -4,7 +4,12 @@ interface I3 { >I3 : I3 } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ interface I { >I : I } diff --git a/tests/baselines/reference/commentOnSignature1.js b/tests/baselines/reference/commentOnSignature1.js index 1b2327f9861..d29710c631c 100644 --- a/tests/baselines/reference/commentOnSignature1.js +++ b/tests/baselines/reference/commentOnSignature1.js @@ -1,7 +1,12 @@ //// [tests/cases/compiler/commentOnSignature1.ts] //// //// [a.ts] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ function foo(n: number): void; // Don't keep this comment. function foo(s: string): void; @@ -33,14 +38,15 @@ function foo2(a: any): void { } //// [a.js] -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ function foo(a) { } var c = (function () { - /*! keep this pinned comment */ function c(a) { } - /*! keep this pinned comment */ c.prototype.foo = function (a) { }; return c; diff --git a/tests/baselines/reference/commentOnSignature1.symbols b/tests/baselines/reference/commentOnSignature1.symbols index 0d39565fb61..7f0d48401cd 100644 --- a/tests/baselines/reference/commentOnSignature1.symbols +++ b/tests/baselines/reference/commentOnSignature1.symbols @@ -14,49 +14,54 @@ function foo2(a: any): void { >a : Symbol(a, Decl(b.ts, 4, 14)) } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ function foo(n: number): void; ->foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30)) ->n : Symbol(n, Decl(a.ts, 1, 13)) +>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30)) +>n : Symbol(n, Decl(a.ts, 6, 13)) // Don't keep this comment. function foo(s: string): void; ->foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30)) ->s : Symbol(s, Decl(a.ts, 3, 13)) +>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30)) +>s : Symbol(s, Decl(a.ts, 8, 13)) function foo(a: any): void { ->foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30)) ->a : Symbol(a, Decl(a.ts, 4, 13)) +>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30)) +>a : Symbol(a, Decl(a.ts, 9, 13)) } class c { ->c : Symbol(c, Decl(a.ts, 5, 1)) +>c : Symbol(c, Decl(a.ts, 10, 1)) // dont keep this comment constructor(a: string); ->a : Symbol(a, Decl(a.ts, 9, 16)) +>a : Symbol(a, Decl(a.ts, 14, 16)) /*! keep this pinned comment */ constructor(a: number); ->a : Symbol(a, Decl(a.ts, 11, 16)) +>a : Symbol(a, Decl(a.ts, 16, 16)) constructor(a: any) { ->a : Symbol(a, Decl(a.ts, 12, 16)) +>a : Symbol(a, Decl(a.ts, 17, 16)) } // dont keep this comment foo(a: string); ->foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19)) ->a : Symbol(a, Decl(a.ts, 16, 8)) +>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>a : Symbol(a, Decl(a.ts, 21, 8)) /*! keep this pinned comment */ foo(a: number); ->foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19)) ->a : Symbol(a, Decl(a.ts, 18, 8)) +>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>a : Symbol(a, Decl(a.ts, 23, 8)) foo(a: any) { ->foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19)) ->a : Symbol(a, Decl(a.ts, 19, 8)) +>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19)) +>a : Symbol(a, Decl(a.ts, 24, 8)) } } diff --git a/tests/baselines/reference/commentOnSignature1.types b/tests/baselines/reference/commentOnSignature1.types index 790aaaf7523..30898e22851 100644 --- a/tests/baselines/reference/commentOnSignature1.types +++ b/tests/baselines/reference/commentOnSignature1.types @@ -14,7 +14,12 @@ function foo2(a: any): void { >a : any } === tests/cases/compiler/a.ts === -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ function foo(n: number): void; >foo : { (n: number): void; (s: string): void; } >n : number diff --git a/tests/baselines/reference/commentsExternalModules3.js b/tests/baselines/reference/commentsExternalModules3.js index 283e07ebc7f..2acf93296de 100644 --- a/tests/baselines/reference/commentsExternalModules3.js +++ b/tests/baselines/reference/commentsExternalModules3.js @@ -54,7 +54,7 @@ var myvar2 = new m4.m2.c(); //// [commentsExternalModules_1.ts] /**This is on import declaration*/ -import extMod = require("commentsExternalModules2_0"); // trailing comment 1 +import extMod = require("./commentsExternalModules2_0"); // trailing comment 1 extMod.m1.fooExport(); export var newVar = new extMod.m1.m2.c(); extMod.m4.fooExport(); @@ -124,7 +124,7 @@ m4.fooExport(); var myvar2 = new m4.m2.c(); //// [commentsExternalModules_1.js] /**This is on import declaration*/ -var extMod = require("commentsExternalModules2_0"); // trailing comment 1 +var extMod = require("./commentsExternalModules2_0"); // trailing comment 1 extMod.m1.fooExport(); exports.newVar = new extMod.m1.m2.c(); extMod.m4.fooExport(); @@ -165,6 +165,6 @@ export declare module m4 { } //// [commentsExternalModules_1.d.ts] /**This is on import declaration*/ -import extMod = require("commentsExternalModules2_0"); +import extMod = require("./commentsExternalModules2_0"); export declare var newVar: extMod.m1.m2.c; export declare var newVar2: extMod.m4.m2.c; diff --git a/tests/baselines/reference/commentsExternalModules3.symbols b/tests/baselines/reference/commentsExternalModules3.symbols index cfd01db377d..4cab3b0d28a 100644 --- a/tests/baselines/reference/commentsExternalModules3.symbols +++ b/tests/baselines/reference/commentsExternalModules3.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/commentsExternalModules_1.ts === /**This is on import declaration*/ -import extMod = require("commentsExternalModules2_0"); // trailing comment 1 +import extMod = require("./commentsExternalModules2_0"); // trailing comment 1 >extMod : Symbol(extMod, Decl(commentsExternalModules_1.ts, 0, 0)) extMod.m1.fooExport(); diff --git a/tests/baselines/reference/commentsExternalModules3.types b/tests/baselines/reference/commentsExternalModules3.types index 556b5d11d35..2898784b7ea 100644 --- a/tests/baselines/reference/commentsExternalModules3.types +++ b/tests/baselines/reference/commentsExternalModules3.types @@ -1,6 +1,6 @@ === tests/cases/compiler/commentsExternalModules_1.ts === /**This is on import declaration*/ -import extMod = require("commentsExternalModules2_0"); // trailing comment 1 +import extMod = require("./commentsExternalModules2_0"); // trailing comment 1 >extMod : typeof extMod extMod.m1.fooExport(); diff --git a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.js b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.js index 7814e9641ba..2355d7bbc7a 100644 --- a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.js +++ b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.js @@ -6,7 +6,7 @@ export class Foo { } //// [declFileAliasUseBeforeDeclaration_test.ts] export function bar(a: foo.Foo) { } -import foo = require("declFileAliasUseBeforeDeclaration_foo"); +import foo = require("./declFileAliasUseBeforeDeclaration_foo"); //// [declFileAliasUseBeforeDeclaration_foo.js] var Foo = (function () { @@ -25,4 +25,4 @@ export declare class Foo { } //// [declFileAliasUseBeforeDeclaration_test.d.ts] export declare function bar(a: foo.Foo): void; -import foo = require("declFileAliasUseBeforeDeclaration_foo"); +import foo = require("./declFileAliasUseBeforeDeclaration_foo"); diff --git a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.symbols b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.symbols index ee7795ae455..ba74b6cdfb7 100644 --- a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.symbols +++ b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.symbols @@ -5,7 +5,7 @@ export function bar(a: foo.Foo) { } >foo : Symbol(foo, Decl(declFileAliasUseBeforeDeclaration_test.ts, 0, 35)) >Foo : Symbol(foo.Foo, Decl(declFileAliasUseBeforeDeclaration_foo.ts, 0, 0)) -import foo = require("declFileAliasUseBeforeDeclaration_foo"); +import foo = require("./declFileAliasUseBeforeDeclaration_foo"); >foo : Symbol(foo, Decl(declFileAliasUseBeforeDeclaration_test.ts, 0, 35)) === tests/cases/compiler/declFileAliasUseBeforeDeclaration_foo.ts === diff --git a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.types b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.types index c21d98d90d5..544efded5ee 100644 --- a/tests/baselines/reference/declFileAliasUseBeforeDeclaration.types +++ b/tests/baselines/reference/declFileAliasUseBeforeDeclaration.types @@ -5,7 +5,7 @@ export function bar(a: foo.Foo) { } >foo : any >Foo : foo.Foo -import foo = require("declFileAliasUseBeforeDeclaration_foo"); +import foo = require("./declFileAliasUseBeforeDeclaration_foo"); >foo : typeof foo === tests/cases/compiler/declFileAliasUseBeforeDeclaration_foo.ts === diff --git a/tests/baselines/reference/declFileForExportedImport.js b/tests/baselines/reference/declFileForExportedImport.js index af7cfa46b73..88967c4c2a4 100644 --- a/tests/baselines/reference/declFileForExportedImport.js +++ b/tests/baselines/reference/declFileForExportedImport.js @@ -5,7 +5,7 @@ export var x: number; //// [declFileForExportedImport_1.ts] /// -export import a = require('declFileForExportedImport_0'); +export import a = require('./declFileForExportedImport_0'); var y = a.x; export import b = a; @@ -14,7 +14,7 @@ var z = b.x; //// [declFileForExportedImport_0.js] //// [declFileForExportedImport_1.js] /// -exports.a = require('declFileForExportedImport_0'); +exports.a = require('./declFileForExportedImport_0'); var y = exports.a.x; exports.b = exports.a; var z = exports.b.x; @@ -24,5 +24,5 @@ var z = exports.b.x; export declare var x: number; //// [declFileForExportedImport_1.d.ts] /// -export import a = require('declFileForExportedImport_0'); +export import a = require('./declFileForExportedImport_0'); export import b = a; diff --git a/tests/baselines/reference/declFileForExportedImport.symbols b/tests/baselines/reference/declFileForExportedImport.symbols index fb7b7cd343f..fe14836199c 100644 --- a/tests/baselines/reference/declFileForExportedImport.symbols +++ b/tests/baselines/reference/declFileForExportedImport.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/declFileForExportedImport_1.ts === /// -export import a = require('declFileForExportedImport_0'); +export import a = require('./declFileForExportedImport_0'); >a : Symbol(a, Decl(declFileForExportedImport_1.ts, 0, 0)) var y = a.x; diff --git a/tests/baselines/reference/declFileForExportedImport.types b/tests/baselines/reference/declFileForExportedImport.types index 987f82bf5a0..0ff8c2f454b 100644 --- a/tests/baselines/reference/declFileForExportedImport.types +++ b/tests/baselines/reference/declFileForExportedImport.types @@ -1,6 +1,6 @@ === tests/cases/compiler/declFileForExportedImport_1.ts === /// -export import a = require('declFileForExportedImport_0'); +export import a = require('./declFileForExportedImport_0'); >a : typeof a var y = a.x; diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.js b/tests/baselines/reference/declFileImportModuleWithExportAssignment.js index 145d4ad3ff2..b070b67ad18 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.js +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.js @@ -21,7 +21,7 @@ export = m2; //// [declFileImportModuleWithExportAssignment_1.ts] /**This is on import declaration*/ -import a1 = require("declFileImportModuleWithExportAssignment_0"); +import a1 = require("./declFileImportModuleWithExportAssignment_0"); export var a = a1; a.test1(null, null, null); @@ -31,7 +31,7 @@ var m2; module.exports = m2; //// [declFileImportModuleWithExportAssignment_1.js] /**This is on import declaration*/ -var a1 = require("declFileImportModuleWithExportAssignment_0"); +var a1 = require("./declFileImportModuleWithExportAssignment_0"); exports.a = a1; exports.a.test1(null, null, null); @@ -54,7 +54,7 @@ declare var m2: { export = m2; //// [declFileImportModuleWithExportAssignment_1.d.ts] /**This is on import declaration*/ -import a1 = require("declFileImportModuleWithExportAssignment_0"); +import a1 = require("./declFileImportModuleWithExportAssignment_0"); export declare var a: { (): a1.connectExport; test1: a1.connectModule; diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols b/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols index 62d9d599939..a33e0fef758 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/declFileImportModuleWithExportAssignment_1.ts === /**This is on import declaration*/ -import a1 = require("declFileImportModuleWithExportAssignment_0"); +import a1 = require("./declFileImportModuleWithExportAssignment_0"); >a1 : Symbol(a1, Decl(declFileImportModuleWithExportAssignment_1.ts, 0, 0)) export var a = a1; diff --git a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types index d3082311c1d..123b7b56d4f 100644 --- a/tests/baselines/reference/declFileImportModuleWithExportAssignment.types +++ b/tests/baselines/reference/declFileImportModuleWithExportAssignment.types @@ -1,6 +1,6 @@ === tests/cases/compiler/declFileImportModuleWithExportAssignment_1.ts === /**This is on import declaration*/ -import a1 = require("declFileImportModuleWithExportAssignment_0"); +import a1 = require("./declFileImportModuleWithExportAssignment_0"); >a1 : { (): a1.connectExport; test1: a1.connectModule; test2(): a1.connectModule; } export var a = a1; diff --git a/tests/baselines/reference/declarationEmitDestructuring2.js b/tests/baselines/reference/declarationEmitDestructuring2.js index eeabbf1ff37..09980c5c9dd 100644 --- a/tests/baselines/reference/declarationEmitDestructuring2.js +++ b/tests/baselines/reference/declarationEmitDestructuring2.js @@ -21,8 +21,8 @@ function h1(_a) { //// [declarationEmitDestructuring2.d.ts] declare function f({x, y: [a, b, c, d]}?: { - x: number; - y: [number, number, number, number]; + x?: number; + y?: [number, number, number, number]; }): void; declare function g([a, b, c, d]?: [number, number, number, number]): void; declare function h([a, [b], [[c]], {x, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], { diff --git a/tests/baselines/reference/declarationEmitDestructuring4.errors.txt b/tests/baselines/reference/declarationEmitDestructuring4.errors.txt new file mode 100644 index 00000000000..2787d5e6674 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuring4.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/declarationEmitDestructuring4.ts(9,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + + +==== tests/cases/compiler/declarationEmitDestructuring4.ts (1 errors) ==== + // For an array binding pattern with empty elements, + // we will not make any modification and will emit + // the similar binding pattern users' have written + function baz([]) { } + function baz1([] = [1,2,3]) { } + function baz2([[]] = [[1,2,3]]) { } + + function baz3({}) { } + function baz4({} = { x: 10 }) { } + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuring4.symbols b/tests/baselines/reference/declarationEmitDestructuring4.symbols deleted file mode 100644 index 9f2eb162b6f..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuring4.symbols +++ /dev/null @@ -1,21 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuring4.ts === -// For an array binding pattern with empty elements, -// we will not make any modification and will emit -// the similar binding pattern users' have written -function baz([]) { } ->baz : Symbol(baz, Decl(declarationEmitDestructuring4.ts, 0, 0)) - -function baz1([] = [1,2,3]) { } ->baz1 : Symbol(baz1, Decl(declarationEmitDestructuring4.ts, 3, 20)) - -function baz2([[]] = [[1,2,3]]) { } ->baz2 : Symbol(baz2, Decl(declarationEmitDestructuring4.ts, 4, 31)) - -function baz3({}) { } ->baz3 : Symbol(baz3, Decl(declarationEmitDestructuring4.ts, 5, 35)) - -function baz4({} = { x: 10 }) { } ->baz4 : Symbol(baz4, Decl(declarationEmitDestructuring4.ts, 7, 21)) ->x : Symbol(x, Decl(declarationEmitDestructuring4.ts, 8, 20)) - - diff --git a/tests/baselines/reference/declarationEmitDestructuring4.types b/tests/baselines/reference/declarationEmitDestructuring4.types deleted file mode 100644 index 9621d61e02b..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuring4.types +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuring4.ts === -// For an array binding pattern with empty elements, -// we will not make any modification and will emit -// the similar binding pattern users' have written -function baz([]) { } ->baz : ([]: any[]) => void - -function baz1([] = [1,2,3]) { } ->baz1 : ([]?: number[]) => void ->[1,2,3] : number[] ->1 : number ->2 : number ->3 : number - -function baz2([[]] = [[1,2,3]]) { } ->baz2 : ([[]]?: [number[]]) => void ->[[1,2,3]] : [number[]] ->[1,2,3] : number[] ->1 : number ->2 : number ->3 : number - -function baz3({}) { } ->baz3 : ({}: {}) => void - -function baz4({} = { x: 10 }) { } ->baz4 : ({}?: { x: number; }) => void ->{ x: 10 } : { x: number; } ->x : number ->10 : number - - diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.errors.txt b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.errors.txt new file mode 100644 index 00000000000..26998fd83ae --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + +==== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts (3 errors) ==== + var [x10, [y10, [z10]]] = [1, ["hello", [true]]]; + + var [x11 = 0, y11 = ""] = [1, "hello"]; + var [a11, b11, c11] = []; + ~~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]]; + + var [x13, y13] = [1, "hello"]; + var [a3, b3] = [[x13, y13], { x: x13, y: y13 }]; + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.symbols b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.symbols deleted file mode 100644 index 0a3c6f4044d..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.symbols +++ /dev/null @@ -1,40 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts === -var [x10, [y10, [z10]]] = [1, ["hello", [true]]]; ->x10 : Symbol(x10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 5)) ->y10 : Symbol(y10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 11)) ->z10 : Symbol(z10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 17)) - -var [x11 = 0, y11 = ""] = [1, "hello"]; ->x11 : Symbol(x11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 5)) ->y11 : Symbol(y11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 13)) - -var [a11, b11, c11] = []; ->a11 : Symbol(a11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 5)) ->b11 : Symbol(b11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 9)) ->c11 : Symbol(c11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 14)) - -var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]]; ->a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5)) ->b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10)) ->x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15)) ->y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91)) ->c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20)) ->x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41)) ->y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50)) ->x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 83)) ->y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91)) - -var [x13, y13] = [1, "hello"]; ->x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5)) ->y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9)) - -var [a3, b3] = [[x13, y13], { x: x13, y: y13 }]; ->a3 : Symbol(a3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 5)) ->b3 : Symbol(b3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 8)) ->x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5)) ->y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9)) ->x : Symbol(x, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 29)) ->x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5)) ->y : Symbol(y, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 37)) ->y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9)) - diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types deleted file mode 100644 index eb028aacff4..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types +++ /dev/null @@ -1,70 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts === -var [x10, [y10, [z10]]] = [1, ["hello", [true]]]; ->x10 : number ->y10 : string ->z10 : boolean ->[1, ["hello", [true]]] : [number, [string, [boolean]]] ->1 : number ->["hello", [true]] : [string, [boolean]] ->"hello" : string ->[true] : [boolean] ->true : boolean - -var [x11 = 0, y11 = ""] = [1, "hello"]; ->x11 : number ->0 : number ->y11 : string ->"" : string ->[1, "hello"] : [number, string] ->1 : number ->"hello" : string - -var [a11, b11, c11] = []; ->a11 : any ->b11 : any ->c11 : any ->[] : undefined[] - -var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]]; ->a2 : number ->b2 : string ->x12 : number ->y12 : any ->c2 : boolean ->["abc", { x12: 10, y12: false }] : [string, { x12: number; y12: boolean; }] ->"abc" : string ->{ x12: 10, y12: false } : { x12: number; y12: boolean; } ->x12 : number ->10 : number ->y12 : boolean ->false : boolean ->[1, ["hello", { x12: 5, y12: true }]] : [number, [string, { x12: number; y12: boolean; }]] ->1 : number ->["hello", { x12: 5, y12: true }] : [string, { x12: number; y12: boolean; }] ->"hello" : string ->{ x12: 5, y12: true } : { x12: number; y12: boolean; } ->x12 : number ->5 : number ->y12 : boolean ->true : boolean - -var [x13, y13] = [1, "hello"]; ->x13 : number ->y13 : string ->[1, "hello"] : [number, string] ->1 : number ->"hello" : string - -var [a3, b3] = [[x13, y13], { x: x13, y: y13 }]; ->a3 : (number | string)[] ->b3 : { x: number; y: string; } ->[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }] ->[x13, y13] : (number | string)[] ->x13 : number ->y13 : string ->{ x: x13, y: y13 } : { x: number; y: string; } ->x : number ->x13 : number ->y : string ->y13 : string - diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.errors.txt b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.errors.txt new file mode 100644 index 00000000000..92a8cba2d40 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.errors.txt @@ -0,0 +1,43 @@ +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'. + + +==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts (6 errors) ==== + + var { } = { x: 5, y: "hello" }; + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. + var { x4 } = { x4: 5, y4: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'. + var { y5 } = { x5: 5, y5: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'. + var { x6, y6 } = { x6: 5, y6: "hello" }; + var { x7: a1 } = { x7: 5, y7: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'. + var { y8: b1 } = { x8: 5, y8: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'. + var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; + + var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } }; + + function f15() { + var a4 = "hello"; + var b4 = 1; + var c4 = true; + return { a4, b4, c4 }; + } + var { a4, b4, c4 } = f15(); + + module m { + export var { a4, b4, c4 } = f15(); + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.symbols b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.symbols deleted file mode 100644 index 0a57a93f3d0..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.symbols +++ /dev/null @@ -1,89 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts === - -var { } = { x: 5, y: "hello" }; ->x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 11)) ->y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 17)) - -var { x4 } = { x4: 5, y4: "hello" }; ->x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 5)) ->x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 14)) ->y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 21)) - -var { y5 } = { x5: 5, y5: "hello" }; ->y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 5)) ->x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 14)) ->y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 21)) - -var { x6, y6 } = { x6: 5, y6: "hello" }; ->x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 5)) ->y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 9)) ->x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 18)) ->y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25)) - -var { x7: a1 } = { x7: 5, y7: "hello" }; ->x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18)) ->a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5)) ->x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18)) ->y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25)) - -var { y8: b1 } = { x8: 5, y8: "hello" }; ->y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25)) ->b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5)) ->x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18)) ->y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25)) - -var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; ->x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26)) ->a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5)) ->y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33)) ->b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13)) ->x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26)) ->y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33)) - -var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } }; ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46)) ->x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5)) ->b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52)) ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57)) ->y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18)) ->b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69)) ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74)) ->z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31)) ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46)) ->b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52)) ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57)) ->b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69)) ->a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74)) - -function f15() { ->f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89)) - - var a4 = "hello"; ->a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 12, 7)) - - var b4 = 1; ->b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 13, 7)) - - var c4 = true; ->c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 14, 7)) - - return { a4, b4, c4 }; ->a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 12)) ->b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 16)) ->c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 20)) -} -var { a4, b4, c4 } = f15(); ->a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 5)) ->b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 9)) ->c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 13)) ->f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89)) - -module m { ->m : Symbol(m, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 27)) - - export var { a4, b4, c4 } = f15(); ->a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 16)) ->b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 20)) ->c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 24)) ->f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89)) -} diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.types b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.types deleted file mode 100644 index 0911a27838b..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.types +++ /dev/null @@ -1,122 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts === - -var { } = { x: 5, y: "hello" }; ->{ x: 5, y: "hello" } : { x: number; y: string; } ->x : number ->5 : number ->y : string ->"hello" : string - -var { x4 } = { x4: 5, y4: "hello" }; ->x4 : number ->{ x4: 5, y4: "hello" } : { x4: number; y4: string; } ->x4 : number ->5 : number ->y4 : string ->"hello" : string - -var { y5 } = { x5: 5, y5: "hello" }; ->y5 : string ->{ x5: 5, y5: "hello" } : { x5: number; y5: string; } ->x5 : number ->5 : number ->y5 : string ->"hello" : string - -var { x6, y6 } = { x6: 5, y6: "hello" }; ->x6 : number ->y6 : string ->{ x6: 5, y6: "hello" } : { x6: number; y6: string; } ->x6 : number ->5 : number ->y6 : string ->"hello" : string - -var { x7: a1 } = { x7: 5, y7: "hello" }; ->x7 : any ->a1 : number ->{ x7: 5, y7: "hello" } : { x7: number; y7: string; } ->x7 : number ->5 : number ->y7 : string ->"hello" : string - -var { y8: b1 } = { x8: 5, y8: "hello" }; ->y8 : any ->b1 : string ->{ x8: 5, y8: "hello" } : { x8: number; y8: string; } ->x8 : number ->5 : number ->y8 : string ->"hello" : string - -var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; ->x9 : any ->a2 : number ->y9 : any ->b2 : string ->{ x9: 5, y9: "hello" } : { x9: number; y9: string; } ->x9 : number ->5 : number ->y9 : string ->"hello" : string - -var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } }; ->a : any ->x11 : number ->b : any ->a : any ->y11 : string ->b : any ->a : any ->z11 : boolean ->{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; } ->a : number ->1 : number ->b : { a: string; b: { a: boolean; }; } ->{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; } ->a : string ->"hello" : string ->b : { a: boolean; } ->{ a: true } : { a: boolean; } ->a : boolean ->true : boolean - -function f15() { ->f15 : () => { a4: string; b4: number; c4: boolean; } - - var a4 = "hello"; ->a4 : string ->"hello" : string - - var b4 = 1; ->b4 : number ->1 : number - - var c4 = true; ->c4 : boolean ->true : boolean - - return { a4, b4, c4 }; ->{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; } ->a4 : string ->b4 : number ->c4 : boolean -} -var { a4, b4, c4 } = f15(); ->a4 : string ->b4 : number ->c4 : boolean ->f15() : { a4: string; b4: number; c4: boolean; } ->f15 : () => { a4: string; b4: number; c4: boolean; } - -module m { ->m : typeof m - - export var { a4, b4, c4 } = f15(); ->a4 : string ->b4 : number ->c4 : boolean ->f15() : { a4: string; b4: number; c4: boolean; } ->f15 : () => { a4: string; b4: number; c4: boolean; } -} diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.errors.txt b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.errors.txt new file mode 100644 index 00000000000..24fbcf99ad1 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'. +tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'. + + +==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts (6 errors) ==== + + var { } = { x: 5, y: "hello" }; + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. + var { x4 } = { x4: 5, y4: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'. + var { y5 } = { x5: 5, y5: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'. + var { x6, y6 } = { x6: 5, y6: "hello" }; + var { x7: a1 } = { x7: 5, y7: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'. + var { y8: b1 } = { x8: 5, y8: "hello" }; + ~~ +!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'. + var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.symbols b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.symbols deleted file mode 100644 index cac2431411e..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.symbols +++ /dev/null @@ -1,42 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts === - -var { } = { x: 5, y: "hello" }; ->x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 11)) ->y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 17)) - -var { x4 } = { x4: 5, y4: "hello" }; ->x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 5)) ->x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 14)) ->y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 21)) - -var { y5 } = { x5: 5, y5: "hello" }; ->y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 5)) ->x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 14)) ->y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 21)) - -var { x6, y6 } = { x6: 5, y6: "hello" }; ->x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 5)) ->y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 9)) ->x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 18)) ->y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25)) - -var { x7: a1 } = { x7: 5, y7: "hello" }; ->x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18)) ->a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5)) ->x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18)) ->y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25)) - -var { y8: b1 } = { x8: 5, y8: "hello" }; ->y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25)) ->b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5)) ->x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18)) ->y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25)) - -var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; ->x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26)) ->a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5)) ->y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33)) ->b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13)) ->x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26)) ->y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33)) - diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.types b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.types deleted file mode 100644 index 5411f36fa9a..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern1.types +++ /dev/null @@ -1,63 +0,0 @@ -=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts === - -var { } = { x: 5, y: "hello" }; ->{ x: 5, y: "hello" } : { x: number; y: string; } ->x : number ->5 : number ->y : string ->"hello" : string - -var { x4 } = { x4: 5, y4: "hello" }; ->x4 : number ->{ x4: 5, y4: "hello" } : { x4: number; y4: string; } ->x4 : number ->5 : number ->y4 : string ->"hello" : string - -var { y5 } = { x5: 5, y5: "hello" }; ->y5 : string ->{ x5: 5, y5: "hello" } : { x5: number; y5: string; } ->x5 : number ->5 : number ->y5 : string ->"hello" : string - -var { x6, y6 } = { x6: 5, y6: "hello" }; ->x6 : number ->y6 : string ->{ x6: 5, y6: "hello" } : { x6: number; y6: string; } ->x6 : number ->5 : number ->y6 : string ->"hello" : string - -var { x7: a1 } = { x7: 5, y7: "hello" }; ->x7 : any ->a1 : number ->{ x7: 5, y7: "hello" } : { x7: number; y7: string; } ->x7 : number ->5 : number ->y7 : string ->"hello" : string - -var { y8: b1 } = { x8: 5, y8: "hello" }; ->y8 : any ->b1 : string ->{ x8: 5, y8: "hello" } : { x8: number; y8: string; } ->x8 : number ->5 : number ->y8 : string ->"hello" : string - -var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" }; ->x9 : any ->a2 : number ->y9 : any ->b2 : string ->{ x9: 5, y9: "hello" } : { x9: number; y9: string; } ->x9 : number ->5 : number ->y9 : string ->"hello" : string - diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.js b/tests/baselines/reference/declarationEmit_exportAssignment.js index 54f3eb5fd0e..d761e2c45eb 100644 --- a/tests/baselines/reference/declarationEmit_exportAssignment.js +++ b/tests/baselines/reference/declarationEmit_exportAssignment.js @@ -7,7 +7,7 @@ export function bar() { } export interface Buzz { } //// [index.ts] -import {foo} from "utils"; +import {foo} from "./utils"; export = foo; //// [utils.js] @@ -16,7 +16,7 @@ exports.foo = foo; function bar() { } exports.bar = bar; //// [index.js] -var utils_1 = require("utils"); +var utils_1 = require("./utils"); module.exports = utils_1.foo; @@ -26,5 +26,5 @@ export declare function bar(): void; export interface Buzz { } //// [index.d.ts] -import { foo } from "utils"; +import { foo } from "./utils"; export = foo; diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.symbols b/tests/baselines/reference/declarationEmit_exportAssignment.symbols index b443ba6e797..d2131d27a8f 100644 --- a/tests/baselines/reference/declarationEmit_exportAssignment.symbols +++ b/tests/baselines/reference/declarationEmit_exportAssignment.symbols @@ -10,7 +10,7 @@ export interface Buzz { } >Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25)) === tests/cases/compiler/index.ts === -import {foo} from "utils"; +import {foo} from "./utils"; >foo : Symbol(foo, Decl(index.ts, 0, 8)) export = foo; diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.types b/tests/baselines/reference/declarationEmit_exportAssignment.types index 81c56da432f..763441b8a90 100644 --- a/tests/baselines/reference/declarationEmit_exportAssignment.types +++ b/tests/baselines/reference/declarationEmit_exportAssignment.types @@ -10,7 +10,7 @@ export interface Buzz { } >Buzz : Buzz === tests/cases/compiler/index.ts === -import {foo} from "utils"; +import {foo} from "./utils"; >foo : () => void export = foo; diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.js b/tests/baselines/reference/declarationEmit_exportDeclaration.js index f05639dc18f..e2cb15b408c 100644 --- a/tests/baselines/reference/declarationEmit_exportDeclaration.js +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.js @@ -7,7 +7,7 @@ export function bar() { } export interface Buzz { } //// [index.ts] -import {foo, bar, Buzz} from "utils"; +import {foo, bar, Buzz} from "./utils"; foo(); let obj: Buzz; @@ -19,7 +19,7 @@ exports.foo = foo; function bar() { } exports.bar = bar; //// [index.js] -var utils_1 = require("utils"); +var utils_1 = require("./utils"); exports.bar = utils_1.bar; utils_1.foo(); var obj; @@ -31,5 +31,5 @@ export declare function bar(): void; export interface Buzz { } //// [index.d.ts] -import { bar } from "utils"; +import { bar } from "./utils"; export { bar }; diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.symbols b/tests/baselines/reference/declarationEmit_exportDeclaration.symbols index 5cd8c5fee99..40d6bafdee5 100644 --- a/tests/baselines/reference/declarationEmit_exportDeclaration.symbols +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.symbols @@ -10,7 +10,7 @@ export interface Buzz { } >Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25)) === tests/cases/compiler/index.ts === -import {foo, bar, Buzz} from "utils"; +import {foo, bar, Buzz} from "./utils"; >foo : Symbol(foo, Decl(index.ts, 0, 8)) >bar : Symbol(bar, Decl(index.ts, 0, 12)) >Buzz : Symbol(Buzz, Decl(index.ts, 0, 17)) diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.types b/tests/baselines/reference/declarationEmit_exportDeclaration.types index 058ee863c61..25a8f1d29bd 100644 --- a/tests/baselines/reference/declarationEmit_exportDeclaration.types +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.types @@ -10,7 +10,7 @@ export interface Buzz { } >Buzz : Buzz === tests/cases/compiler/index.ts === -import {foo, bar, Buzz} from "utils"; +import {foo, bar, Buzz} from "./utils"; >foo : () => void >bar : () => void >Buzz : any diff --git a/tests/baselines/reference/declarationEmit_nameConflicts.js b/tests/baselines/reference/declarationEmit_nameConflicts.js index ae517bb7460..857fbee764d 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts.js @@ -5,7 +5,7 @@ module f { export class c { } } export = f; //// [declarationEmit_nameConflicts_0.ts] -import im = require('declarationEmit_nameConflicts_1'); +import im = require('./declarationEmit_nameConflicts_1'); export module M { export function f() { } export class C { } @@ -61,7 +61,7 @@ var f; })(f || (f = {})); module.exports = f; //// [declarationEmit_nameConflicts_0.js] -var im = require('declarationEmit_nameConflicts_1'); +var im = require('./declarationEmit_nameConflicts_1'); var M; (function (M) { function f() { } @@ -138,7 +138,7 @@ declare module f { } export = f; //// [declarationEmit_nameConflicts_0.d.ts] -import im = require('declarationEmit_nameConflicts_1'); +import im = require('./declarationEmit_nameConflicts_1'); export declare module M { function f(): void; class C { diff --git a/tests/baselines/reference/declarationEmit_nameConflicts.symbols b/tests/baselines/reference/declarationEmit_nameConflicts.symbols index a626ed05b15..1c5bb35b756 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts.symbols +++ b/tests/baselines/reference/declarationEmit_nameConflicts.symbols @@ -1,9 +1,9 @@ === tests/cases/compiler/declarationEmit_nameConflicts_0.ts === -import im = require('declarationEmit_nameConflicts_1'); +import im = require('./declarationEmit_nameConflicts_1'); >im : Symbol(im, Decl(declarationEmit_nameConflicts_0.ts, 0, 0)) export module M { ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) export function f() { } >f : Symbol(f, Decl(declarationEmit_nameConflicts_0.ts, 1, 17)) @@ -23,12 +23,12 @@ export module M { export import a = M.f; >a : Symbol(a, Decl(declarationEmit_nameConflicts_0.ts, 7, 5)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >f : Symbol(f, Decl(declarationEmit_nameConflicts_0.ts, 1, 17)) export import b = M.C; >b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 9, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >C : Symbol(C, Decl(declarationEmit_nameConflicts_0.ts, 2, 27)) export import c = N; @@ -41,7 +41,7 @@ export module M { } export module M.P { ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >P : Symbol(P, Decl(declarationEmit_nameConflicts_0.ts, 15, 16)) export function f() { } @@ -61,45 +61,45 @@ export module M.P { } export import im = M.P.f; >im : Symbol(im, Decl(declarationEmit_nameConflicts_0.ts, 21, 5)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >P : Symbol(P, Decl(declarationEmit_nameConflicts_0.ts, 15, 16)) >f : Symbol(f, Decl(declarationEmit_nameConflicts_0.ts, 15, 19)) export var a = M.a; // emitted incorrectly as typeof f >a : Symbol(a, Decl(declarationEmit_nameConflicts_0.ts, 23, 14)) >M.a : Symbol(a, Decl(declarationEmit_nameConflicts_0.ts, 7, 5)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >a : Symbol(a, Decl(declarationEmit_nameConflicts_0.ts, 7, 5)) export var b = M.b; // ok >b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 24, 14)) >M.b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 9, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 9, 26)) export var c = M.c; // ok >c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 25, 14)) >M.c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) export var g = M.c.g; // ok >g : Symbol(g, Decl(declarationEmit_nameConflicts_0.ts, 26, 14)) >M.c.g : Symbol(c.g, Decl(declarationEmit_nameConflicts_0.ts, 4, 21)) >M.c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) >g : Symbol(c.g, Decl(declarationEmit_nameConflicts_0.ts, 4, 21)) export var d = M.d; // emitted incorrectly as typeof im >d : Symbol(d, Decl(declarationEmit_nameConflicts_0.ts, 27, 14)) >M.d : Symbol(d, Decl(declarationEmit_nameConflicts_0.ts, 11, 24)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >d : Symbol(d, Decl(declarationEmit_nameConflicts_0.ts, 11, 24)) } export module M.Q { ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >Q : Symbol(Q, Decl(declarationEmit_nameConflicts_0.ts, 30, 16)) export function f() { } @@ -120,14 +120,14 @@ export module M.Q { export interface b extends M.b { } // ok >b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 36, 5)) >M.b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 9, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >b : Symbol(b, Decl(declarationEmit_nameConflicts_0.ts, 9, 26)) export interface I extends M.c.I { } // ok >I : Symbol(I, Decl(declarationEmit_nameConflicts_0.ts, 37, 38)) >M.c.I : Symbol(M.c.I, Decl(declarationEmit_nameConflicts_0.ts, 5, 32)) >M.c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) >I : Symbol(M.c.I, Decl(declarationEmit_nameConflicts_0.ts, 5, 32)) @@ -138,7 +138,7 @@ export module M.Q { >I : Symbol(I, Decl(declarationEmit_nameConflicts_0.ts, 39, 21)) >M.c.I : Symbol(M.c.I, Decl(declarationEmit_nameConflicts_0.ts, 5, 32)) >M.c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) ->M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 55), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) +>M : Symbol(M, Decl(declarationEmit_nameConflicts_0.ts, 0, 57), Decl(declarationEmit_nameConflicts_0.ts, 13, 1), Decl(declarationEmit_nameConflicts_0.ts, 28, 1)) >c : Symbol(c, Decl(declarationEmit_nameConflicts_0.ts, 10, 26)) >I : Symbol(M.c.I, Decl(declarationEmit_nameConflicts_0.ts, 5, 32)) } diff --git a/tests/baselines/reference/declarationEmit_nameConflicts.types b/tests/baselines/reference/declarationEmit_nameConflicts.types index dacd657706d..6ea650946c5 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts.types +++ b/tests/baselines/reference/declarationEmit_nameConflicts.types @@ -1,5 +1,5 @@ === tests/cases/compiler/declarationEmit_nameConflicts_0.ts === -import im = require('declarationEmit_nameConflicts_1'); +import im = require('./declarationEmit_nameConflicts_1'); >im : typeof im export module M { diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 828083e7687..7c4671022ea 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -1,11 +1,20 @@ -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2459: Type '{}' has no property 'a' and no string index signature. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2459: Type '{}' has no property 'b' and no string index signature. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,14): error TS2459: Type 'undefined[]' has no property 'b' and no string index signature. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'. @@ -18,15 +27,15 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6): tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'. -==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (13 errors) ==== +==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (22 errors) ==== function f0() { var [] = [1, "hello"]; var [x] = [1, "hello"]; var [x, y] = [1, "hello"]; - var [x, y, z] = [1, "hello"]; // Error + var [x, y, z] = [1, "hello"]; ~ -!!! error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'. - var [,, z] = [0, 1, 2]; +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [,, x] = [0, 1, 2]; var x: number; var y: string; } @@ -42,14 +51,26 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): } function f2() { - var { } = { x: 5, y: "hello" }; - var { x } = { x: 5, y: "hello" }; - var { y } = { x: 5, y: "hello" }; + var { } = { x: 5, y: "hello" }; // Error, no x and y in target + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. + var { x } = { x: 5, y: "hello" }; // Error, no y in target + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. + var { y } = { x: 5, y: "hello" }; // Error, no x in target + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. var { x, y } = { x: 5, y: "hello" }; var x: number; var y: string; - var { x: a } = { x: 5, y: "hello" }; - var { y: b } = { x: 5, y: "hello" }; + var { x: a } = { x: 5, y: "hello" }; // Error, no y in target + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. + var { y: b } = { x: 5, y: "hello" }; // Error, no x in target + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. var { x: a, y: b } = { x: 5, y: "hello" }; var a: number; var b: string; @@ -85,11 +106,17 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): function f8() { var [a, b, c] = []; // Ok, [] is an array + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var [d, e, f] = [1]; // Error, [1] is a tuple ~ -!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. ~ -!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. } function f9() { @@ -105,9 +132,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): function f10() { var { a, b } = {}; // Error ~ -!!! error TS2459: Type '{}' has no property 'a' and no string index signature. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. ~ -!!! error TS2459: Type '{}' has no property 'b' and no string index signature. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var { a, b } = []; // Error ~ !!! error TS2459: Type 'undefined[]' has no property 'a' and no string index signature. diff --git a/tests/baselines/reference/declarationsAndAssignments.js b/tests/baselines/reference/declarationsAndAssignments.js index 5c47756e7fe..018aa5522ca 100644 --- a/tests/baselines/reference/declarationsAndAssignments.js +++ b/tests/baselines/reference/declarationsAndAssignments.js @@ -3,8 +3,8 @@ function f0() { var [] = [1, "hello"]; var [x] = [1, "hello"]; var [x, y] = [1, "hello"]; - var [x, y, z] = [1, "hello"]; // Error - var [,, z] = [0, 1, 2]; + var [x, y, z] = [1, "hello"]; + var [,, x] = [0, 1, 2]; var x: number; var y: string; } @@ -20,14 +20,14 @@ function f1() { } function f2() { - var { } = { x: 5, y: "hello" }; - var { x } = { x: 5, y: "hello" }; - var { y } = { x: 5, y: "hello" }; + var { } = { x: 5, y: "hello" }; // Error, no x and y in target + var { x } = { x: 5, y: "hello" }; // Error, no y in target + var { y } = { x: 5, y: "hello" }; // Error, no x in target var { x, y } = { x: 5, y: "hello" }; var x: number; var y: string; - var { x: a } = { x: 5, y: "hello" }; - var { y: b } = { x: 5, y: "hello" }; + var { x: a } = { x: 5, y: "hello" }; // Error, no y in target + var { y: b } = { x: 5, y: "hello" }; // Error, no x in target var { x: a, y: b } = { x: 5, y: "hello" }; var a: number; var b: string; @@ -185,8 +185,8 @@ function f0() { var _a = [1, "hello"]; var x = [1, "hello"][0]; var _b = [1, "hello"], x = _b[0], y = _b[1]; - var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; // Error - var _d = [0, 1, 2], z = _d[2]; + var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; + var _d = [0, 1, 2], x = _d[2]; var x; var y; } @@ -200,14 +200,14 @@ function f1() { var z; } function f2() { - var _a = { x: 5, y: "hello" }; - var x = { x: 5, y: "hello" }.x; - var y = { x: 5, y: "hello" }.y; + var _a = { x: 5, y: "hello" }; // Error, no x and y in target + var x = { x: 5, y: "hello" }.x; // Error, no y in target + var y = { x: 5, y: "hello" }.y; // Error, no x in target var _b = { x: 5, y: "hello" }, x = _b.x, y = _b.y; var x; var y; - var a = { x: 5, y: "hello" }.x; - var b = { x: 5, y: "hello" }.y; + var a = { x: 5, y: "hello" }.x; // Error, no y in target + var b = { x: 5, y: "hello" }.y; // Error, no x in target var _c = { x: 5, y: "hello" }, a = _c.x, b = _c.y; var a; var b; diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.js b/tests/baselines/reference/decoratorMetadataOnInferredType.js new file mode 100644 index 00000000000..8103dbbdafa --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.js @@ -0,0 +1,39 @@ +//// [decoratorMetadataOnInferredType.ts] + +declare var console: { + log(msg: string): void; +}; + +class A { + constructor() { console.log('new A'); } +} + +function decorator(target: Object, propertyKey: string) { +} + +export class B { + @decorator + x = new A(); +} + + +//// [decoratorMetadataOnInferredType.js] +var A = (function () { + function A() { + console.log('new A'); + } + return A; +})(); +function decorator(target, propertyKey) { +} +var B = (function () { + function B() { + this.x = new A(); + } + __decorate([ + decorator, + __metadata('design:type', Object) + ], B.prototype, "x"); + return B; +})(); +exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.symbols b/tests/baselines/reference/decoratorMetadataOnInferredType.symbols new file mode 100644 index 00000000000..e1507c75e94 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/decoratorMetadataOnInferredType.ts === + +declare var console: { +>console : Symbol(console, Decl(decoratorMetadataOnInferredType.ts, 1, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22)) +>msg : Symbol(msg, Decl(decoratorMetadataOnInferredType.ts, 2, 8)) + +}; + +class A { +>A : Symbol(A, Decl(decoratorMetadataOnInferredType.ts, 3, 2)) + + constructor() { console.log('new A'); } +>console.log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22)) +>console : Symbol(console, Decl(decoratorMetadataOnInferredType.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22)) +} + +function decorator(target: Object, propertyKey: string) { +>decorator : Symbol(decorator, Decl(decoratorMetadataOnInferredType.ts, 7, 1)) +>target : Symbol(target, Decl(decoratorMetadataOnInferredType.ts, 9, 19)) +>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) +>propertyKey : Symbol(propertyKey, Decl(decoratorMetadataOnInferredType.ts, 9, 34)) +} + +export class B { +>B : Symbol(B, Decl(decoratorMetadataOnInferredType.ts, 10, 1)) + + @decorator +>decorator : Symbol(decorator, Decl(decoratorMetadataOnInferredType.ts, 7, 1)) + + x = new A(); +>x : Symbol(x, Decl(decoratorMetadataOnInferredType.ts, 12, 16)) +>A : Symbol(A, Decl(decoratorMetadataOnInferredType.ts, 3, 2)) +} + diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.types b/tests/baselines/reference/decoratorMetadataOnInferredType.types new file mode 100644 index 00000000000..41c9334244f --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/decoratorMetadataOnInferredType.ts === + +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string + +}; + +class A { +>A : A + + constructor() { console.log('new A'); } +>console.log('new A') : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>'new A' : string +} + +function decorator(target: Object, propertyKey: string) { +>decorator : (target: Object, propertyKey: string) => void +>target : Object +>Object : Object +>propertyKey : string +} + +export class B { +>B : B + + @decorator +>decorator : (target: Object, propertyKey: string) => void + + x = new A(); +>x : A +>new A() : A +>A : typeof A +} + diff --git a/tests/baselines/reference/defaultExportsCannotMerge01.errors.txt b/tests/baselines/reference/defaultExportsCannotMerge01.errors.txt index be08d976eeb..15c60e32d9f 100644 --- a/tests/baselines/reference/defaultExportsCannotMerge01.errors.txt +++ b/tests/baselines/reference/defaultExportsCannotMerge01.errors.txt @@ -1,9 +1,6 @@ tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. tests/cases/conformance/es6/modules/m1.ts(11,18): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. -tests/cases/conformance/es6/modules/m2.ts(5,8): error TS2304: Cannot find name 'Entity'. -tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'. -tests/cases/conformance/es6/modules/m2.ts(8,8): error TS2339: Property 'x' does not exist on type '() => number'. -tests/cases/conformance/es6/modules/m2.ts(9,8): error TS2339: Property 'y' does not exist on type '() => number'. +tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find module 'm1'. ==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ==== @@ -29,21 +26,15 @@ tests/cases/conformance/es6/modules/m2.ts(9,8): error TS2339: Property 'y' does } } -==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ==== +==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ==== import Entity from "m1" + ~~~~ +!!! error TS2307: Cannot find module 'm1'. Entity(); var x: Entity; - ~~~~~~ -!!! error TS2304: Cannot find name 'Entity'. var y: Entity.I; - ~~~~~~ -!!! error TS2503: Cannot find namespace 'Entity'. Entity.x; - ~ -!!! error TS2339: Property 'x' does not exist on type '() => number'. - Entity.y; - ~ -!!! error TS2339: Property 'y' does not exist on type '() => number'. \ No newline at end of file + Entity.y; \ No newline at end of file diff --git a/tests/baselines/reference/defaultExportsCannotMerge02.errors.txt b/tests/baselines/reference/defaultExportsCannotMerge02.errors.txt index ad9b85c7e94..30bab504c7e 100644 --- a/tests/baselines/reference/defaultExportsCannotMerge02.errors.txt +++ b/tests/baselines/reference/defaultExportsCannotMerge02.errors.txt @@ -1,9 +1,6 @@ tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. tests/cases/conformance/es6/modules/m1.ts(5,18): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. -tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'? -tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'. -tests/cases/conformance/es6/modules/m2.ts(8,13): error TS2339: Property 'p1' does not exist on type 'Decl'. -tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' does not exist on type 'Decl'. +tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find module 'm1'. ==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ==== @@ -25,20 +22,14 @@ tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' doe } } -==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ==== +==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ==== import Entity from "m1" + ~~~~ +!!! error TS2307: Cannot find module 'm1'. Entity(); - ~~~~~~~~ -!!! error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'? var x: Entity; var y: Entity.I; - ~~~~~~ -!!! error TS2503: Cannot find namespace 'Entity'. var z = new Entity(); - var sum = z.p1 + z.p2 - ~~ -!!! error TS2339: Property 'p1' does not exist on type 'Decl'. - ~~ -!!! error TS2339: Property 'p2' does not exist on type 'Decl'. \ No newline at end of file + var sum = z.p1 + z.p2 \ No newline at end of file diff --git a/tests/baselines/reference/defaultExportsCannotMerge03.errors.txt b/tests/baselines/reference/defaultExportsCannotMerge03.errors.txt index b1d405671e3..11e9c63b893 100644 --- a/tests/baselines/reference/defaultExportsCannotMerge03.errors.txt +++ b/tests/baselines/reference/defaultExportsCannotMerge03.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2518: Only an ambient class can be merged with an interface. tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead. -tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'? -tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'. -tests/cases/conformance/es6/modules/m2.ts(8,13): error TS2339: Property 'p1' does not exist on type 'Decl'. -tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' does not exist on type 'Decl'. +tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find module 'm1'. ==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ==== @@ -28,20 +25,14 @@ tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' doe } } -==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ==== +==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ==== import Entity from "m1" + ~~~~ +!!! error TS2307: Cannot find module 'm1'. Entity(); - ~~~~~~~~ -!!! error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'? var x: Entity; var y: Entity.I; - ~~~~~~ -!!! error TS2503: Cannot find namespace 'Entity'. var z = new Entity(); - var sum = z.p1 + z.p2 - ~~ -!!! error TS2339: Property 'p1' does not exist on type 'Decl'. - ~~ -!!! error TS2339: Property 'p2' does not exist on type 'Decl'. \ No newline at end of file + var sum = z.p1 + z.p2 \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.errors.txt new file mode 100644 index 00000000000..1f1bc85757b --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + +==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts (3 errors) ==== + /* AssignmentPattern: + * ObjectAssignmentPattern + * ArrayAssignmentPattern + * ArrayAssignmentPattern: + * [Elision AssignmentRestElementopt ] + * [AssignmentElementList] + * [AssignmentElementList, Elision AssignmentRestElementopt ] + * AssignmentElementList: + * Elision AssignmentElement + * AssignmentElementList, Elisionopt AssignmentElement + * AssignmentElement: + * LeftHandSideExpression Initialiseropt + * AssignmentPattern Initialiseropt + * AssignmentRestElement: + * ... LeftHandSideExpression + */ + + // In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. + // An expression of type S is considered assignable to an assignment target V if one of the following is true + + // 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 the type Any, or + + var [a0, a1]: any = undefined; + var [a2 = false, a3 = 1]: any = undefined; + + // 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, + // where N is the numeric index of E in the array assignment pattern, or + var [b0, b1, b2] = [2, 3, 4]; + var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; + + function foo() { + return [1, 2, 3]; + } + + var [b6, b7] = foo(); + var [...b8] = foo(); + + // 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 [c0, c1] = [...temp]; + var [c2] = []; + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[c5], c6]: [[string|number], boolean] = [[1], true]; + var [, c7] = [1, 2, 3]; + var [,,, c8] = [1, 2, 3, 4]; + var [,,, c9] = [1, 2, 3, 4]; + var [,,,...c10] = [1, 2, 3, 4, "hello"]; + var [c11, c12, ...c13] = [1, 2, "string"]; + var [c14, c15, c16] = [1, 2, "string"]; + + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.symbols b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.symbols deleted file mode 100644 index d8e319f4120..00000000000 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.symbols +++ /dev/null @@ -1,105 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts === -/* AssignmentPattern: - * ObjectAssignmentPattern - * ArrayAssignmentPattern - * ArrayAssignmentPattern: - * [Elision AssignmentRestElementopt ] - * [AssignmentElementList] - * [AssignmentElementList, Elision AssignmentRestElementopt ] - * AssignmentElementList: - * Elision AssignmentElement - * AssignmentElementList, Elisionopt AssignmentElement - * AssignmentElement: - * LeftHandSideExpression Initialiseropt - * AssignmentPattern Initialiseropt - * AssignmentRestElement: - * ... LeftHandSideExpression - */ - -// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. -// An expression of type S is considered assignable to an assignment target V if one of the following is true - -// 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 the type Any, or - -var [a0, a1]: any = undefined; ->a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 5)) ->a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 8)) ->undefined : Symbol(undefined) - -var [a2 = false, a3 = 1]: any = undefined; ->a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 5)) ->a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 16)) ->undefined : Symbol(undefined) - -// 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, -// where N is the numeric index of E in the array assignment pattern, or -var [b0, b1, b2] = [2, 3, 4]; ->b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 5)) ->b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 8)) ->b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 12)) - -var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; ->b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 5)) ->b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 8)) ->b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 12)) - -function foo() { ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62)) - - return [1, 2, 3]; -} - -var [b6, b7] = foo(); ->b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 5)) ->b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 8)) ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62)) - -var [...b8] = foo(); ->b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 37, 5)) ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62)) - -// 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] ->temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3)) - -var [c0, c1] = [...temp]; ->c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 5)) ->c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 8)) ->temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3)) - -var [c2] = []; ->c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 42, 5)) - -var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] ->c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 7)) ->c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 17)) - -var [[c5], c6]: [[string|number], boolean] = [[1], true]; ->c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 6)) ->c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 10)) - -var [, c7] = [1, 2, 3]; ->c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 45, 6)) - -var [,,, c8] = [1, 2, 3, 4]; ->c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 46, 8)) - -var [,,, c9] = [1, 2, 3, 4]; ->c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 47, 8)) - -var [,,,...c10] = [1, 2, 3, 4, "hello"]; ->c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 48, 8)) - -var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 5)) ->c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 9)) ->c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 14)) - -var [c14, c15, c16] = [1, 2, "string"]; ->c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 5)) ->c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 9)) ->c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 14)) - - diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types deleted file mode 100644 index adff61e407c..00000000000 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types +++ /dev/null @@ -1,177 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts === -/* AssignmentPattern: - * ObjectAssignmentPattern - * ArrayAssignmentPattern - * ArrayAssignmentPattern: - * [Elision AssignmentRestElementopt ] - * [AssignmentElementList] - * [AssignmentElementList, Elision AssignmentRestElementopt ] - * AssignmentElementList: - * Elision AssignmentElement - * AssignmentElementList, Elisionopt AssignmentElement - * AssignmentElement: - * LeftHandSideExpression Initialiseropt - * AssignmentPattern Initialiseropt - * AssignmentRestElement: - * ... LeftHandSideExpression - */ - -// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. -// An expression of type S is considered assignable to an assignment target V if one of the following is true - -// 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 the type Any, or - -var [a0, a1]: any = undefined; ->a0 : any ->a1 : any ->undefined : undefined - -var [a2 = false, a3 = 1]: any = undefined; ->a2 : boolean ->false : boolean ->a3 : number ->1 : number ->undefined : undefined - -// 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, -// where N is the numeric index of E in the array assignment pattern, or -var [b0, b1, b2] = [2, 3, 4]; ->b0 : number ->b1 : number ->b2 : number ->[2, 3, 4] : [number, number, number] ->2 : number ->3 : number ->4 : number - -var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; ->b3 : number ->b4 : number ->b5 : string ->[1, 2, "string"] : [number, number, string] ->1 : number ->2 : number ->"string" : string - -function foo() { ->foo : () => number[] - - return [1, 2, 3]; ->[1, 2, 3] : number[] ->1 : number ->2 : number ->3 : number -} - -var [b6, b7] = foo(); ->b6 : number ->b7 : number ->foo() : number[] ->foo : () => number[] - -var [...b8] = foo(); ->b8 : number[] ->foo() : number[] ->foo : () => number[] - -// 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] ->temp : number[] ->[1,2,3] : number[] ->1 : number ->2 : number ->3 : number - -var [c0, c1] = [...temp]; ->c0 : number ->c1 : number ->[...temp] : number[] ->...temp : number ->temp : number[] - -var [c2] = []; ->c2 : any ->[] : undefined[] - -var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] ->c3 : any ->c4 : any ->[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]] ->[[]] : [undefined[]] ->[] : undefined[] ->[[[[]]]] : [[[undefined[]]]] ->[[[]]] : [[undefined[]]] ->[[]] : [undefined[]] ->[] : undefined[] - -var [[c5], c6]: [[string|number], boolean] = [[1], true]; ->c5 : string | number ->c6 : boolean ->[[1], true] : [[number], boolean] ->[1] : [number] ->1 : number ->true : boolean - -var [, c7] = [1, 2, 3]; -> : undefined ->c7 : number ->[1, 2, 3] : [number, number, number] ->1 : number ->2 : number ->3 : number - -var [,,, c8] = [1, 2, 3, 4]; -> : undefined -> : undefined -> : undefined ->c8 : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number - -var [,,, c9] = [1, 2, 3, 4]; -> : undefined -> : undefined -> : undefined ->c9 : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number - -var [,,,...c10] = [1, 2, 3, 4, "hello"]; -> : undefined -> : undefined -> : undefined ->c10 : (number | string)[] ->[1, 2, 3, 4, "hello"] : (number | string)[] ->1 : number ->2 : number ->3 : number ->4 : number ->"hello" : string - -var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : number | string ->c12 : number | string ->c13 : (number | string)[] ->[1, 2, "string"] : (number | string)[] ->1 : number ->2 : number ->"string" : string - -var [c14, c15, c16] = [1, 2, "string"]; ->c14 : number ->c15 : number ->c16 : string ->[1, 2, "string"] : [number, number, string] ->1 : number ->2 : number ->"string" : string - - diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.errors.txt new file mode 100644 index 00000000000..beefbc9a85b --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + +==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts (3 errors) ==== + + /* AssignmentPattern: + * ObjectAssignmentPattern + * ArrayAssignmentPattern + * ArrayAssignmentPattern: + * [Elision AssignmentRestElementopt ] + * [AssignmentElementList] + * [AssignmentElementList, Elision AssignmentRestElementopt ] + * AssignmentElementList: + * Elision AssignmentElement + * AssignmentElementList, Elisionopt AssignmentElement + * AssignmentElement: + * LeftHandSideExpression Initialiseropt + * AssignmentPattern Initialiseropt + * AssignmentRestElement: + * ... LeftHandSideExpression + */ + + // In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. + // An expression of type S is considered assignable to an assignment target V if one of the following is true + + // 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 the type Any, or + + var [a0, a1]: any = undefined; + var [a2 = false, a3 = 1]: any = undefined; + + // 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, + // where N is the numeric index of E in the array assignment pattern, or + var [b0, b1, b2] = [2, 3, 4]; + var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; + + function foo() { + return [1, 2, 3]; + } + + var [b6, b7] = foo(); + var [...b8] = foo(); + + // 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 [c0, c1] = [...temp]; + var [c2] = []; + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[c5], c6]: [[string|number], boolean] = [[1], true]; + var [, c7] = [1, 2, 3]; + var [,,, c8] = [1, 2, 3, 4]; + var [,,, c9] = [1, 2, 3, 4]; + var [,,,...c10] = [1, 2, 3, 4, "hello"]; + var [c11, c12, ...c13] = [1, 2, "string"]; + var [c14, c15, c16] = [1, 2, "string"]; \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.symbols b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.symbols deleted file mode 100644 index 33f9b4e88be..00000000000 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.symbols +++ /dev/null @@ -1,105 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts === - -/* AssignmentPattern: - * ObjectAssignmentPattern - * ArrayAssignmentPattern - * ArrayAssignmentPattern: - * [Elision AssignmentRestElementopt ] - * [AssignmentElementList] - * [AssignmentElementList, Elision AssignmentRestElementopt ] - * AssignmentElementList: - * Elision AssignmentElement - * AssignmentElementList, Elisionopt AssignmentElement - * AssignmentElement: - * LeftHandSideExpression Initialiseropt - * AssignmentPattern Initialiseropt - * AssignmentRestElement: - * ... LeftHandSideExpression - */ - -// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. -// An expression of type S is considered assignable to an assignment target V if one of the following is true - -// 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 the type Any, or - -var [a0, a1]: any = undefined; ->a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 5)) ->a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 8)) ->undefined : Symbol(undefined) - -var [a2 = false, a3 = 1]: any = undefined; ->a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 5)) ->a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 16)) ->undefined : Symbol(undefined) - -// 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, -// where N is the numeric index of E in the array assignment pattern, or -var [b0, b1, b2] = [2, 3, 4]; ->b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 5)) ->b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 8)) ->b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 12)) - -var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; ->b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 5)) ->b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 8)) ->b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 12)) - -function foo() { ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62)) - - return [1, 2, 3]; -} - -var [b6, b7] = foo(); ->b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 5)) ->b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 8)) ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62)) - -var [...b8] = foo(); ->b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 38, 5)) ->foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62)) - -// 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] ->temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3)) - -var [c0, c1] = [...temp]; ->c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 5)) ->c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 8)) ->temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3)) - -var [c2] = []; ->c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 43, 5)) - -var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] ->c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 7)) ->c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 17)) - -var [[c5], c6]: [[string|number], boolean] = [[1], true]; ->c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 6)) ->c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 10)) - -var [, c7] = [1, 2, 3]; ->c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 46, 6)) - -var [,,, c8] = [1, 2, 3, 4]; ->c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 47, 8)) - -var [,,, c9] = [1, 2, 3, 4]; ->c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 48, 8)) - -var [,,,...c10] = [1, 2, 3, 4, "hello"]; ->c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 49, 8)) - -var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 5)) ->c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 9)) ->c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 14)) - -var [c14, c15, c16] = [1, 2, "string"]; ->c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 5)) ->c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 9)) ->c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 14)) - diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types deleted file mode 100644 index 0a9e75a8aed..00000000000 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types +++ /dev/null @@ -1,177 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts === - -/* AssignmentPattern: - * ObjectAssignmentPattern - * ArrayAssignmentPattern - * ArrayAssignmentPattern: - * [Elision AssignmentRestElementopt ] - * [AssignmentElementList] - * [AssignmentElementList, Elision AssignmentRestElementopt ] - * AssignmentElementList: - * Elision AssignmentElement - * AssignmentElementList, Elisionopt AssignmentElement - * AssignmentElement: - * LeftHandSideExpression Initialiseropt - * AssignmentPattern Initialiseropt - * AssignmentRestElement: - * ... LeftHandSideExpression - */ - -// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. -// An expression of type S is considered assignable to an assignment target V if one of the following is true - -// 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 the type Any, or - -var [a0, a1]: any = undefined; ->a0 : any ->a1 : any ->undefined : undefined - -var [a2 = false, a3 = 1]: any = undefined; ->a2 : boolean ->false : boolean ->a3 : number ->1 : number ->undefined : undefined - -// 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 a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, -// where N is the numeric index of E in the array assignment pattern, or -var [b0, b1, b2] = [2, 3, 4]; ->b0 : number ->b1 : number ->b2 : number ->[2, 3, 4] : [number, number, number] ->2 : number ->3 : number ->4 : number - -var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; ->b3 : number ->b4 : number ->b5 : string ->[1, 2, "string"] : [number, number, string] ->1 : number ->2 : number ->"string" : string - -function foo() { ->foo : () => number[] - - return [1, 2, 3]; ->[1, 2, 3] : number[] ->1 : number ->2 : number ->3 : number -} - -var [b6, b7] = foo(); ->b6 : number ->b7 : number ->foo() : number[] ->foo : () => number[] - -var [...b8] = foo(); ->b8 : number[] ->foo() : number[] ->foo : () => number[] - -// 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] ->temp : number[] ->[1,2,3] : number[] ->1 : number ->2 : number ->3 : number - -var [c0, c1] = [...temp]; ->c0 : number ->c1 : number ->[...temp] : number[] ->...temp : number ->temp : number[] - -var [c2] = []; ->c2 : any ->[] : undefined[] - -var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] ->c3 : any ->c4 : any ->[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]] ->[[]] : [undefined[]] ->[] : undefined[] ->[[[[]]]] : [[[undefined[]]]] ->[[[]]] : [[undefined[]]] ->[[]] : [undefined[]] ->[] : undefined[] - -var [[c5], c6]: [[string|number], boolean] = [[1], true]; ->c5 : string | number ->c6 : boolean ->[[1], true] : [[number], boolean] ->[1] : [number] ->1 : number ->true : boolean - -var [, c7] = [1, 2, 3]; -> : undefined ->c7 : number ->[1, 2, 3] : [number, number, number] ->1 : number ->2 : number ->3 : number - -var [,,, c8] = [1, 2, 3, 4]; -> : undefined -> : undefined -> : undefined ->c8 : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number - -var [,,, c9] = [1, 2, 3, 4]; -> : undefined -> : undefined -> : undefined ->c9 : number ->[1, 2, 3, 4] : [number, number, number, number] ->1 : number ->2 : number ->3 : number ->4 : number - -var [,,,...c10] = [1, 2, 3, 4, "hello"]; -> : undefined -> : undefined -> : undefined ->c10 : (number | string)[] ->[1, 2, 3, 4, "hello"] : (number | string)[] ->1 : number ->2 : number ->3 : number ->4 : number ->"hello" : string - -var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : number | string ->c12 : number | string ->c13 : (number | string)[] ->[1, 2, "string"] : (number | string)[] ->1 : number ->2 : number ->"string" : string - -var [c14, c15, c16] = [1, 2, "string"]; ->c14 : number ->c15 : number ->c16 : string ->[1, 2, "string"] : [number, number, string] ->1 : number ->2 : number ->"string" : string - diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt index a2e5cb7e17c..91405285973 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2461: Type 'undefined' is not an array type. -tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'. Types of property '1' are incompatible. @@ -18,9 +18,9 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss // S is the type Any, or var [[a0], [[a1]]] = [] // Error ~~~~ -!!! error TS2461: Type 'undefined' is not an array type. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. ~~~~~~ -!!! error TS2461: Type 'undefined' is not an array type. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var [[a2], [[a3]]] = undefined // Error ~~~~~~~~~~~~~~ !!! error TS2461: Type 'undefined' is not an array type. diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types index f44adab359f..476b5bee0cc 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.types @@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } }; >{ b21: "string" } : { b21: string; } >b21 : string >"string" : string ->{ b2: { b21: "world" } } : { b2: { b21: string; }; } +>{ b2: { b21: "world" } } : { b2?: { b21: string; }; } >b2 : { b21: string; } >{ b21: "world" } : { b21: string; } >b21 : string diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types index 47d4474b63e..7a7f631eddf 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES6.types @@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } }; >{ b21: "string" } : { b21: string; } >b21 : string >"string" : string ->{ b2: { b21: "world" } } : { b2: { b21: string; }; } +>{ b2: { b21: "world" } } : { b2?: { b21: string; }; } >b2 : { b21: string; } >{ b21: "world" } : { b21: string; } >b21 : string diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.errors.txt b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.errors.txt index 9025f24f992..bb4b79987e3 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.errors.txt +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.errors.txt @@ -3,14 +3,18 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs Type '{ i: number; }' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,6): error TS2459: Type 'string | number' has no property 'i' and no string index signature. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(4,6): error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature. -tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,21): error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(6,7): error TS1180: Property destructuring pattern expected. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,5): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,11): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,24): error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,7): error TS1005: ':' expected. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,15): error TS1005: ':' expected. tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(10,12): error TS1005: ':' expected. -==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (9 errors) ==== +==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (13 errors) ==== // Error var {h?} = { h?: 1 }; ~ @@ -26,11 +30,19 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs !!! error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature. var { f2: {f21} = { f212: "string" } }: any = undefined; ~~~ -!!! error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature. +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~~~ +!!! error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'. var { ...d1 } = { ~~~ !!! error TS1180: Property destructuring pattern expected. a: 1, b: 1, d1: 9, e: 10 + ~ +!!! error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'. } var {1} = { 1 }; ~ diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types index a0630fee995..f8188147a79 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types @@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } }; >{ b11: "string" } : { b11: string; } >b11 : string >"string" : string ->{ b1: { b11: "world" } } : { b1: { b11: string; }; } +>{ b1: { b11: "world" } } : { b1?: { b11: string; }; } >b1 : { b11: string; } >{ b11: "world" } : { b11: string; } >b11 : string @@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] }; >f4 : number >f5 : number > : undefined ->{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; } ->f : [number, number, { f3: number; f5: number; }] ->[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }] +>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; } +>f : [number, number, { f3: number; f5: number; }, any] +>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any] >1 : number >2 : number >{ f3: 4, f5: 0 } : { f3: number; f5: number; } diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types index f9faf519b0a..7b4fe5409db 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types @@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } }; >{ b11: "string" } : { b11: string; } >b11 : string >"string" : string ->{ b1: { b11: "world" } } : { b1: { b11: string; }; } +>{ b1: { b11: "world" } } : { b1?: { b11: string; }; } >b1 : { b11: string; } >{ b11: "world" } : { b11: string; } >b11 : string @@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] }; >f4 : number >f5 : number > : undefined ->{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; } ->f : [number, number, { f3: number; f5: number; }] ->[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }] +>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; } +>f : [number, number, { f3: number; f5: number; }, any] +>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any] >1 : number >2 : number >{ f3: 4, f5: 0 } : { f3: number; f5: number; } diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.js b/tests/baselines/reference/destructuringWithLiteralInitializers.js new file mode 100644 index 00000000000..740648b04e8 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.js @@ -0,0 +1,147 @@ +//// [destructuringWithLiteralInitializers.ts] +// (arg: { x: any, y: any }) => void +function f1({ x, y }) { } +f1({ x: 1, y: 1 }); + +// (arg: { x: any, y?: number }) => void +function f2({ x, y = 0 }) { } +f2({ x: 1 }); +f2({ x: 1, y: 1 }); + +// (arg: { x?: number, y?: number }) => void +function f3({ x = 0, y = 0 }) { } +f3({}); +f3({ x: 1 }); +f3({ y: 1 }); +f3({ x: 1, y: 1 }); + +// (arg?: { x: number, y: number }) => void +function f4({ x, y } = { x: 0, y: 0 }) { } +f4(); +f4({ x: 1, y: 1 }); + +// (arg?: { x: number, y?: number }) => void +function f5({ x, y = 0 } = { x: 0 }) { } +f5(); +f5({ x: 1 }); +f5({ x: 1, y: 1 }); + +// (arg?: { x?: number, y?: number }) => void +function f6({ x = 0, y = 0 } = {}) { } +f6(); +f6({}); +f6({ x: 1 }); +f6({ y: 1 }); +f6({ x: 1, y: 1 }); + +// (arg?: { a: { x?: number, y?: number } }) => void +function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } +f7(); +f7({ a: {} }); +f7({ a: { x: 1 } }); +f7({ a: { y: 1 } }); +f7({ a: { x: 1, y: 1 } }); + +// (arg: [any, any]) => void +function g1([x, y]) { } +g1([1, 1]); + +// (arg: [number, number]) => void +function g2([x = 0, y = 0]) { } +g2([1, 1]); + +// (arg?: [number, number]) => void +function g3([x, y] = [0, 0]) { } +g3(); +g3([1, 1]); + +// (arg?: [number, number]) => void +function g4([x, y = 0] = [0]) { } +g4(); +g4([1, 1]); + +// (arg?: [number, number]) => void +function g5([x = 0, y = 0] = []) { } +g5(); +g5([1, 1]); + + +//// [destructuringWithLiteralInitializers.js] +// (arg: { x: any, y: any }) => void +function f1(_a) { + var x = _a.x, y = _a.y; +} +f1({ x: 1, y: 1 }); +// (arg: { x: any, y?: number }) => void +function f2(_a) { + var x = _a.x, _b = _a.y, y = _b === void 0 ? 0 : _b; +} +f2({ x: 1 }); +f2({ x: 1, y: 1 }); +// (arg: { x?: number, y?: number }) => void +function f3(_a) { + var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c; +} +f3({}); +f3({ x: 1 }); +f3({ y: 1 }); +f3({ x: 1, y: 1 }); +// (arg?: { x: number, y: number }) => void +function f4(_a) { + var _b = _a === void 0 ? { x: 0, y: 0 } : _a, x = _b.x, y = _b.y; +} +f4(); +f4({ x: 1, y: 1 }); +// (arg?: { x: number, y?: number }) => void +function f5(_a) { + var _b = _a === void 0 ? { x: 0 } : _a, x = _b.x, _c = _b.y, y = _c === void 0 ? 0 : _c; +} +f5(); +f5({ x: 1 }); +f5({ x: 1, y: 1 }); +// (arg?: { x?: number, y?: number }) => void +function f6(_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d; +} +f6(); +f6({}); +f6({ x: 1 }); +f6({ y: 1 }); +f6({ x: 1, y: 1 }); +// (arg?: { a: { x?: number, y?: number } }) => void +function f7(_a) { + var _b = (_a === void 0 ? { a: {} } : _a).a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d; +} +f7(); +f7({ a: {} }); +f7({ a: { x: 1 } }); +f7({ a: { y: 1 } }); +f7({ a: { x: 1, y: 1 } }); +// (arg: [any, any]) => void +function g1(_a) { + var x = _a[0], y = _a[1]; +} +g1([1, 1]); +// (arg: [number, number]) => void +function g2(_a) { + var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 0 : _c; +} +g2([1, 1]); +// (arg?: [number, number]) => void +function g3(_a) { + var _b = _a === void 0 ? [0, 0] : _a, x = _b[0], y = _b[1]; +} +g3(); +g3([1, 1]); +// (arg?: [number, number]) => void +function g4(_a) { + var _b = _a === void 0 ? [0] : _a, x = _b[0], _c = _b[1], y = _c === void 0 ? 0 : _c; +} +g4(); +g4([1, 1]); +// (arg?: [number, number]) => void +function g5(_a) { + var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 0 : _d; +} +g5(); +g5([1, 1]); diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.symbols b/tests/baselines/reference/destructuringWithLiteralInitializers.symbols new file mode 100644 index 00000000000..1141fc140c7 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.symbols @@ -0,0 +1,194 @@ +=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts === +// (arg: { x: any, y: any }) => void +function f1({ x, y }) { } +>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 1, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 1, 16)) + +f1({ x: 1, y: 1 }); +>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 2, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 2, 10)) + +// (arg: { x: any, y?: number }) => void +function f2({ x, y = 0 }) { } +>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 5, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 5, 16)) + +f2({ x: 1 }); +>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 6, 4)) + +f2({ x: 1, y: 1 }); +>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 7, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 7, 10)) + +// (arg: { x?: number, y?: number }) => void +function f3({ x = 0, y = 0 }) { } +>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 10, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 10, 20)) + +f3({}); +>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19)) + +f3({ x: 1 }); +>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 12, 4)) + +f3({ y: 1 }); +>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 13, 4)) + +f3({ x: 1, y: 1 }); +>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 14, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 14, 10)) + +// (arg?: { x: number, y: number }) => void +function f4({ x, y } = { x: 0, y: 0 }) { } +>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 16)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 24)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 30)) + +f4(); +>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19)) + +f4({ x: 1, y: 1 }); +>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 19, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 19, 10)) + +// (arg?: { x: number, y?: number }) => void +function f5({ x, y = 0 } = { x: 0 }) { } +>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 22, 16)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 28)) + +f5(); +>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19)) + +f5({ x: 1 }); +>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 24, 4)) + +f5({ x: 1, y: 1 }); +>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 25, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 25, 10)) + +// (arg?: { x?: number, y?: number }) => void +function f6({ x = 0, y = 0 } = {}) { } +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 28, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 28, 20)) + +f6(); +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) + +f6({}); +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) + +f6({ x: 1 }); +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 31, 4)) + +f6({ y: 1 }); +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 32, 4)) + +f6({ x: 1, y: 1 }); +>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 33, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 33, 10)) + +// (arg?: { a: { x?: number, y?: number } }) => void +function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 36, 18)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 36, 25)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39)) + +f7(); +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) + +f7({ a: {} }); +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 38, 4)) + +f7({ a: { x: 1 } }); +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 39, 4)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 39, 9)) + +f7({ a: { y: 1 } }); +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 40, 4)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 40, 9)) + +f7({ a: { x: 1, y: 1 } }); +>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19)) +>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 41, 4)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 41, 9)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 41, 15)) + +// (arg: [any, any]) => void +function g1([x, y]) { } +>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 44, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 44, 15)) + +g1([1, 1]); +>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26)) + +// (arg: [number, number]) => void +function g2([x = 0, y = 0]) { } +>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 48, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 48, 19)) + +g2([1, 1]); +>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11)) + +// (arg?: [number, number]) => void +function g3([x, y] = [0, 0]) { } +>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 52, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 52, 15)) + +g3(); +>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11)) + +g3([1, 1]); +>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11)) + +// (arg?: [number, number]) => void +function g4([x, y = 0] = [0]) { } +>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 57, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 57, 15)) + +g4(); +>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11)) + +g4([1, 1]); +>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11)) + +// (arg?: [number, number]) => void +function g5([x = 0, y = 0] = []) { } +>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 62, 13)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 62, 19)) + +g5(); +>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11)) + +g5([1, 1]); +>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11)) + diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.types b/tests/baselines/reference/destructuringWithLiteralInitializers.types new file mode 100644 index 00000000000..da1e4bfd6f3 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.types @@ -0,0 +1,310 @@ +=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts === +// (arg: { x: any, y: any }) => void +function f1({ x, y }) { } +>f1 : ({ x, y }: { x: any; y: any; }) => void +>x : any +>y : any + +f1({ x: 1, y: 1 }); +>f1({ x: 1, y: 1 }) : void +>f1 : ({ x, y }: { x: any; y: any; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg: { x: any, y?: number }) => void +function f2({ x, y = 0 }) { } +>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>x : any +>y : number +>0 : number + +f2({ x: 1 }); +>f2({ x: 1 }) : void +>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>{ x: 1 } : { x: number; } +>x : number +>1 : number + +f2({ x: 1, y: 1 }); +>f2({ x: 1, y: 1 }) : void +>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg: { x?: number, y?: number }) => void +function f3({ x = 0, y = 0 }) { } +>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>x : number +>0 : number +>y : number +>0 : number + +f3({}); +>f3({}) : void +>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>{} : {} + +f3({ x: 1 }); +>f3({ x: 1 }) : void +>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>{ x: 1 } : { x: number; } +>x : number +>1 : number + +f3({ y: 1 }); +>f3({ y: 1 }) : void +>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>{ y: 1 } : { y: number; } +>y : number +>1 : number + +f3({ x: 1, y: 1 }); +>f3({ x: 1, y: 1 }) : void +>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg?: { x: number, y: number }) => void +function f4({ x, y } = { x: 0, y: 0 }) { } +>f4 : ({ x, y }?: { x: number; y: number; }) => void +>x : number +>y : number +>{ x: 0, y: 0 } : { x: number; y: number; } +>x : number +>0 : number +>y : number +>0 : number + +f4(); +>f4() : void +>f4 : ({ x, y }?: { x: number; y: number; }) => void + +f4({ x: 1, y: 1 }); +>f4({ x: 1, y: 1 }) : void +>f4 : ({ x, y }?: { x: number; y: number; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg?: { x: number, y?: number }) => void +function f5({ x, y = 0 } = { x: 0 }) { } +>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>x : number +>y : number +>0 : number +>{ x: 0 } : { x: number; y?: number; } +>x : number +>0 : number + +f5(); +>f5() : void +>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void + +f5({ x: 1 }); +>f5({ x: 1 }) : void +>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>{ x: 1 } : { x: number; } +>x : number +>1 : number + +f5({ x: 1, y: 1 }); +>f5({ x: 1, y: 1 }) : void +>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg?: { x?: number, y?: number }) => void +function f6({ x = 0, y = 0 } = {}) { } +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>x : number +>0 : number +>y : number +>0 : number +>{} : { x?: number; y?: number; } + +f6(); +>f6() : void +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void + +f6({}); +>f6({}) : void +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>{} : {} + +f6({ x: 1 }); +>f6({ x: 1 }) : void +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>{ x: 1 } : { x: number; } +>x : number +>1 : number + +f6({ y: 1 }); +>f6({ y: 1 }) : void +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>{ y: 1 } : { y: number; } +>y : number +>1 : number + +f6({ x: 1, y: 1 }); +>f6({ x: 1, y: 1 }) : void +>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg?: { a: { x?: number, y?: number } }) => void +function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>a : any +>x : number +>0 : number +>y : number +>0 : number +>{ a: {} } : { a: { x?: number; y?: number; }; } +>a : { x?: number; y?: number; } +>{} : { x?: number; y?: number; } + +f7(); +>f7() : void +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void + +f7({ a: {} }); +>f7({ a: {} }) : void +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>{ a: {} } : { a: {}; } +>a : {} +>{} : {} + +f7({ a: { x: 1 } }); +>f7({ a: { x: 1 } }) : void +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>{ a: { x: 1 } } : { a: { x: number; }; } +>a : { x: number; } +>{ x: 1 } : { x: number; } +>x : number +>1 : number + +f7({ a: { y: 1 } }); +>f7({ a: { y: 1 } }) : void +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>{ a: { y: 1 } } : { a: { y: number; }; } +>a : { y: number; } +>{ y: 1 } : { y: number; } +>y : number +>1 : number + +f7({ a: { x: 1, y: 1 } }); +>f7({ a: { x: 1, y: 1 } }) : void +>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void +>{ a: { x: 1, y: 1 } } : { a: { x: number; y: number; }; } +>a : { x: number; y: number; } +>{ x: 1, y: 1 } : { x: number; y: number; } +>x : number +>1 : number +>y : number +>1 : number + +// (arg: [any, any]) => void +function g1([x, y]) { } +>g1 : ([x, y]: [any, any]) => void +>x : any +>y : any + +g1([1, 1]); +>g1([1, 1]) : void +>g1 : ([x, y]: [any, any]) => void +>[1, 1] : [number, number] +>1 : number +>1 : number + +// (arg: [number, number]) => void +function g2([x = 0, y = 0]) { } +>g2 : ([x = 0, y = 0]: [number, number]) => void +>x : number +>0 : number +>y : number +>0 : number + +g2([1, 1]); +>g2([1, 1]) : void +>g2 : ([x = 0, y = 0]: [number, number]) => void +>[1, 1] : [number, number] +>1 : number +>1 : number + +// (arg?: [number, number]) => void +function g3([x, y] = [0, 0]) { } +>g3 : ([x, y]?: [number, number]) => void +>x : number +>y : number +>[0, 0] : [number, number] +>0 : number +>0 : number + +g3(); +>g3() : void +>g3 : ([x, y]?: [number, number]) => void + +g3([1, 1]); +>g3([1, 1]) : void +>g3 : ([x, y]?: [number, number]) => void +>[1, 1] : [number, number] +>1 : number +>1 : number + +// (arg?: [number, number]) => void +function g4([x, y = 0] = [0]) { } +>g4 : ([x, y = 0]?: [number, number]) => void +>x : number +>y : number +>0 : number +>[0] : [number, number] +>0 : number + +g4(); +>g4() : void +>g4 : ([x, y = 0]?: [number, number]) => void + +g4([1, 1]); +>g4([1, 1]) : void +>g4 : ([x, y = 0]?: [number, number]) => void +>[1, 1] : [number, number] +>1 : number +>1 : number + +// (arg?: [number, number]) => void +function g5([x = 0, y = 0] = []) { } +>g5 : ([x = 0, y = 0]?: [number, number]) => void +>x : number +>0 : number +>y : number +>0 : number +>[] : [number, number] + +g5(); +>g5() : void +>g5 : ([x = 0, y = 0]?: [number, number]) => void + +g5([1, 1]); +>g5([1, 1]) : void +>g5 : ([x = 0, y = 0]?: [number, number]) => void +>[1, 1] : [number, number] +>1 : number +>1 : number + diff --git a/tests/baselines/reference/doNotEmitDetachedComments.js b/tests/baselines/reference/doNotEmitDetachedComments.js new file mode 100644 index 00000000000..74acb537fa8 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedComments.js @@ -0,0 +1,33 @@ +//// [doNotEmitDetachedComments.ts] +/* + + multi line + comment +*/ + +var x = 10; + +// Single Line comment + +function foo() { } + + +/* + multi-line comment + +*/ + + +//======================== + + +function bar() { } + + +//======================== + + +//// [doNotEmitDetachedComments.js] +var x = 10; +function foo() { } +function bar() { } diff --git a/tests/baselines/reference/doNotEmitDetachedComments.symbols b/tests/baselines/reference/doNotEmitDetachedComments.symbols new file mode 100644 index 00000000000..c718da7bb9a --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedComments.symbols @@ -0,0 +1,31 @@ +=== tests/cases/compiler/doNotEmitDetachedComments.ts === +/* + + multi line + comment +*/ + +var x = 10; +>x : Symbol(x, Decl(doNotEmitDetachedComments.ts, 6, 3)) + +// Single Line comment + +function foo() { } +>foo : Symbol(foo, Decl(doNotEmitDetachedComments.ts, 6, 11)) + + +/* + multi-line comment + +*/ + + +//======================== + + +function bar() { } +>bar : Symbol(bar, Decl(doNotEmitDetachedComments.ts, 10, 18)) + + +//======================== + diff --git a/tests/baselines/reference/doNotEmitDetachedComments.types b/tests/baselines/reference/doNotEmitDetachedComments.types new file mode 100644 index 00000000000..d9b5f0634c2 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedComments.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/doNotEmitDetachedComments.ts === +/* + + multi line + comment +*/ + +var x = 10; +>x : number +>10 : number + +// Single Line comment + +function foo() { } +>foo : () => void + + +/* + multi-line comment + +*/ + + +//======================== + + +function bar() { } +>bar : () => void + + +//======================== + diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js new file mode 100644 index 00000000000..ba6dbf8b743 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js @@ -0,0 +1,64 @@ +//// [doNotEmitDetachedCommentsAtStartOfConstructor.ts] +class A { + constructor() { + // Single Line Comment + + var x = 10; + } +} + +class B { + constructor() { + /* + Multi-line comment + */ + + var y = 10; + } +} + +class C { + constructor() { + // Single Line Comment with more than one blank line + + + var x = 10; + } +} + +class D { + constructor() { + /* + Multi-line comment with more than one blank line + */ + + + var y = 10; + } +} + +//// [doNotEmitDetachedCommentsAtStartOfConstructor.js] +var A = (function () { + function A() { + var x = 10; + } + return A; +})(); +var B = (function () { + function B() { + var y = 10; + } + return B; +})(); +var C = (function () { + function C() { + var x = 10; + } + return C; +})(); +var D = (function () { + function D() { + var y = 10; + } + return D; +})(); diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols new file mode 100644 index 00000000000..d7c4f5b2ca9 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols @@ -0,0 +1,50 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts === +class A { +>A : Symbol(A, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 0, 0)) + + constructor() { + // Single Line Comment + + var x = 10; +>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 4, 11)) + } +} + +class B { +>B : Symbol(B, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 6, 1)) + + constructor() { + /* + Multi-line comment + */ + + var y = 10; +>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 14, 11)) + } +} + +class C { +>C : Symbol(C, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 16, 1)) + + constructor() { + // Single Line Comment with more than one blank line + + + var x = 10; +>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 23, 11)) + } +} + +class D { +>D : Symbol(D, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 25, 1)) + + constructor() { + /* + Multi-line comment with more than one blank line + */ + + + var y = 10; +>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 34, 11)) + } +} diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types new file mode 100644 index 00000000000..c316c6403c0 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts === +class A { +>A : A + + constructor() { + // Single Line Comment + + var x = 10; +>x : number +>10 : number + } +} + +class B { +>B : B + + constructor() { + /* + Multi-line comment + */ + + var y = 10; +>y : number +>10 : number + } +} + +class C { +>C : C + + constructor() { + // Single Line Comment with more than one blank line + + + var x = 10; +>x : number +>10 : number + } +} + +class D { +>D : D + + constructor() { + /* + Multi-line comment with more than one blank line + */ + + + var y = 10; +>y : number +>10 : number + } +} diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js new file mode 100644 index 00000000000..dbd0f0be783 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js @@ -0,0 +1,48 @@ +//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.ts] +function foo1() { + // Single line comment + + return 42; +} + +function foo2() { + /* + + multi line + comment + */ + + return 42; +} + +function foo3() { + // Single line comment with more than one blank line + + + return 42; +} + +function foo4() { + /* + + multi line comment with more than one blank line + */ + + return 42; +} + + + +//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.js] +function foo1() { + return 42; +} +function foo2() { + return 42; +} +function foo3() { + return 42; +} +function foo4() { + return 42; +} diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols new file mode 100644 index 00000000000..c1680100369 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols @@ -0,0 +1,42 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts === +function foo1() { +>foo1 : Symbol(foo1, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 0, 0)) + + // Single line comment + + return 42; +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 4, 1)) + + /* + + multi line + comment + */ + + return 42; +} + +function foo3() { +>foo3 : Symbol(foo3, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 14, 1)) + + // Single line comment with more than one blank line + + + return 42; +} + +function foo4() { +>foo4 : Symbol(foo4, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 21, 1)) + + /* + + multi line comment with more than one blank line + */ + + return 42; +} + + diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types new file mode 100644 index 00000000000..3b4814bbbb2 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts === +function foo1() { +>foo1 : () => number + + // Single line comment + + return 42; +>42 : number +} + +function foo2() { +>foo2 : () => number + + /* + + multi line + comment + */ + + return 42; +>42 : number +} + +function foo3() { +>foo3 : () => number + + // Single line comment with more than one blank line + + + return 42; +>42 : number +} + +function foo4() { +>foo4 : () => number + + /* + + multi line comment with more than one blank line + */ + + return 42; +>42 : number +} + + diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js new file mode 100644 index 00000000000..7fd5c2b8f8e --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js @@ -0,0 +1,45 @@ +//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts] +() => { + // Single line comment + + return 0; +} + +() => { + /* + multi-line comment + */ + + return 0; +} + +() => { + // Single line comment with more than one blank line + + + return 0; +} + +() => { + /* + multi-line comment with more than one blank line + */ + + + return 0; +} + + +//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.js] +(function () { + return 0; +}); +(function () { + return 0; +}); +(function () { + return 0; +}); +(function () { + return 0; +}); diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols new file mode 100644 index 00000000000..e57fc793920 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts === +() => { +No type information for this code. // Single line comment +No type information for this code. +No type information for this code. return 0; +No type information for this code.} +No type information for this code. +No type information for this code.() => { +No type information for this code. /* +No type information for this code. multi-line comment +No type information for this code. */ +No type information for this code. +No type information for this code. return 0; +No type information for this code.} +No type information for this code. +No type information for this code.() => { +No type information for this code. // Single line comment with more than one blank line +No type information for this code. +No type information for this code. +No type information for this code. return 0; +No type information for this code.} +No type information for this code. +No type information for this code.() => { +No type information for this code. /* +No type information for this code. multi-line comment with more than one blank line +No type information for this code. */ +No type information for this code. +No type information for this code. +No type information for this code. return 0; +No type information for this code.} +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types new file mode 100644 index 00000000000..d90e93d84c5 --- /dev/null +++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts === +() => { +>() => { // Single line comment return 0;} : () => number + + // Single line comment + + return 0; +>0 : number +} + +() => { +>() => { /* multi-line comment */ return 0;} : () => number + + /* + multi-line comment + */ + + return 0; +>0 : number +} + +() => { +>() => { // Single line comment with more than one blank line return 0;} : () => number + + // Single line comment with more than one blank line + + + return 0; +>0 : number +} + +() => { +>() => { /* multi-line comment with more than one blank line */ return 0;} : () => number + + /* + multi-line comment with more than one blank line + */ + + + return 0; +>0 : number +} + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.js b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.js new file mode 100644 index 00000000000..8232ad66ef5 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.js @@ -0,0 +1,14 @@ +//// [doNotEmitPinnedCommentNotOnTopOfFile.ts] +var x = 10; + +/*! + + multi line + comment +*/ + +var x = 10; + +//// [doNotEmitPinnedCommentNotOnTopOfFile.js] +var x = 10; +var x = 10; diff --git a/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.symbols b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.symbols new file mode 100644 index 00000000000..97cfb5df214 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts === +var x = 10; +>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3)) + +/*! + + multi line + comment +*/ + +var x = 10; +>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3)) + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.types b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.types new file mode 100644 index 00000000000..3426c70dfb9 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentNotOnTopOfFile.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts === +var x = 10; +>x : number +>10 : number + +/*! + + multi line + comment +*/ + +var x = 10; +>x : number +>10 : number + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.js b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.js new file mode 100644 index 00000000000..99e50801d50 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.js @@ -0,0 +1,21 @@ +//// [doNotEmitPinnedCommentOnNotEmittedNode.ts] + +class C { + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) + public foo(x: string, y: number) { } +} + +var x = 10; + +/*! remove pinned comment anywhere else */ +declare var OData: any; + +//// [doNotEmitPinnedCommentOnNotEmittedNode.js] +var C = (function () { + function C() { + } + C.prototype.foo = function (x, y) { }; + return C; +})(); +var x = 10; diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols new file mode 100644 index 00000000000..64609266044 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNode.ts === + +class C { +>C : Symbol(C, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 0, 0)) + + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) +>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 3, 33)) +>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 3, 15)) +>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 3, 25)) + + public foo(x: string, y: number) { } +>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 3, 33)) +>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 4, 15)) +>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 4, 25)) +} + +var x = 10; +>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 7, 3)) + +/*! remove pinned comment anywhere else */ +declare var OData: any; +>OData : Symbol(OData, Decl(doNotEmitPinnedCommentOnNotEmittedNode.ts, 10, 11)) + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.types b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.types new file mode 100644 index 00000000000..b0f71137c2d --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNode.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNode.ts === + +class C { +>C : C + + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) +>foo : (x: string, y: any) => any +>x : string +>y : any + + public foo(x: string, y: number) { } +>foo : (x: string, y: any) => any +>x : string +>y : number +} + +var x = 10; +>x : number +>10 : number + +/*! remove pinned comment anywhere else */ +declare var OData: any; +>OData : any + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.js b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.js new file mode 100644 index 00000000000..66896350e6d --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.js @@ -0,0 +1,18 @@ +//// [doNotEmitPinnedCommentOnNotEmittedNodets.ts] + +class C { + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) + public foo(x: string, y: number) { } +} + +/*! remove pinned comment anywhere else */ +declare var OData: any; + +//// [doNotEmitPinnedCommentOnNotEmittedNodets.js] +var C = (function () { + function C() { + } + C.prototype.foo = function (x, y) { }; + return C; +})(); diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols new file mode 100644 index 00000000000..dcd27478115 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts === + +class C { +>C : Symbol(C, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 0, 0)) + + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) +>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) +>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 15)) +>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 25)) + + public foo(x: string, y: number) { } +>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33)) +>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 15)) +>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 25)) +} + +/*! remove pinned comment anywhere else */ +declare var OData: any; +>OData : Symbol(OData, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 8, 11)) + diff --git a/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.types b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.types new file mode 100644 index 00000000000..4369af63f53 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedCommentOnNotEmittedNodets.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts === + +class C { +>C : C + + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) +>foo : (x: string, y: any) => any +>x : string +>y : any + + public foo(x: string, y: number) { } +>foo : (x: string, y: any) => any +>x : string +>y : number +} + +/*! remove pinned comment anywhere else */ +declare var OData: any; +>OData : any + diff --git a/tests/baselines/reference/doNotEmitPinnedDetachedComments.js b/tests/baselines/reference/doNotEmitPinnedDetachedComments.js new file mode 100644 index 00000000000..5f5a3b19aaa --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedDetachedComments.js @@ -0,0 +1,42 @@ +//// [doNotEmitPinnedDetachedComments.ts] +var x = 10; + +/*! Single Line comment */ + +function baz() { } + + +/*! + multi-line comment + +*/ + + +//======================== + + +function bar() { + /*! + Remove this comment + */ + +} + +function foo() { + /*! Remove this */ + + return 0; +} + + +//======================== + + +//// [doNotEmitPinnedDetachedComments.js] +var x = 10; +function baz() { } +function bar() { +} +function foo() { + return 0; +} diff --git a/tests/baselines/reference/doNotEmitPinnedDetachedComments.symbols b/tests/baselines/reference/doNotEmitPinnedDetachedComments.symbols new file mode 100644 index 00000000000..2be35804b38 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedDetachedComments.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts === +var x = 10; +>x : Symbol(x, Decl(doNotEmitPinnedDetachedComments.ts, 0, 3)) + +/*! Single Line comment */ + +function baz() { } +>baz : Symbol(baz, Decl(doNotEmitPinnedDetachedComments.ts, 0, 11)) + + +/*! + multi-line comment + +*/ + + +//======================== + + +function bar() { +>bar : Symbol(bar, Decl(doNotEmitPinnedDetachedComments.ts, 4, 18)) + + /*! + Remove this comment + */ + +} + +function foo() { +>foo : Symbol(foo, Decl(doNotEmitPinnedDetachedComments.ts, 21, 1)) + + /*! Remove this */ + + return 0; +} + + +//======================== + diff --git a/tests/baselines/reference/doNotEmitPinnedDetachedComments.types b/tests/baselines/reference/doNotEmitPinnedDetachedComments.types new file mode 100644 index 00000000000..d9e78e2f980 --- /dev/null +++ b/tests/baselines/reference/doNotEmitPinnedDetachedComments.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts === +var x = 10; +>x : number +>10 : number + +/*! Single Line comment */ + +function baz() { } +>baz : () => void + + +/*! + multi-line comment + +*/ + + +//======================== + + +function bar() { +>bar : () => void + + /*! + Remove this comment + */ + +} + +function foo() { +>foo : () => number + + /*! Remove this */ + + return 0; +>0 : number +} + + +//======================== + diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js new file mode 100644 index 00000000000..f3b0888a78f --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts] //// + +//// [file0.ts] + + +//// [file1.ts] + +//// [file2.ts] +/// +/// +/// + +//// [file0.js] +//// [file1.js] +//// [file2.js] diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols new file mode 100644 index 00000000000..d18810db280 --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/file2.ts === +/// +No type information for this code./// +No type information for this code./// +No type information for this code.=== tests/cases/compiler/file0.ts === + +No type information for this code. +No type information for this code.=== tests/cases/compiler/file1.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types new file mode 100644 index 00000000000..d18810db280 --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/file2.ts === +/// +No type information for this code./// +No type information for this code./// +No type information for this code.=== tests/cases/compiler/file0.ts === + +No type information for this code. +No type information for this code.=== tests/cases/compiler/file1.ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.js b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.js new file mode 100644 index 00000000000..9067b5b80a9 --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/doNotEmitTripleSlashCommentsOnNotEmittedNode.ts] //// + +//// [file0.ts] + +/// +declare var OData: any; + +//// [file1.ts] +/// +interface F { } + + + +//// [file0.js] +//// [file1.js] diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.symbols b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.symbols new file mode 100644 index 00000000000..bb920d2ee1c --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === +/// +interface F { } +>F : Symbol(F, Decl(file1.ts, 0, 0)) + + +=== tests/cases/compiler/file0.ts === + +/// +declare var OData: any; +>OData : Symbol(OData, Decl(file0.ts, 2, 11)) + diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.types b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.types new file mode 100644 index 00000000000..59b63ea1a2f --- /dev/null +++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsOnNotEmittedNode.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === +/// +interface F { } +>F : F + + +=== tests/cases/compiler/file0.ts === + +/// +declare var OData: any; +>OData : any + diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.js b/tests/baselines/reference/doNotemitTripleSlashComments.js new file mode 100644 index 00000000000..fe17db54cb1 --- /dev/null +++ b/tests/baselines/reference/doNotemitTripleSlashComments.js @@ -0,0 +1,46 @@ +//// [tests/cases/compiler/doNotemitTripleSlashComments.ts] //// + +//// [file0.ts] + +/// +/// +/// +var x = 10; + +/// +var y = "hello"; + + +/// + +//// [file1.ts] +/// + +function foo() { } + + +/// + + +var z = "world"; + +//// [file2.ts] +/// + + +/// ==================================== + + +function bar() { } + + + + +//// [file0.js] +var x = 10; +var y = "hello"; +//// [file1.js] +function foo() { } +var z = "world"; +//// [file2.js] +function bar() { } diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.symbols b/tests/baselines/reference/doNotemitTripleSlashComments.symbols new file mode 100644 index 00000000000..36b31842f8b --- /dev/null +++ b/tests/baselines/reference/doNotemitTripleSlashComments.symbols @@ -0,0 +1,40 @@ +=== tests/cases/compiler/file2.ts === +/// + + +/// ==================================== + + +function bar() { } +>bar : Symbol(bar, Decl(file2.ts, 0, 0)) + + + +=== tests/cases/compiler/file0.ts === + +/// +/// +/// +var x = 10; +>x : Symbol(x, Decl(file0.ts, 4, 3)) + +/// +var y = "hello"; +>y : Symbol(y, Decl(file0.ts, 7, 3)) + + +/// + +=== tests/cases/compiler/file1.ts === +/// + +function foo() { } +>foo : Symbol(foo, Decl(file1.ts, 0, 0)) + + +/// + + +var z = "world"; +>z : Symbol(z, Decl(file1.ts, 8, 3)) + diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.types b/tests/baselines/reference/doNotemitTripleSlashComments.types new file mode 100644 index 00000000000..edebe5687f6 --- /dev/null +++ b/tests/baselines/reference/doNotemitTripleSlashComments.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/file2.ts === +/// + + +/// ==================================== + + +function bar() { } +>bar : () => void + + + +=== tests/cases/compiler/file0.ts === + +/// +/// +/// +var x = 10; +>x : number +>10 : number + +/// +var y = "hello"; +>y : string +>"hello" : string + + +/// + +=== tests/cases/compiler/file1.ts === +/// + +function foo() { } +>foo : () => void + + +/// + + +var z = "world"; +>z : string +>"world" : string + diff --git a/tests/baselines/reference/downlevelLetConst12.errors.txt b/tests/baselines/reference/downlevelLetConst12.errors.txt new file mode 100644 index 00000000000..0af224b017e --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst12.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/downlevelLetConst12.ts(7,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/downlevelLetConst12.ts(10,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + +==== tests/cases/compiler/downlevelLetConst12.ts (2 errors) ==== + + 'use strict' + // top level let\const should not be renamed + let foo; + const bar = 1; + + let [baz] = []; + ~~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + let {a: baz2} = { a: 1 }; + + const [baz3] = [] + ~~~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + const {a: baz4} = { a: 1 }; \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst12.symbols b/tests/baselines/reference/downlevelLetConst12.symbols deleted file mode 100644 index 97d6d5eebf8..00000000000 --- a/tests/baselines/reference/downlevelLetConst12.symbols +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst12.ts === - -'use strict' -// top level let\const should not be renamed -let foo; ->foo : Symbol(foo, Decl(downlevelLetConst12.ts, 3, 3)) - -const bar = 1; ->bar : Symbol(bar, Decl(downlevelLetConst12.ts, 4, 5)) - -let [baz] = []; ->baz : Symbol(baz, Decl(downlevelLetConst12.ts, 6, 5)) - -let {a: baz2} = { a: 1 }; ->a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17)) ->baz2 : Symbol(baz2, Decl(downlevelLetConst12.ts, 7, 5)) ->a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17)) - -const [baz3] = [] ->baz3 : Symbol(baz3, Decl(downlevelLetConst12.ts, 9, 7)) - -const {a: baz4} = { a: 1 }; ->a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19)) ->baz4 : Symbol(baz4, Decl(downlevelLetConst12.ts, 10, 7)) ->a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19)) - diff --git a/tests/baselines/reference/downlevelLetConst12.types b/tests/baselines/reference/downlevelLetConst12.types deleted file mode 100644 index 51d3b8eb086..00000000000 --- a/tests/baselines/reference/downlevelLetConst12.types +++ /dev/null @@ -1,35 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst12.ts === - -'use strict' ->'use strict' : string - -// top level let\const should not be renamed -let foo; ->foo : any - -const bar = 1; ->bar : number ->1 : number - -let [baz] = []; ->baz : any ->[] : undefined[] - -let {a: baz2} = { a: 1 }; ->a : any ->baz2 : number ->{ a: 1 } : { a: number; } ->a : number ->1 : number - -const [baz3] = [] ->baz3 : any ->[] : undefined[] - -const {a: baz4} = { a: 1 }; ->a : any ->baz4 : number ->{ a: 1 } : { a: number; } ->a : number ->1 : number - diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt index 94c53360b87..905d1a607e8 100644 --- a/tests/baselines/reference/downlevelLetConst16.errors.txt +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -1,10 +1,12 @@ +tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type. tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature. tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array type. tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature. -==== tests/cases/compiler/downlevelLetConst16.ts (4 errors) ==== +==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ==== 'use strict' declare function use(a: any); @@ -156,6 +158,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin use(x); } for (let [y] = []; ;) { + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. use(y); } for (let {a: z} = {a: 1}; ;) { @@ -169,6 +173,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin use(x); } for (const [y] = []; ;) { + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. use(y); } for (const {a: z} = { a: 1 }; ;) { diff --git a/tests/baselines/reference/elidingImportNames.js b/tests/baselines/reference/elidingImportNames.js index 3c61789a1a7..e07ee6fa54a 100644 --- a/tests/baselines/reference/elidingImportNames.js +++ b/tests/baselines/reference/elidingImportNames.js @@ -2,10 +2,10 @@ //// [elidingImportNames_test.ts] -import a = require('elidingImportNames_main'); // alias used in typeof +import a = require('./elidingImportNames_main'); // alias used in typeof var b = a; var x: typeof a; -import a2 = require('elidingImportNames_main1'); // alias not used in typeof +import a2 = require('./elidingImportNames_main1'); // alias not used in typeof var b2 = a2; @@ -20,8 +20,8 @@ exports.main = 10; //// [elidingImportNames_main1.js] exports.main = 10; //// [elidingImportNames_test.js] -var a = require('elidingImportNames_main'); // alias used in typeof +var a = require('./elidingImportNames_main'); // alias used in typeof var b = a; var x; -var a2 = require('elidingImportNames_main1'); // alias not used in typeof +var a2 = require('./elidingImportNames_main1'); // alias not used in typeof var b2 = a2; diff --git a/tests/baselines/reference/elidingImportNames.symbols b/tests/baselines/reference/elidingImportNames.symbols index 02646b5c3e2..d9cdcd61ffe 100644 --- a/tests/baselines/reference/elidingImportNames.symbols +++ b/tests/baselines/reference/elidingImportNames.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/elidingImportNames_test.ts === -import a = require('elidingImportNames_main'); // alias used in typeof +import a = require('./elidingImportNames_main'); // alias used in typeof >a : Symbol(a, Decl(elidingImportNames_test.ts, 0, 0)) var b = a; @@ -11,7 +11,7 @@ var x: typeof a; >x : Symbol(x, Decl(elidingImportNames_test.ts, 3, 3)) >a : Symbol(a, Decl(elidingImportNames_test.ts, 0, 0)) -import a2 = require('elidingImportNames_main1'); // alias not used in typeof +import a2 = require('./elidingImportNames_main1'); // alias not used in typeof >a2 : Symbol(a2, Decl(elidingImportNames_test.ts, 3, 16)) var b2 = a2; diff --git a/tests/baselines/reference/elidingImportNames.types b/tests/baselines/reference/elidingImportNames.types index 65bd16a6d97..947cd38f6d4 100644 --- a/tests/baselines/reference/elidingImportNames.types +++ b/tests/baselines/reference/elidingImportNames.types @@ -1,6 +1,6 @@ === tests/cases/compiler/elidingImportNames_test.ts === -import a = require('elidingImportNames_main'); // alias used in typeof +import a = require('./elidingImportNames_main'); // alias used in typeof >a : typeof a var b = a; @@ -11,7 +11,7 @@ var x: typeof a; >x : typeof a >a : typeof a -import a2 = require('elidingImportNames_main1'); // alias not used in typeof +import a2 = require('./elidingImportNames_main1'); // alias not used in typeof >a2 : typeof a2 var b2 = a2; diff --git a/tests/baselines/reference/emitArrowFunctionES6.types b/tests/baselines/reference/emitArrowFunctionES6.types index e2ad176fd7d..cc48cecd96a 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.types +++ b/tests/baselines/reference/emitArrowFunctionES6.types @@ -87,12 +87,12 @@ var p8 = ({ a = 1 }) => { }; >1 : number var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; ->p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void ->({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void +>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void +>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void >a : any >b : number >1 : number ->{ b: 1 } : { b: number; } +>{ b: 1 } : { b?: number; } >b : number >1 : number diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js new file mode 100644 index 00000000000..a30fcbf045d --- /dev/null +++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js @@ -0,0 +1,16 @@ +//// [emitPinnedCommentsOnTopOfFile.ts] +/*! + + multi line + comment +*/ + +var x = 10; + +//// [emitPinnedCommentsOnTopOfFile.js] +/*! + + multi line + comment +*/ +var x = 10; diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols new file mode 100644 index 00000000000..c9eb5905303 --- /dev/null +++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts === +/*! + + multi line + comment +*/ + +var x = 10; +>x : Symbol(x, Decl(emitPinnedCommentsOnTopOfFile.ts, 6, 3)) + diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types new file mode 100644 index 00000000000..0ada89e2802 --- /dev/null +++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts === +/*! + + multi line + comment +*/ + +var x = 10; +>x : number +>10 : number + diff --git a/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.js b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.js new file mode 100644 index 00000000000..ff358518568 --- /dev/null +++ b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.ts] //// + +//// [file0.ts] + +var x = 10 + +//// [file1.ts] +/// +declare var OData: any; + +/// +interface F { } + + + + +//// [file0.js] +var x = 10; +//// [file1.js] +/// diff --git a/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.symbols b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.symbols new file mode 100644 index 00000000000..1c0e48e00f2 --- /dev/null +++ b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === +/// +declare var OData: any; +>OData : Symbol(OData, Decl(file1.ts, 1, 11)) + +/// +interface F { } +>F : Symbol(F, Decl(file1.ts, 1, 23)) + + + +=== tests/cases/compiler/file0.ts === + +var x = 10 +>x : Symbol(x, Decl(file0.ts, 1, 3)) + diff --git a/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.types b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.types new file mode 100644 index 00000000000..637196fdc22 --- /dev/null +++ b/tests/baselines/reference/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/file1.ts === +/// +declare var OData: any; +>OData : any + +/// +interface F { } +>F : F + + + +=== tests/cases/compiler/file0.ts === + +var x = 10 +>x : number +>10 : number + diff --git a/tests/baselines/reference/emptyModuleName.errors.txt b/tests/baselines/reference/emptyModuleName.errors.txt new file mode 100644 index 00000000000..16f04b247ea --- /dev/null +++ b/tests/baselines/reference/emptyModuleName.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/emptyModuleName.ts(1,20): error TS2307: Cannot find module ''. + + +==== tests/cases/compiler/emptyModuleName.ts (1 errors) ==== + import * as A from ""; + ~~ +!!! error TS2307: Cannot find module ''. + class B extends A { + } \ No newline at end of file diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js new file mode 100644 index 00000000000..bb870f717c1 --- /dev/null +++ b/tests/baselines/reference/emptyModuleName.js @@ -0,0 +1,19 @@ +//// [emptyModuleName.ts] +import * as A from ""; +class B extends A { +} + +//// [emptyModuleName.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = require(""); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +})(A); diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.errors.txt b/tests/baselines/reference/emptyObjectBindingPatternParameter04.errors.txt new file mode 100644 index 00000000000..cf1b0e9a9a1 --- /dev/null +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter04.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,18): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,24): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts(3,32): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type '{}'. + + +==== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts (3 errors) ==== + + + function f({} = {a: 1, b: "2", c: true}) { + ~ +!!! error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'c' does not exist in type '{}'. + var x, y, z; + } \ No newline at end of file diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols b/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols deleted file mode 100644 index 9922d4cd074..00000000000 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts === - - -function f({} = {a: 1, b: "2", c: true}) { ->f : Symbol(f, Decl(emptyObjectBindingPatternParameter04.ts, 0, 0)) ->a : Symbol(a, Decl(emptyObjectBindingPatternParameter04.ts, 2, 17)) ->b : Symbol(b, Decl(emptyObjectBindingPatternParameter04.ts, 2, 22)) ->c : Symbol(c, Decl(emptyObjectBindingPatternParameter04.ts, 2, 30)) - - var x, y, z; ->x : Symbol(x, Decl(emptyObjectBindingPatternParameter04.ts, 3, 7)) ->y : Symbol(y, Decl(emptyObjectBindingPatternParameter04.ts, 3, 10)) ->z : Symbol(z, Decl(emptyObjectBindingPatternParameter04.ts, 3, 13)) -} diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.types b/tests/baselines/reference/emptyObjectBindingPatternParameter04.types deleted file mode 100644 index 5ee32d422a9..00000000000 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter04.types +++ /dev/null @@ -1,18 +0,0 @@ -=== tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts === - - -function f({} = {a: 1, b: "2", c: true}) { ->f : ({}?: { a: number; b: string; c: boolean; }) => void ->{a: 1, b: "2", c: true} : { a: number; b: string; c: boolean; } ->a : number ->1 : number ->b : string ->"2" : string ->c : boolean ->true : boolean - - var x, y, z; ->x : any ->y : any ->z : any -} diff --git a/tests/baselines/reference/enumFromExternalModule.js b/tests/baselines/reference/enumFromExternalModule.js index ed2a1f3926a..af04d9522b0 100644 --- a/tests/baselines/reference/enumFromExternalModule.js +++ b/tests/baselines/reference/enumFromExternalModule.js @@ -5,7 +5,7 @@ export enum Mode { Open } //// [enumFromExternalModule_1.ts] /// -import f = require('enumFromExternalModule_0'); +import f = require('./enumFromExternalModule_0'); var x = f.Mode.Open; @@ -17,5 +17,5 @@ var x = f.Mode.Open; var Mode = exports.Mode; //// [enumFromExternalModule_1.js] /// -var f = require('enumFromExternalModule_0'); +var f = require('./enumFromExternalModule_0'); var x = f.Mode.Open; diff --git a/tests/baselines/reference/enumFromExternalModule.symbols b/tests/baselines/reference/enumFromExternalModule.symbols index 90ff7cd7aac..3f2b1de5293 100644 --- a/tests/baselines/reference/enumFromExternalModule.symbols +++ b/tests/baselines/reference/enumFromExternalModule.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/enumFromExternalModule_1.ts === /// -import f = require('enumFromExternalModule_0'); +import f = require('./enumFromExternalModule_0'); >f : Symbol(f, Decl(enumFromExternalModule_1.ts, 0, 0)) var x = f.Mode.Open; diff --git a/tests/baselines/reference/enumFromExternalModule.types b/tests/baselines/reference/enumFromExternalModule.types index 554ac17ec67..05555572aa7 100644 --- a/tests/baselines/reference/enumFromExternalModule.types +++ b/tests/baselines/reference/enumFromExternalModule.types @@ -1,6 +1,6 @@ === tests/cases/compiler/enumFromExternalModule_1.ts === /// -import f = require('enumFromExternalModule_0'); +import f = require('./enumFromExternalModule_0'); >f : typeof f var x = f.Mode.Open; diff --git a/tests/baselines/reference/errorsOnImportedSymbol.errors.txt b/tests/baselines/reference/errorsOnImportedSymbol.errors.txt index ec108d48881..19839e4e544 100644 --- a/tests/baselines/reference/errorsOnImportedSymbol.errors.txt +++ b/tests/baselines/reference/errorsOnImportedSymbol.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/errorsOnImportedSymbol_1.ts(3,9): error TS2304: Cannot find ==== tests/cases/compiler/errorsOnImportedSymbol_1.ts (2 errors) ==== - import Sammy = require("errorsOnImportedSymbol_0"); + import Sammy = require("./errorsOnImportedSymbol_0"); var x = new Sammy.Sammy(); ~~~~~ !!! error TS2304: Cannot find name 'Sammy'. diff --git a/tests/baselines/reference/errorsOnImportedSymbol.js b/tests/baselines/reference/errorsOnImportedSymbol.js index 6a001bcd0f1..2c991ecd821 100644 --- a/tests/baselines/reference/errorsOnImportedSymbol.js +++ b/tests/baselines/reference/errorsOnImportedSymbol.js @@ -9,7 +9,7 @@ interface Sammy { export = Sammy; //// [errorsOnImportedSymbol_1.ts] -import Sammy = require("errorsOnImportedSymbol_0"); +import Sammy = require("./errorsOnImportedSymbol_0"); var x = new Sammy.Sammy(); var y = Sammy.Sammy(); diff --git a/tests/baselines/reference/es6ExportAllInEs5.js b/tests/baselines/reference/es6ExportAllInEs5.js index 1be3fa1f1b2..73689019ed4 100644 --- a/tests/baselines/reference/es6ExportAllInEs5.js +++ b/tests/baselines/reference/es6ExportAllInEs5.js @@ -14,7 +14,7 @@ export module uninstantiated { } //// [client.ts] -export * from "server"; +export * from "./server"; //// [server.js] var c = (function () { @@ -32,7 +32,7 @@ exports.x = 10; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } -__export(require("server")); +__export(require("./server")); //// [server.d.ts] @@ -47,4 +47,4 @@ export declare var x: number; export declare module uninstantiated { } //// [client.d.ts] -export * from "server"; +export * from "./server"; diff --git a/tests/baselines/reference/es6ExportAllInEs5.symbols b/tests/baselines/reference/es6ExportAllInEs5.symbols index c2a575f5e5c..26d47f63af3 100644 --- a/tests/baselines/reference/es6ExportAllInEs5.symbols +++ b/tests/baselines/reference/es6ExportAllInEs5.symbols @@ -20,5 +20,5 @@ export module uninstantiated { } === tests/cases/compiler/client.ts === -export * from "server"; +export * from "./server"; No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportAllInEs5.types b/tests/baselines/reference/es6ExportAllInEs5.types index 876ff152e2c..68187384602 100644 --- a/tests/baselines/reference/es6ExportAllInEs5.types +++ b/tests/baselines/reference/es6ExportAllInEs5.types @@ -22,5 +22,5 @@ export module uninstantiated { } === tests/cases/compiler/client.ts === -export * from "server"; +export * from "./server"; No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.js b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.js index 6250e0ce326..63ac2c04b3e 100644 --- a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.js +++ b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.js @@ -14,11 +14,11 @@ export module uninstantiated { } //// [client.ts] -export { c } from "server"; -export { c as c2 } from "server"; -export { i, m as instantiatedModule } from "server"; -export { uninstantiated } from "server"; -export { x } from "server"; +export { c } from "./server"; +export { c as c2 } from "./server"; +export { i, m as instantiatedModule } from "./server"; +export { uninstantiated } from "./server"; +export { x } from "./server"; //// [server.js] var c = (function () { @@ -33,13 +33,13 @@ var m; })(m = exports.m || (exports.m = {})); exports.x = 10; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.c = server_1.c; -var server_2 = require("server"); +var server_2 = require("./server"); exports.c2 = server_2.c; -var server_3 = require("server"); +var server_3 = require("./server"); exports.instantiatedModule = server_3.m; -var server_4 = require("server"); +var server_4 = require("./server"); exports.x = server_4.x; @@ -55,8 +55,8 @@ export declare var x: number; export declare module uninstantiated { } //// [client.d.ts] -export { c } from "server"; -export { c as c2 } from "server"; -export { i, m as instantiatedModule } from "server"; -export { uninstantiated } from "server"; -export { x } from "server"; +export { c } from "./server"; +export { c as c2 } from "./server"; +export { i, m as instantiatedModule } from "./server"; +export { uninstantiated } from "./server"; +export { x } from "./server"; diff --git a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.symbols b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.symbols index 731a0fdcc30..c8e279e65bf 100644 --- a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.symbols +++ b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.symbols @@ -20,21 +20,21 @@ export module uninstantiated { } === tests/cases/compiler/client.ts === -export { c } from "server"; +export { c } from "./server"; >c : Symbol(c, Decl(client.ts, 0, 8)) -export { c as c2 } from "server"; +export { c as c2 } from "./server"; >c : Symbol(c2, Decl(client.ts, 1, 8)) >c2 : Symbol(c2, Decl(client.ts, 1, 8)) -export { i, m as instantiatedModule } from "server"; +export { i, m as instantiatedModule } from "./server"; >i : Symbol(i, Decl(client.ts, 2, 8)) >m : Symbol(instantiatedModule, Decl(client.ts, 2, 11)) >instantiatedModule : Symbol(instantiatedModule, Decl(client.ts, 2, 11)) -export { uninstantiated } from "server"; +export { uninstantiated } from "./server"; >uninstantiated : Symbol(uninstantiated, Decl(client.ts, 3, 8)) -export { x } from "server"; +export { x } from "./server"; >x : Symbol(x, Decl(client.ts, 4, 8)) diff --git a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types index 6b621f4c777..4bd93b39031 100644 --- a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types +++ b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types @@ -22,21 +22,21 @@ export module uninstantiated { } === tests/cases/compiler/client.ts === -export { c } from "server"; +export { c } from "./server"; >c : typeof c -export { c as c2 } from "server"; +export { c as c2 } from "./server"; >c : typeof c >c2 : typeof c -export { i, m as instantiatedModule } from "server"; +export { i, m as instantiatedModule } from "./server"; >i : any >m : typeof m >instantiatedModule : typeof m -export { uninstantiated } from "server"; +export { uninstantiated } from "./server"; >uninstantiated : any -export { x } from "server"; +export { x } from "./server"; >x : number diff --git a/tests/baselines/reference/es6ImportDefaultBindingDts.js b/tests/baselines/reference/es6ImportDefaultBindingDts.js index a5e8d509da1..5593d762f85 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingDts.js +++ b/tests/baselines/reference/es6ImportDefaultBindingDts.js @@ -6,9 +6,9 @@ class c { } export default c; //// [client.ts] -import defaultBinding from "server"; +import defaultBinding from "./server"; export var x = new defaultBinding(); -import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used +import defaultBinding2 from "./server"; // elide this import since defaultBinding2 is not used //// [server.js] @@ -20,7 +20,7 @@ var c = (function () { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = c; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.x = new server_1.default(); @@ -29,5 +29,5 @@ declare class c { } export default c; //// [client.d.ts] -import defaultBinding from "server"; +import defaultBinding from "./server"; export declare var x: defaultBinding; diff --git a/tests/baselines/reference/es6ImportDefaultBindingDts.symbols b/tests/baselines/reference/es6ImportDefaultBindingDts.symbols index 1ca93aa6641..f25be3eacad 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingDts.symbols +++ b/tests/baselines/reference/es6ImportDefaultBindingDts.symbols @@ -7,13 +7,13 @@ export default c; >c : Symbol(c, Decl(server.ts, 0, 0)) === tests/cases/compiler/client.ts === -import defaultBinding from "server"; +import defaultBinding from "./server"; >defaultBinding : Symbol(defaultBinding, Decl(client.ts, 0, 6)) export var x = new defaultBinding(); >x : Symbol(x, Decl(client.ts, 1, 10)) >defaultBinding : Symbol(defaultBinding, Decl(client.ts, 0, 6)) -import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used +import defaultBinding2 from "./server"; // elide this import since defaultBinding2 is not used >defaultBinding2 : Symbol(defaultBinding2, Decl(client.ts, 2, 6)) diff --git a/tests/baselines/reference/es6ImportDefaultBindingDts.types b/tests/baselines/reference/es6ImportDefaultBindingDts.types index 65754d80680..8543c6845b2 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingDts.types +++ b/tests/baselines/reference/es6ImportDefaultBindingDts.types @@ -7,7 +7,7 @@ export default c; >c : c === tests/cases/compiler/client.ts === -import defaultBinding from "server"; +import defaultBinding from "./server"; >defaultBinding : typeof defaultBinding export var x = new defaultBinding(); @@ -15,6 +15,6 @@ export var x = new defaultBinding(); >new defaultBinding() : defaultBinding >defaultBinding : typeof defaultBinding -import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used +import defaultBinding2 from "./server"; // elide this import since defaultBinding2 is not used >defaultBinding2 : typeof defaultBinding diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt index 2688d4af06f..b0b7465477b 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt @@ -10,16 +10,16 @@ error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' w export default {}; ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (0 errors) ==== - import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; - import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = a; - import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = b; - import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = x; var x1: number = y; - import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = z; - import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = m; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js index 641941db9e5..554fecf9116 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js @@ -8,17 +8,17 @@ export var m = a; export default {}; //// [es6ImportDefaultBindingFollowedWithNamedImport_1.ts] -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = a; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = b; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = x; var x1: number = y; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = z; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = m; @@ -28,16 +28,16 @@ export var x = a; export var m = a; export default {}; //// [es6ImportDefaultBindingFollowedWithNamedImport_1.js] -import { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1 = a; -import { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1 = b; -import { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1 = x; var x1 = y; -import { x as z } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import { x as z } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1 = z; -import { m } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import { m } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1 = m; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt index 5809e0874dc..c62ecb70c58 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt @@ -12,27 +12,27 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(1 export default a; ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts (6 errors) ==== - import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding1; - import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. var x: number = defaultBinding2; - import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. var x: number = defaultBinding3; - import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. var x: number = defaultBinding4; - import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. var x: number = defaultBinding5; - import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; + import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'. var x: number = defaultBinding6; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js index 7090b7a0663..7eda76622de 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js @@ -6,17 +6,17 @@ var a = 10; export default a; //// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts] -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding1; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding2; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding3; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding4; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding5; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding6; @@ -25,17 +25,17 @@ var a = 10; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = a; //// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.js] -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1.default; -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2.default; -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3.default; -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4.default; -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5.default; -var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6 = require("es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6 = require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"); var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6.default; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt index aa9e0cb3af3..76c424a74d4 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt @@ -18,23 +18,23 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil export default a; ==== tests/cases/compiler/client.ts (12 errors) ==== - export import defaultBinding1, { } from "server"; + export import defaultBinding1, { } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = defaultBinding1; - export import defaultBinding2, { a } from "server"; + export import defaultBinding2, { a } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x1: number = defaultBinding2; - export import defaultBinding3, { a as b } from "server"; + export import defaultBinding3, { a as b } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x1: number = defaultBinding3; - export import defaultBinding4, { x, a as y } from "server"; + export import defaultBinding4, { x, a as y } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ @@ -42,13 +42,13 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x1: number = defaultBinding4; - export import defaultBinding5, { x as z, } from "server"; + export import defaultBinding5, { x as z, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'. export var x1: number = defaultBinding5; - export import defaultBinding6, { m, } from "server"; + export import defaultBinding6, { m, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js index 2b0e3ebbeb5..b83571066f0 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js @@ -6,17 +6,17 @@ var a = 10; export default a; //// [client.ts] -export import defaultBinding1, { } from "server"; +export import defaultBinding1, { } from "./server"; export var x1: number = defaultBinding1; -export import defaultBinding2, { a } from "server"; +export import defaultBinding2, { a } from "./server"; export var x1: number = defaultBinding2; -export import defaultBinding3, { a as b } from "server"; +export import defaultBinding3, { a as b } from "./server"; export var x1: number = defaultBinding3; -export import defaultBinding4, { x, a as y } from "server"; +export import defaultBinding4, { x, a as y } from "./server"; export var x1: number = defaultBinding4; -export import defaultBinding5, { x as z, } from "server"; +export import defaultBinding5, { x as z, } from "./server"; export var x1: number = defaultBinding5; -export import defaultBinding6, { m, } from "server"; +export import defaultBinding6, { m, } from "./server"; export var x1: number = defaultBinding6; @@ -25,17 +25,17 @@ var a = 10; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = a; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.x1 = server_1.default; -var server_2 = require("server"); +var server_2 = require("./server"); exports.x1 = server_2.default; -var server_3 = require("server"); +var server_3 = require("./server"); exports.x1 = server_3.default; -var server_4 = require("server"); +var server_4 = require("./server"); exports.x1 = server_4.default; -var server_5 = require("server"); +var server_5 = require("./server"); exports.x1 = server_5.default; -var server_6 = require("server"); +var server_6 = require("./server"); exports.x1 = server_6.default; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.errors.txt index 451543d78f5..47e0cb347f3 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.errors.txt @@ -16,27 +16,27 @@ tests/cases/compiler/client.ts(11,8): error TS1192: Module '"tests/cases/compile export class x11 { } ==== tests/cases/compiler/client.ts (6 errors) ==== - import defaultBinding1, { } from "server"; + import defaultBinding1, { } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. - import defaultBinding2, { a } from "server"; + import defaultBinding2, { a } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x1 = new a(); - import defaultBinding3, { a11 as b } from "server"; + import defaultBinding3, { a11 as b } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x2 = new b(); - import defaultBinding4, { x, a12 as y } from "server"; + import defaultBinding4, { x, a12 as y } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x4 = new x(); export var x5 = new y(); - import defaultBinding5, { x11 as z, } from "server"; + import defaultBinding5, { x11 as z, } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x3 = new z(); - import defaultBinding6, { m, } from "server"; + import defaultBinding6, { m, } from "./server"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x6 = new m(); diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.js index 8cf9ab1ffb1..9314190e786 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts.js @@ -10,17 +10,17 @@ export class a12 { } export class x11 { } //// [client.ts] -import defaultBinding1, { } from "server"; -import defaultBinding2, { a } from "server"; +import defaultBinding1, { } from "./server"; +import defaultBinding2, { a } from "./server"; export var x1 = new a(); -import defaultBinding3, { a11 as b } from "server"; +import defaultBinding3, { a11 as b } from "./server"; export var x2 = new b(); -import defaultBinding4, { x, a12 as y } from "server"; +import defaultBinding4, { x, a12 as y } from "./server"; export var x4 = new x(); export var x5 = new y(); -import defaultBinding5, { x11 as z, } from "server"; +import defaultBinding5, { x11 as z, } from "./server"; export var x3 = new z(); -import defaultBinding6, { m, } from "server"; +import defaultBinding6, { m, } from "./server"; export var x6 = new m(); @@ -62,16 +62,16 @@ var x11 = (function () { })(); exports.x11 = x11; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.x1 = new server_1.a(); -var server_2 = require("server"); +var server_2 = require("./server"); exports.x2 = new server_2.a11(); -var server_3 = require("server"); +var server_3 = require("./server"); exports.x4 = new server_3.x(); exports.x5 = new server_3.a12(); -var server_4 = require("server"); +var server_4 = require("./server"); exports.x3 = new server_4.x11(); -var server_5 = require("server"); +var server_5 = require("./server"); exports.x6 = new server_5.m(); @@ -89,14 +89,14 @@ export declare class a12 { export declare class x11 { } //// [client.d.ts] -import { a } from "server"; +import { a } from "./server"; export declare var x1: a; -import { a11 as b } from "server"; +import { a11 as b } from "./server"; export declare var x2: b; -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; export declare var x4: x; export declare var x5: y; -import { x11 as z } from "server"; +import { x11 as z } from "./server"; export declare var x3: z; -import { m } from "server"; +import { m } from "./server"; export declare var x6: m; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt index 0e259f142b6..e939398632c 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt @@ -12,27 +12,27 @@ tests/cases/compiler/client.ts(11,27): error TS2305: Module '"tests/cases/compil export default a; ==== tests/cases/compiler/client.ts (6 errors) ==== - import defaultBinding1, { } from "server"; + import defaultBinding1, { } from "./server"; export var x1 = new defaultBinding1(); - import defaultBinding2, { a } from "server"; + import defaultBinding2, { a } from "./server"; ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x2 = new defaultBinding2(); - import defaultBinding3, { a as b } from "server"; + import defaultBinding3, { a as b } from "./server"; ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x3 = new defaultBinding3(); - import defaultBinding4, { x, a as y } from "server"; + import defaultBinding4, { x, a as y } from "./server"; ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'. ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. export var x4 = new defaultBinding4(); - import defaultBinding5, { x as z, } from "server"; + import defaultBinding5, { x as z, } from "./server"; ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'. export var x5 = new defaultBinding5(); - import defaultBinding6, { m, } from "server"; + import defaultBinding6, { m, } from "./server"; ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'. export var x6 = new defaultBinding6(); \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.js index dad034c618c..71d35fd85a1 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.js @@ -6,17 +6,17 @@ class a { } export default a; //// [client.ts] -import defaultBinding1, { } from "server"; +import defaultBinding1, { } from "./server"; export var x1 = new defaultBinding1(); -import defaultBinding2, { a } from "server"; +import defaultBinding2, { a } from "./server"; export var x2 = new defaultBinding2(); -import defaultBinding3, { a as b } from "server"; +import defaultBinding3, { a as b } from "./server"; export var x3 = new defaultBinding3(); -import defaultBinding4, { x, a as y } from "server"; +import defaultBinding4, { x, a as y } from "./server"; export var x4 = new defaultBinding4(); -import defaultBinding5, { x as z, } from "server"; +import defaultBinding5, { x as z, } from "./server"; export var x5 = new defaultBinding5(); -import defaultBinding6, { m, } from "server"; +import defaultBinding6, { m, } from "./server"; export var x6 = new defaultBinding6(); //// [server.js] @@ -28,17 +28,17 @@ var a = (function () { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = a; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.x1 = new server_1.default(); -var server_2 = require("server"); +var server_2 = require("./server"); exports.x2 = new server_2.default(); -var server_3 = require("server"); +var server_3 = require("./server"); exports.x3 = new server_3.default(); -var server_4 = require("server"); +var server_4 = require("./server"); exports.x4 = new server_4.default(); -var server_5 = require("server"); +var server_5 = require("./server"); exports.x5 = new server_5.default(); -var server_6 = require("server"); +var server_6 = require("./server"); exports.x6 = new server_6.default(); @@ -47,7 +47,7 @@ declare class a { } export default a; //// [client.d.ts] -import defaultBinding1 from "server"; +import defaultBinding1 from "./server"; export declare var x1: defaultBinding1; export declare var x2: defaultBinding1; export declare var x3: defaultBinding1; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt index c1c28416ec7..7c5080241f1 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt @@ -13,27 +13,27 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11 export var m = a; ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (6 errors) ==== - import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. - import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. var x1: number = a; - import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. var x1: number = b; - import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. var x1: number = x; var x1: number = y; - import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. var x1: number = z; - import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export. var x1: number = m; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js index 1c65fadbe1d..9674f8c12f4 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js @@ -7,17 +7,17 @@ export var x = a; export var m = a; //// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts] -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = a; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = b; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = x; var x1: number = y; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = z; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = m; @@ -26,16 +26,16 @@ exports.a = 10; exports.x = exports.a; exports.m = exports.a; //// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.js] -var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1.a; -var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2.a; -var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.x; var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.a; -var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4.x; -var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5 = require("es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); +var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5.m; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js index 4a987110224..ada6e423e73 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js @@ -6,7 +6,7 @@ var a = 10; export default a; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts] -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; var x: number = defaultBinding; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.js] @@ -14,7 +14,7 @@ var a = 10; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = a; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.js] -var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"), nameSpaceBinding = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1; +var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"), nameSpaceBinding = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1; var x = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1.default; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.symbols b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.symbols index d4a9c289e60..4262dd3c61b 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.symbols +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.symbols @@ -7,7 +7,7 @@ export default a; >a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.ts, 1, 3)) === tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts === -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; >defaultBinding : Symbol(defaultBinding, Decl(es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts, 0, 6)) >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts, 0, 22)) diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.types b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.types index 4a05b57e304..4f9c618f10c 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.types +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.types @@ -8,7 +8,7 @@ export default a; >a : number === tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts === -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; >defaultBinding : number >nameSpaceBinding : typeof nameSpaceBinding diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.errors.txt index 19fa0383d52..1fc12619017 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/client.ts(1,8): error TS1192: Module '"tests/cases/compiler export class a { } ==== tests/cases/compiler/client.ts (1 errors) ==== - import defaultBinding, * as nameSpaceBinding from "server"; + import defaultBinding, * as nameSpaceBinding from "./server"; ~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/server"' has no default export. export var x = new nameSpaceBinding.a(); \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js index 31ef01c464c..93918f6171a 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js @@ -5,7 +5,7 @@ export class a { } //// [client.ts] -import defaultBinding, * as nameSpaceBinding from "server"; +import defaultBinding, * as nameSpaceBinding from "./server"; export var x = new nameSpaceBinding.a(); //// [server.js] @@ -16,7 +16,7 @@ var a = (function () { })(); exports.a = a; //// [client.js] -var server_1 = require("server"), nameSpaceBinding = server_1; +var server_1 = require("./server"), nameSpaceBinding = server_1; exports.x = new nameSpaceBinding.a(); @@ -24,5 +24,5 @@ exports.x = new nameSpaceBinding.a(); export declare class a { } //// [client.d.ts] -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; export declare var x: nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt index dbbbf67118e..f14af87315c 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1. export var a = 10; ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts (1 errors) ==== - import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; + import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; ~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export. var x: number = nameSpaceBinding.a; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js index 4a49d3c2d6f..49717c588b7 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js @@ -5,13 +5,13 @@ export var a = 10; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts] -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; var x: number = nameSpaceBinding.a; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.js] exports.a = 10; //// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.js] -var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = require("es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"), nameSpaceBinding = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1; +var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"), nameSpaceBinding = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1; var x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.errors.txt index 3da1cf3fda8..d0eee527356 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/client.ts(1,15): error TS1192: Module '"tests/cases/compile export var a = 10; ==== tests/cases/compiler/client.ts (2 errors) ==== - export import defaultBinding, * as nameSpaceBinding from "server"; + export import defaultBinding, * as nameSpaceBinding from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js index df233fe18a5..dec9b8cfebe 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js @@ -5,13 +5,13 @@ export var a = 10; //// [client.ts] -export import defaultBinding, * as nameSpaceBinding from "server"; +export import defaultBinding, * as nameSpaceBinding from "./server"; export var x: number = nameSpaceBinding.a; //// [server.js] exports.a = 10; //// [client.js] -var server_1 = require("server"), nameSpaceBinding = server_1; +var server_1 = require("./server"), nameSpaceBinding = server_1; exports.x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt index 109b322f4bb..18f634d7b73 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt @@ -7,6 +7,6 @@ tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1192: Modul export = a; ==== tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts (1 errors) ==== - import defaultBinding from "es6ImportDefaultBindingInEs5_0"; + import defaultBinding from "./es6ImportDefaultBindingInEs5_0"; ~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingInEs5.js index 0b703f829ca..34323b2752b 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingInEs5.js +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.js @@ -6,7 +6,7 @@ var a = 10; export = a; //// [es6ImportDefaultBindingInEs5_1.ts] -import defaultBinding from "es6ImportDefaultBindingInEs5_0"; +import defaultBinding from "./es6ImportDefaultBindingInEs5_0"; //// [es6ImportDefaultBindingInEs5_0.js] var a = 10; diff --git a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt index cd0550609c7..8b67ddfeac3 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt @@ -9,18 +9,18 @@ tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(8,8): error TS2300: export default a; ==== tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts (3 errors) ==== - import defaultBinding from "es6ImportDefaultBindingMergeErrors_0"; + import defaultBinding from "./es6ImportDefaultBindingMergeErrors_0"; interface defaultBinding { // This is ok } var x = defaultBinding; - import defaultBinding2 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error + import defaultBinding2 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error ~~~~~~~~~~~~~~~ !!! error TS2440: Import declaration conflicts with local declaration of 'defaultBinding2' var defaultBinding2 = "hello world"; - import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error + import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error ~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding3'. - import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // SHould be error + import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // SHould be error ~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding3'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.js b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.js index 10b8bec03c7..fb80fdd3e4f 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.js +++ b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.js @@ -6,14 +6,14 @@ var a = 10; export default a; //// [es6ImportDefaultBindingMergeErrors_1.ts] -import defaultBinding from "es6ImportDefaultBindingMergeErrors_0"; +import defaultBinding from "./es6ImportDefaultBindingMergeErrors_0"; interface defaultBinding { // This is ok } var x = defaultBinding; -import defaultBinding2 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error +import defaultBinding2 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error var defaultBinding2 = "hello world"; -import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error -import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // SHould be error +import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error +import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // SHould be error //// [es6ImportDefaultBindingMergeErrors_0.js] @@ -21,6 +21,6 @@ var a = 10; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = a; //// [es6ImportDefaultBindingMergeErrors_1.js] -var es6ImportDefaultBindingMergeErrors_0_1 = require("es6ImportDefaultBindingMergeErrors_0"); +var es6ImportDefaultBindingMergeErrors_0_1 = require("./es6ImportDefaultBindingMergeErrors_0"); var x = es6ImportDefaultBindingMergeErrors_0_1.default; var defaultBinding2 = "hello world"; diff --git a/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.errors.txt index a37a71e7378..9d0e46ceb97 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty_1.ts(1,8): error T export var a = 10; ==== tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty_1.ts (1 errors) ==== - import defaultBinding from "es6ImportDefaultBindingNoDefaultProperty_0"; + import defaultBinding from "./es6ImportDefaultBindingNoDefaultProperty_0"; ~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty_0"' has no default export. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.js b/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.js index f824dbf71d5..1c9ec4eeae5 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.js +++ b/tests/baselines/reference/es6ImportDefaultBindingNoDefaultProperty.js @@ -5,7 +5,7 @@ export var a = 10; //// [es6ImportDefaultBindingNoDefaultProperty_1.ts] -import defaultBinding from "es6ImportDefaultBindingNoDefaultProperty_0"; +import defaultBinding from "./es6ImportDefaultBindingNoDefaultProperty_0"; //// [es6ImportDefaultBindingNoDefaultProperty_0.js] diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt b/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt index 00a6dcb2cfd..67616662ca8 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt +++ b/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt @@ -7,7 +7,7 @@ error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' w export var a = 10; ==== tests/cases/compiler/es6ImportNameSpaceImport_1.ts (0 errors) ==== - import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; + import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; var x = nameSpaceBinding.a; - import * as nameSpaceBinding2 from "es6ImportNameSpaceImport_0"; // elide this + import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.js b/tests/baselines/reference/es6ImportNameSpaceImport.js index 653feeb22b7..7498b8ee9e8 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImport.js +++ b/tests/baselines/reference/es6ImportNameSpaceImport.js @@ -5,15 +5,15 @@ export var a = 10; //// [es6ImportNameSpaceImport_1.ts] -import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; var x = nameSpaceBinding.a; -import * as nameSpaceBinding2 from "es6ImportNameSpaceImport_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this //// [es6ImportNameSpaceImport_0.js] export var a = 10; //// [es6ImportNameSpaceImport_1.js] -import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; var x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportDts.js b/tests/baselines/reference/es6ImportNameSpaceImportDts.js index 91e927428a1..dfdfe2602a3 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportDts.js +++ b/tests/baselines/reference/es6ImportNameSpaceImportDts.js @@ -5,9 +5,9 @@ export class c { }; //// [client.ts] -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; export var x = new nameSpaceBinding.c(); -import * as nameSpaceBinding2 from "server"; // unreferenced +import * as nameSpaceBinding2 from "./server"; // unreferenced //// [server.js] var c = (function () { @@ -18,7 +18,7 @@ var c = (function () { exports.c = c; ; //// [client.js] -var nameSpaceBinding = require("server"); +var nameSpaceBinding = require("./server"); exports.x = new nameSpaceBinding.c(); @@ -26,5 +26,5 @@ exports.x = new nameSpaceBinding.c(); export declare class c { } //// [client.d.ts] -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; export declare var x: nameSpaceBinding.c; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportDts.symbols b/tests/baselines/reference/es6ImportNameSpaceImportDts.symbols index 8104cbcce50..5f6fea374be 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportDts.symbols +++ b/tests/baselines/reference/es6ImportNameSpaceImportDts.symbols @@ -4,7 +4,7 @@ export class c { }; >c : Symbol(c, Decl(server.ts, 0, 0)) === tests/cases/compiler/client.ts === -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(client.ts, 0, 6)) export var x = new nameSpaceBinding.c(); @@ -13,6 +13,6 @@ export var x = new nameSpaceBinding.c(); >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(client.ts, 0, 6)) >c : Symbol(nameSpaceBinding.c, Decl(server.ts, 0, 0)) -import * as nameSpaceBinding2 from "server"; // unreferenced +import * as nameSpaceBinding2 from "./server"; // unreferenced >nameSpaceBinding2 : Symbol(nameSpaceBinding2, Decl(client.ts, 2, 6)) diff --git a/tests/baselines/reference/es6ImportNameSpaceImportDts.types b/tests/baselines/reference/es6ImportNameSpaceImportDts.types index 345d593b143..e49f3ace57a 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportDts.types +++ b/tests/baselines/reference/es6ImportNameSpaceImportDts.types @@ -4,7 +4,7 @@ export class c { }; >c : c === tests/cases/compiler/client.ts === -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; >nameSpaceBinding : typeof nameSpaceBinding export var x = new nameSpaceBinding.c(); @@ -14,6 +14,6 @@ export var x = new nameSpaceBinding.c(); >nameSpaceBinding : typeof nameSpaceBinding >c : typeof nameSpaceBinding.c -import * as nameSpaceBinding2 from "server"; // unreferenced +import * as nameSpaceBinding2 from "./server"; // unreferenced >nameSpaceBinding2 : typeof nameSpaceBinding diff --git a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js index 50a03972cc2..dfc90c3e9af 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js +++ b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js @@ -5,15 +5,15 @@ export var a = 10; //// [es6ImportNameSpaceImportInEs5_1.ts] -import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportInEs5_0"; var x = nameSpaceBinding.a; -import * as nameSpaceBinding2 from "es6ImportNameSpaceImportInEs5_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImportInEs5_0"; // elide this //// [es6ImportNameSpaceImportInEs5_0.js] exports.a = 10; //// [es6ImportNameSpaceImportInEs5_1.js] -var nameSpaceBinding = require("es6ImportNameSpaceImportInEs5_0"); +var nameSpaceBinding = require("./es6ImportNameSpaceImportInEs5_0"); var x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.symbols b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.symbols index 119787de817..7be619dcc7e 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.symbols +++ b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.symbols @@ -4,7 +4,7 @@ export var a = 10; >a : Symbol(a, Decl(es6ImportNameSpaceImportInEs5_0.ts, 1, 10)) === tests/cases/compiler/es6ImportNameSpaceImportInEs5_1.ts === -import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportInEs5_0"; >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImportInEs5_1.ts, 0, 6)) var x = nameSpaceBinding.a; @@ -13,6 +13,6 @@ var x = nameSpaceBinding.a; >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImportInEs5_1.ts, 0, 6)) >a : Symbol(nameSpaceBinding.a, Decl(es6ImportNameSpaceImportInEs5_0.ts, 1, 10)) -import * as nameSpaceBinding2 from "es6ImportNameSpaceImportInEs5_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImportInEs5_0"; // elide this >nameSpaceBinding2 : Symbol(nameSpaceBinding2, Decl(es6ImportNameSpaceImportInEs5_1.ts, 2, 6)) diff --git a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types index 01531cd233d..13631060813 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types +++ b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types @@ -5,7 +5,7 @@ export var a = 10; >10 : number === tests/cases/compiler/es6ImportNameSpaceImportInEs5_1.ts === -import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportInEs5_0"; >nameSpaceBinding : typeof nameSpaceBinding var x = nameSpaceBinding.a; @@ -14,6 +14,6 @@ var x = nameSpaceBinding.a; >nameSpaceBinding : typeof nameSpaceBinding >a : number -import * as nameSpaceBinding2 from "es6ImportNameSpaceImportInEs5_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImportInEs5_0"; // elide this >nameSpaceBinding2 : typeof nameSpaceBinding diff --git a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt index 98a68870833..b8b22ce3ed1 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt @@ -8,17 +8,17 @@ tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(7,8): error TS2440 export var a = 10; ==== tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts (3 errors) ==== - import * as nameSpaceBinding from "es6ImportNameSpaceImportMergeErrors_0"; + import * as nameSpaceBinding from "./es6ImportNameSpaceImportMergeErrors_0"; interface nameSpaceBinding { } // this should be ok - import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error + import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error ~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'nameSpaceBinding1'. - import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error + import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error ~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'nameSpaceBinding1'. - import * as nameSpaceBinding3 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error + import * as nameSpaceBinding3 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2440: Import declaration conflicts with local declaration of 'nameSpaceBinding3' var nameSpaceBinding3 = 10; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.js b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.js index 3c8461fba2b..b94640349c0 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.js +++ b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.js @@ -5,13 +5,13 @@ export var a = 10; //// [es6ImportNameSpaceImportMergeErrors_1.ts] -import * as nameSpaceBinding from "es6ImportNameSpaceImportMergeErrors_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportMergeErrors_0"; interface nameSpaceBinding { } // this should be ok -import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error -import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error -import * as nameSpaceBinding3 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding3 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error var nameSpaceBinding3 = 10; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.js b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.js index 3d6dab17785..efa3a04bc9a 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.js +++ b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.js @@ -6,7 +6,7 @@ var a = 10; export = a; //// [es6ImportNameSpaceImportNoNamedExports_1.ts] -import * as nameSpaceBinding from "es6ImportNameSpaceImportNoNamedExports_0"; // error +import * as nameSpaceBinding from "./es6ImportNameSpaceImportNoNamedExports_0"; // error //// [es6ImportNameSpaceImportNoNamedExports_0.js] var a = 10; diff --git a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.symbols b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.symbols index 6a443d1fa00..8767c1a4add 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.symbols +++ b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.symbols @@ -7,6 +7,6 @@ export = a; >a : Symbol(a, Decl(es6ImportNameSpaceImportNoNamedExports_0.ts, 1, 3)) === tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports_1.ts === -import * as nameSpaceBinding from "es6ImportNameSpaceImportNoNamedExports_0"; // error +import * as nameSpaceBinding from "./es6ImportNameSpaceImportNoNamedExports_0"; // error >nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImportNoNamedExports_1.ts, 0, 6)) diff --git a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.types b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.types index 2cc4844dd42..4aaf33d5930 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.types +++ b/tests/baselines/reference/es6ImportNameSpaceImportNoNamedExports.types @@ -8,6 +8,6 @@ export = a; >a : number === tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports_1.ts === -import * as nameSpaceBinding from "es6ImportNameSpaceImportNoNamedExports_0"; // error +import * as nameSpaceBinding from "./es6ImportNameSpaceImportNoNamedExports_0"; // error >nameSpaceBinding : number diff --git a/tests/baselines/reference/es6ImportNamedImport.errors.txt b/tests/baselines/reference/es6ImportNamedImport.errors.txt index 12dcf331967..efcda1f5368 100644 --- a/tests/baselines/reference/es6ImportNamedImport.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImport.errors.txt @@ -14,31 +14,31 @@ error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' w export var aaaa = 10; ==== tests/cases/compiler/es6ImportNamedImport_1.ts (0 errors) ==== - import { } from "es6ImportNamedImport_0"; - import { a } from "es6ImportNamedImport_0"; + import { } from "./es6ImportNamedImport_0"; + import { a } from "./es6ImportNamedImport_0"; var xxxx = a; - import { a as b } from "es6ImportNamedImport_0"; + import { a as b } from "./es6ImportNamedImport_0"; var xxxx = b; - import { x, a as y } from "es6ImportNamedImport_0"; + import { x, a as y } from "./es6ImportNamedImport_0"; var xxxx = x; var xxxx = y; - import { x as z, } from "es6ImportNamedImport_0"; + import { x as z, } from "./es6ImportNamedImport_0"; var xxxx = z; - import { m, } from "es6ImportNamedImport_0"; + import { m, } from "./es6ImportNamedImport_0"; var xxxx = m; - import { a1, x1 } from "es6ImportNamedImport_0"; + import { a1, x1 } from "./es6ImportNamedImport_0"; var xxxx = a1; var xxxx = x1; - import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; + import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; var xxxx = a11; var xxxx = x11; - import { z1 } from "es6ImportNamedImport_0"; + import { z1 } from "./es6ImportNamedImport_0"; var z111 = z1; - import { z2 as z3 } from "es6ImportNamedImport_0"; + import { z2 as z3 } from "./es6ImportNamedImport_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided - import { aaaa } from "es6ImportNamedImport_0"; + import { aaaa } from "./es6ImportNamedImport_0"; // These are elided - import { aaaa as bbbb } from "es6ImportNamedImport_0"; + import { aaaa as bbbb } from "./es6ImportNamedImport_0"; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImport.js b/tests/baselines/reference/es6ImportNamedImport.js index 9606c59351b..6edb6ccb7cd 100644 --- a/tests/baselines/reference/es6ImportNamedImport.js +++ b/tests/baselines/reference/es6ImportNamedImport.js @@ -12,33 +12,33 @@ export var z2 = 10; export var aaaa = 10; //// [es6ImportNamedImport_1.ts] -import { } from "es6ImportNamedImport_0"; -import { a } from "es6ImportNamedImport_0"; +import { } from "./es6ImportNamedImport_0"; +import { a } from "./es6ImportNamedImport_0"; var xxxx = a; -import { a as b } from "es6ImportNamedImport_0"; +import { a as b } from "./es6ImportNamedImport_0"; var xxxx = b; -import { x, a as y } from "es6ImportNamedImport_0"; +import { x, a as y } from "./es6ImportNamedImport_0"; var xxxx = x; var xxxx = y; -import { x as z, } from "es6ImportNamedImport_0"; +import { x as z, } from "./es6ImportNamedImport_0"; var xxxx = z; -import { m, } from "es6ImportNamedImport_0"; +import { m, } from "./es6ImportNamedImport_0"; var xxxx = m; -import { a1, x1 } from "es6ImportNamedImport_0"; +import { a1, x1 } from "./es6ImportNamedImport_0"; var xxxx = a1; var xxxx = x1; -import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; var xxxx = a11; var xxxx = x11; -import { z1 } from "es6ImportNamedImport_0"; +import { z1 } from "./es6ImportNamedImport_0"; var z111 = z1; -import { z2 as z3 } from "es6ImportNamedImport_0"; +import { z2 as z3 } from "./es6ImportNamedImport_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided -import { aaaa } from "es6ImportNamedImport_0"; +import { aaaa } from "./es6ImportNamedImport_0"; // These are elided -import { aaaa as bbbb } from "es6ImportNamedImport_0"; +import { aaaa as bbbb } from "./es6ImportNamedImport_0"; //// [es6ImportNamedImport_0.js] @@ -51,26 +51,26 @@ export var z1 = 10; export var z2 = 10; export var aaaa = 10; //// [es6ImportNamedImport_1.js] -import { a } from "es6ImportNamedImport_0"; +import { a } from "./es6ImportNamedImport_0"; var xxxx = a; -import { a as b } from "es6ImportNamedImport_0"; +import { a as b } from "./es6ImportNamedImport_0"; var xxxx = b; -import { x, a as y } from "es6ImportNamedImport_0"; +import { x, a as y } from "./es6ImportNamedImport_0"; var xxxx = x; var xxxx = y; -import { x as z } from "es6ImportNamedImport_0"; +import { x as z } from "./es6ImportNamedImport_0"; var xxxx = z; -import { m } from "es6ImportNamedImport_0"; +import { m } from "./es6ImportNamedImport_0"; var xxxx = m; -import { a1, x1 } from "es6ImportNamedImport_0"; +import { a1, x1 } from "./es6ImportNamedImport_0"; var xxxx = a1; var xxxx = x1; -import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; var xxxx = a11; var xxxx = x11; -import { z1 } from "es6ImportNamedImport_0"; +import { z1 } from "./es6ImportNamedImport_0"; var z111 = z1; -import { z2 as z3 } from "es6ImportNamedImport_0"; +import { z2 as z3 } from "./es6ImportNamedImport_0"; var z2 = z3; // z2 shouldn't give redeclare error diff --git a/tests/baselines/reference/es6ImportNamedImportDts.js b/tests/baselines/reference/es6ImportNamedImportDts.js index a72632a737e..59b47635ba9 100644 --- a/tests/baselines/reference/es6ImportNamedImportDts.js +++ b/tests/baselines/reference/es6ImportNamedImportDts.js @@ -18,32 +18,32 @@ export class aaaa { } export class aaaa1 { } //// [client.ts] -import { } from "server"; -import { a } from "server"; +import { } from "./server"; +import { a } from "./server"; export var xxxx = new a(); -import { a11 as b } from "server"; +import { a11 as b } from "./server"; export var xxxx1 = new b(); -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; export var xxxx2 = new x(); export var xxxx3 = new y(); -import { x11 as z, } from "server"; +import { x11 as z, } from "./server"; export var xxxx4 = new z(); -import { m, } from "server"; +import { m, } from "./server"; export var xxxx5 = new m(); -import { a1, x1 } from "server"; +import { a1, x1 } from "./server"; export var xxxx6 = new a1(); export var xxxx7 = new x1(); -import { a111 as a11, x111 as x11 } from "server"; +import { a111 as a11, x111 as x11 } from "./server"; export var xxxx8 = new a11(); export var xxxx9 = new x11(); -import { z1 } from "server"; +import { z1 } from "./server"; export var z111 = new z1(); -import { z2 as z3 } from "server"; +import { z2 as z3 } from "./server"; export var z2 = new z3(); // z2 shouldn't give redeclare error // not referenced -import { aaaa } from "server"; -import { aaaa1 as bbbb } from "server"; +import { aaaa } from "./server"; +import { aaaa1 as bbbb } from "./server"; //// [server.js] @@ -132,26 +132,26 @@ var aaaa1 = (function () { })(); exports.aaaa1 = aaaa1; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.xxxx = new server_1.a(); -var server_2 = require("server"); +var server_2 = require("./server"); exports.xxxx1 = new server_2.a11(); -var server_3 = require("server"); +var server_3 = require("./server"); exports.xxxx2 = new server_3.x(); exports.xxxx3 = new server_3.a12(); -var server_4 = require("server"); +var server_4 = require("./server"); exports.xxxx4 = new server_4.x11(); -var server_5 = require("server"); +var server_5 = require("./server"); exports.xxxx5 = new server_5.m(); -var server_6 = require("server"); +var server_6 = require("./server"); exports.xxxx6 = new server_6.a1(); exports.xxxx7 = new server_6.x1(); -var server_7 = require("server"); +var server_7 = require("./server"); exports.xxxx8 = new server_7.a111(); exports.xxxx9 = new server_7.x111(); -var server_8 = require("server"); +var server_8 = require("./server"); exports.z111 = new server_8.z1(); -var server_9 = require("server"); +var server_9 = require("./server"); exports.z2 = new server_9.z2(); // z2 shouldn't give redeclare error @@ -185,24 +185,24 @@ export declare class aaaa { export declare class aaaa1 { } //// [client.d.ts] -import { a } from "server"; +import { a } from "./server"; export declare var xxxx: a; -import { a11 as b } from "server"; +import { a11 as b } from "./server"; export declare var xxxx1: b; -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; export declare var xxxx2: x; export declare var xxxx3: y; -import { x11 as z } from "server"; +import { x11 as z } from "./server"; export declare var xxxx4: z; -import { m } from "server"; +import { m } from "./server"; export declare var xxxx5: m; -import { a1, x1 } from "server"; +import { a1, x1 } from "./server"; export declare var xxxx6: a1; export declare var xxxx7: x1; -import { a111 as a11, x111 as x11 } from "server"; +import { a111 as a11, x111 as x11 } from "./server"; export declare var xxxx8: a11; export declare var xxxx9: x11; -import { z1 } from "server"; +import { z1 } from "./server"; export declare var z111: z1; -import { z2 as z3 } from "server"; +import { z2 as z3 } from "./server"; export declare var z2: z3; diff --git a/tests/baselines/reference/es6ImportNamedImportDts.symbols b/tests/baselines/reference/es6ImportNamedImportDts.symbols index 2e3b2735b3d..dab2e13d0f6 100644 --- a/tests/baselines/reference/es6ImportNamedImportDts.symbols +++ b/tests/baselines/reference/es6ImportNamedImportDts.symbols @@ -43,15 +43,15 @@ export class aaaa1 { } >aaaa1 : Symbol(aaaa1, Decl(server.ts, 13, 21)) === tests/cases/compiler/client.ts === -import { } from "server"; -import { a } from "server"; +import { } from "./server"; +import { a } from "./server"; >a : Symbol(a, Decl(client.ts, 1, 8)) export var xxxx = new a(); >xxxx : Symbol(xxxx, Decl(client.ts, 2, 10)) >a : Symbol(a, Decl(client.ts, 1, 8)) -import { a11 as b } from "server"; +import { a11 as b } from "./server"; >a11 : Symbol(b, Decl(client.ts, 3, 8)) >b : Symbol(b, Decl(client.ts, 3, 8)) @@ -59,7 +59,7 @@ export var xxxx1 = new b(); >xxxx1 : Symbol(xxxx1, Decl(client.ts, 4, 10)) >b : Symbol(b, Decl(client.ts, 3, 8)) -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; >x : Symbol(x, Decl(client.ts, 5, 8)) >a12 : Symbol(y, Decl(client.ts, 5, 11)) >y : Symbol(y, Decl(client.ts, 5, 11)) @@ -72,7 +72,7 @@ export var xxxx3 = new y(); >xxxx3 : Symbol(xxxx3, Decl(client.ts, 7, 10)) >y : Symbol(y, Decl(client.ts, 5, 11)) -import { x11 as z, } from "server"; +import { x11 as z, } from "./server"; >x11 : Symbol(z, Decl(client.ts, 8, 8)) >z : Symbol(z, Decl(client.ts, 8, 8)) @@ -80,14 +80,14 @@ export var xxxx4 = new z(); >xxxx4 : Symbol(xxxx4, Decl(client.ts, 9, 10)) >z : Symbol(z, Decl(client.ts, 8, 8)) -import { m, } from "server"; +import { m, } from "./server"; >m : Symbol(m, Decl(client.ts, 10, 8)) export var xxxx5 = new m(); >xxxx5 : Symbol(xxxx5, Decl(client.ts, 11, 10)) >m : Symbol(m, Decl(client.ts, 10, 8)) -import { a1, x1 } from "server"; +import { a1, x1 } from "./server"; >a1 : Symbol(a1, Decl(client.ts, 12, 8)) >x1 : Symbol(x1, Decl(client.ts, 12, 12)) @@ -99,7 +99,7 @@ export var xxxx7 = new x1(); >xxxx7 : Symbol(xxxx7, Decl(client.ts, 14, 10)) >x1 : Symbol(x1, Decl(client.ts, 12, 12)) -import { a111 as a11, x111 as x11 } from "server"; +import { a111 as a11, x111 as x11 } from "./server"; >a111 : Symbol(a11, Decl(client.ts, 15, 8)) >a11 : Symbol(a11, Decl(client.ts, 15, 8)) >x111 : Symbol(x11, Decl(client.ts, 15, 21)) @@ -113,14 +113,14 @@ export var xxxx9 = new x11(); >xxxx9 : Symbol(xxxx9, Decl(client.ts, 17, 10)) >x11 : Symbol(x11, Decl(client.ts, 15, 21)) -import { z1 } from "server"; +import { z1 } from "./server"; >z1 : Symbol(z1, Decl(client.ts, 18, 8)) export var z111 = new z1(); >z111 : Symbol(z111, Decl(client.ts, 19, 10)) >z1 : Symbol(z1, Decl(client.ts, 18, 8)) -import { z2 as z3 } from "server"; +import { z2 as z3 } from "./server"; >z2 : Symbol(z3, Decl(client.ts, 20, 8)) >z3 : Symbol(z3, Decl(client.ts, 20, 8)) @@ -129,10 +129,10 @@ export var z2 = new z3(); // z2 shouldn't give redeclare error >z3 : Symbol(z3, Decl(client.ts, 20, 8)) // not referenced -import { aaaa } from "server"; +import { aaaa } from "./server"; >aaaa : Symbol(aaaa, Decl(client.ts, 24, 8)) -import { aaaa1 as bbbb } from "server"; +import { aaaa1 as bbbb } from "./server"; >aaaa1 : Symbol(bbbb, Decl(client.ts, 25, 8)) >bbbb : Symbol(bbbb, Decl(client.ts, 25, 8)) diff --git a/tests/baselines/reference/es6ImportNamedImportDts.types b/tests/baselines/reference/es6ImportNamedImportDts.types index 93bd55716a5..9aba1012117 100644 --- a/tests/baselines/reference/es6ImportNamedImportDts.types +++ b/tests/baselines/reference/es6ImportNamedImportDts.types @@ -43,8 +43,8 @@ export class aaaa1 { } >aaaa1 : aaaa1 === tests/cases/compiler/client.ts === -import { } from "server"; -import { a } from "server"; +import { } from "./server"; +import { a } from "./server"; >a : typeof a export var xxxx = new a(); @@ -52,7 +52,7 @@ export var xxxx = new a(); >new a() : a >a : typeof a -import { a11 as b } from "server"; +import { a11 as b } from "./server"; >a11 : typeof b >b : typeof b @@ -61,7 +61,7 @@ export var xxxx1 = new b(); >new b() : b >b : typeof b -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; >x : typeof x >a12 : typeof y >y : typeof y @@ -76,7 +76,7 @@ export var xxxx3 = new y(); >new y() : y >y : typeof y -import { x11 as z, } from "server"; +import { x11 as z, } from "./server"; >x11 : typeof z >z : typeof z @@ -85,7 +85,7 @@ export var xxxx4 = new z(); >new z() : z >z : typeof z -import { m, } from "server"; +import { m, } from "./server"; >m : typeof m export var xxxx5 = new m(); @@ -93,7 +93,7 @@ export var xxxx5 = new m(); >new m() : m >m : typeof m -import { a1, x1 } from "server"; +import { a1, x1 } from "./server"; >a1 : typeof a1 >x1 : typeof x1 @@ -107,7 +107,7 @@ export var xxxx7 = new x1(); >new x1() : x1 >x1 : typeof x1 -import { a111 as a11, x111 as x11 } from "server"; +import { a111 as a11, x111 as x11 } from "./server"; >a111 : typeof a11 >a11 : typeof a11 >x111 : typeof x11 @@ -123,7 +123,7 @@ export var xxxx9 = new x11(); >new x11() : x11 >x11 : typeof x11 -import { z1 } from "server"; +import { z1 } from "./server"; >z1 : typeof z1 export var z111 = new z1(); @@ -131,7 +131,7 @@ export var z111 = new z1(); >new z1() : z1 >z1 : typeof z1 -import { z2 as z3 } from "server"; +import { z2 as z3 } from "./server"; >z2 : typeof z3 >z3 : typeof z3 @@ -141,10 +141,10 @@ export var z2 = new z3(); // z2 shouldn't give redeclare error >z3 : typeof z3 // not referenced -import { aaaa } from "server"; +import { aaaa } from "./server"; >aaaa : typeof aaaa -import { aaaa1 as bbbb } from "server"; +import { aaaa1 as bbbb } from "./server"; >aaaa1 : typeof bbbb >bbbb : typeof bbbb diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.js b/tests/baselines/reference/es6ImportNamedImportInEs5.js index 9992508c00b..ce2cbea3d3d 100644 --- a/tests/baselines/reference/es6ImportNamedImportInEs5.js +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.js @@ -12,33 +12,33 @@ export var z2 = 10; export var aaaa = 10; //// [es6ImportNamedImportInEs5_1.ts] -import { } from "es6ImportNamedImportInEs5_0"; -import { a } from "es6ImportNamedImportInEs5_0"; +import { } from "./es6ImportNamedImportInEs5_0"; +import { a } from "./es6ImportNamedImportInEs5_0"; var xxxx = a; -import { a as b } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "./es6ImportNamedImportInEs5_0"; var xxxx = b; -import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "./es6ImportNamedImportInEs5_0"; var xxxx = x; var xxxx = y; -import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "./es6ImportNamedImportInEs5_0"; var xxxx = z; -import { m, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "./es6ImportNamedImportInEs5_0"; var xxxx = m; -import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "./es6ImportNamedImportInEs5_0"; var xxxx = a1; var xxxx = x1; -import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImportInEs5_0"; var xxxx = a11; var xxxx = x11; -import { z1 } from "es6ImportNamedImportInEs5_0"; +import { z1 } from "./es6ImportNamedImportInEs5_0"; var z111 = z1; -import { z2 as z3 } from "es6ImportNamedImportInEs5_0"; +import { z2 as z3 } from "./es6ImportNamedImportInEs5_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided -import { aaaa } from "es6ImportNamedImportInEs5_0"; +import { aaaa } from "./es6ImportNamedImportInEs5_0"; // These are elided -import { aaaa as bbbb } from "es6ImportNamedImportInEs5_0"; +import { aaaa as bbbb } from "./es6ImportNamedImportInEs5_0"; //// [es6ImportNamedImportInEs5_0.js] @@ -51,26 +51,26 @@ exports.z1 = 10; exports.z2 = 10; exports.aaaa = 10; //// [es6ImportNamedImportInEs5_1.js] -var es6ImportNamedImportInEs5_0_1 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_1 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_1.a; -var es6ImportNamedImportInEs5_0_2 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_2 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_2.a; -var es6ImportNamedImportInEs5_0_3 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_3 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_3.x; var xxxx = es6ImportNamedImportInEs5_0_3.a; -var es6ImportNamedImportInEs5_0_4 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_4 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_4.x; -var es6ImportNamedImportInEs5_0_5 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_5 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_5.m; -var es6ImportNamedImportInEs5_0_6 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_6 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_6.a1; var xxxx = es6ImportNamedImportInEs5_0_6.x1; -var es6ImportNamedImportInEs5_0_7 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_7 = require("./es6ImportNamedImportInEs5_0"); var xxxx = es6ImportNamedImportInEs5_0_7.a1; var xxxx = es6ImportNamedImportInEs5_0_7.x1; -var es6ImportNamedImportInEs5_0_8 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_8 = require("./es6ImportNamedImportInEs5_0"); var z111 = es6ImportNamedImportInEs5_0_8.z1; -var es6ImportNamedImportInEs5_0_9 = require("es6ImportNamedImportInEs5_0"); +var es6ImportNamedImportInEs5_0_9 = require("./es6ImportNamedImportInEs5_0"); var z2 = es6ImportNamedImportInEs5_0_9.z2; // z2 shouldn't give redeclare error diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.symbols b/tests/baselines/reference/es6ImportNamedImportInEs5.symbols index 546487514ce..f9e949e7efb 100644 --- a/tests/baselines/reference/es6ImportNamedImportInEs5.symbols +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.symbols @@ -27,15 +27,15 @@ export var aaaa = 10; >aaaa : Symbol(aaaa, Decl(es6ImportNamedImportInEs5_0.ts, 8, 10)) === tests/cases/compiler/es6ImportNamedImportInEs5_1.ts === -import { } from "es6ImportNamedImportInEs5_0"; -import { a } from "es6ImportNamedImportInEs5_0"; +import { } from "./es6ImportNamedImportInEs5_0"; +import { a } from "./es6ImportNamedImportInEs5_0"; >a : Symbol(a, Decl(es6ImportNamedImportInEs5_1.ts, 1, 8)) var xxxx = a; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >a : Symbol(a, Decl(es6ImportNamedImportInEs5_1.ts, 1, 8)) -import { a as b } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "./es6ImportNamedImportInEs5_0"; >a : Symbol(b, Decl(es6ImportNamedImportInEs5_1.ts, 3, 8)) >b : Symbol(b, Decl(es6ImportNamedImportInEs5_1.ts, 3, 8)) @@ -43,7 +43,7 @@ var xxxx = b; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >b : Symbol(b, Decl(es6ImportNamedImportInEs5_1.ts, 3, 8)) -import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "./es6ImportNamedImportInEs5_0"; >x : Symbol(x, Decl(es6ImportNamedImportInEs5_1.ts, 5, 8)) >a : Symbol(y, Decl(es6ImportNamedImportInEs5_1.ts, 5, 11)) >y : Symbol(y, Decl(es6ImportNamedImportInEs5_1.ts, 5, 11)) @@ -56,7 +56,7 @@ var xxxx = y; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >y : Symbol(y, Decl(es6ImportNamedImportInEs5_1.ts, 5, 11)) -import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "./es6ImportNamedImportInEs5_0"; >x : Symbol(z, Decl(es6ImportNamedImportInEs5_1.ts, 8, 8)) >z : Symbol(z, Decl(es6ImportNamedImportInEs5_1.ts, 8, 8)) @@ -64,14 +64,14 @@ var xxxx = z; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >z : Symbol(z, Decl(es6ImportNamedImportInEs5_1.ts, 8, 8)) -import { m, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "./es6ImportNamedImportInEs5_0"; >m : Symbol(m, Decl(es6ImportNamedImportInEs5_1.ts, 10, 8)) var xxxx = m; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >m : Symbol(m, Decl(es6ImportNamedImportInEs5_1.ts, 10, 8)) -import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "./es6ImportNamedImportInEs5_0"; >a1 : Symbol(a1, Decl(es6ImportNamedImportInEs5_1.ts, 12, 8)) >x1 : Symbol(x1, Decl(es6ImportNamedImportInEs5_1.ts, 12, 12)) @@ -83,7 +83,7 @@ var xxxx = x1; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >x1 : Symbol(x1, Decl(es6ImportNamedImportInEs5_1.ts, 12, 12)) -import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImportInEs5_0"; >a1 : Symbol(a11, Decl(es6ImportNamedImportInEs5_1.ts, 15, 8)) >a11 : Symbol(a11, Decl(es6ImportNamedImportInEs5_1.ts, 15, 8)) >x1 : Symbol(x11, Decl(es6ImportNamedImportInEs5_1.ts, 15, 19)) @@ -97,14 +97,14 @@ var xxxx = x11; >xxxx : Symbol(xxxx, Decl(es6ImportNamedImportInEs5_1.ts, 2, 3), Decl(es6ImportNamedImportInEs5_1.ts, 4, 3), Decl(es6ImportNamedImportInEs5_1.ts, 6, 3), Decl(es6ImportNamedImportInEs5_1.ts, 7, 3), Decl(es6ImportNamedImportInEs5_1.ts, 9, 3), Decl(es6ImportNamedImportInEs5_1.ts, 11, 3), Decl(es6ImportNamedImportInEs5_1.ts, 13, 3), Decl(es6ImportNamedImportInEs5_1.ts, 14, 3), Decl(es6ImportNamedImportInEs5_1.ts, 16, 3), Decl(es6ImportNamedImportInEs5_1.ts, 17, 3)) >x11 : Symbol(x11, Decl(es6ImportNamedImportInEs5_1.ts, 15, 19)) -import { z1 } from "es6ImportNamedImportInEs5_0"; +import { z1 } from "./es6ImportNamedImportInEs5_0"; >z1 : Symbol(z1, Decl(es6ImportNamedImportInEs5_1.ts, 18, 8)) var z111 = z1; >z111 : Symbol(z111, Decl(es6ImportNamedImportInEs5_1.ts, 19, 3)) >z1 : Symbol(z1, Decl(es6ImportNamedImportInEs5_1.ts, 18, 8)) -import { z2 as z3 } from "es6ImportNamedImportInEs5_0"; +import { z2 as z3 } from "./es6ImportNamedImportInEs5_0"; >z2 : Symbol(z3, Decl(es6ImportNamedImportInEs5_1.ts, 20, 8)) >z3 : Symbol(z3, Decl(es6ImportNamedImportInEs5_1.ts, 20, 8)) @@ -113,11 +113,11 @@ var z2 = z3; // z2 shouldn't give redeclare error >z3 : Symbol(z3, Decl(es6ImportNamedImportInEs5_1.ts, 20, 8)) // These are elided -import { aaaa } from "es6ImportNamedImportInEs5_0"; +import { aaaa } from "./es6ImportNamedImportInEs5_0"; >aaaa : Symbol(aaaa, Decl(es6ImportNamedImportInEs5_1.ts, 24, 8)) // These are elided -import { aaaa as bbbb } from "es6ImportNamedImportInEs5_0"; +import { aaaa as bbbb } from "./es6ImportNamedImportInEs5_0"; >aaaa : Symbol(bbbb, Decl(es6ImportNamedImportInEs5_1.ts, 26, 8)) >bbbb : Symbol(bbbb, Decl(es6ImportNamedImportInEs5_1.ts, 26, 8)) diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.types b/tests/baselines/reference/es6ImportNamedImportInEs5.types index 95f784c5eac..1d55b4bf51e 100644 --- a/tests/baselines/reference/es6ImportNamedImportInEs5.types +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.types @@ -33,15 +33,15 @@ export var aaaa = 10; >10 : number === tests/cases/compiler/es6ImportNamedImportInEs5_1.ts === -import { } from "es6ImportNamedImportInEs5_0"; -import { a } from "es6ImportNamedImportInEs5_0"; +import { } from "./es6ImportNamedImportInEs5_0"; +import { a } from "./es6ImportNamedImportInEs5_0"; >a : number var xxxx = a; >xxxx : number >a : number -import { a as b } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "./es6ImportNamedImportInEs5_0"; >a : number >b : number @@ -49,7 +49,7 @@ var xxxx = b; >xxxx : number >b : number -import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "./es6ImportNamedImportInEs5_0"; >x : number >a : number >y : number @@ -62,7 +62,7 @@ var xxxx = y; >xxxx : number >y : number -import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "./es6ImportNamedImportInEs5_0"; >x : number >z : number @@ -70,14 +70,14 @@ var xxxx = z; >xxxx : number >z : number -import { m, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "./es6ImportNamedImportInEs5_0"; >m : number var xxxx = m; >xxxx : number >m : number -import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "./es6ImportNamedImportInEs5_0"; >a1 : number >x1 : number @@ -89,7 +89,7 @@ var xxxx = x1; >xxxx : number >x1 : number -import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImportInEs5_0"; >a1 : number >a11 : number >x1 : number @@ -103,14 +103,14 @@ var xxxx = x11; >xxxx : number >x11 : number -import { z1 } from "es6ImportNamedImportInEs5_0"; +import { z1 } from "./es6ImportNamedImportInEs5_0"; >z1 : number var z111 = z1; >z111 : number >z1 : number -import { z2 as z3 } from "es6ImportNamedImportInEs5_0"; +import { z2 as z3 } from "./es6ImportNamedImportInEs5_0"; >z2 : number >z3 : number @@ -119,11 +119,11 @@ var z2 = z3; // z2 shouldn't give redeclare error >z3 : number // These are elided -import { aaaa } from "es6ImportNamedImportInEs5_0"; +import { aaaa } from "./es6ImportNamedImportInEs5_0"; >aaaa : number // These are elided -import { aaaa as bbbb } from "es6ImportNamedImportInEs5_0"; +import { aaaa as bbbb } from "./es6ImportNamedImportInEs5_0"; >aaaa : number >bbbb : number diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt index 970c51973b2..fec4d182158 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts(2,1): error TS1 export var a = 10; ==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts (1 errors) ==== - import { a } from "es6ImportNamedImportInExportAssignment_0"; + import { a } from "./es6ImportNamedImportInExportAssignment_0"; export = a; ~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js index eab345e4e7f..44ac0d188b3 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js @@ -5,17 +5,17 @@ export var a = 10; //// [es6ImportNamedImportInExportAssignment_1.ts] -import { a } from "es6ImportNamedImportInExportAssignment_0"; +import { a } from "./es6ImportNamedImportInExportAssignment_0"; export = a; //// [es6ImportNamedImportInExportAssignment_0.js] export var a = 10; //// [es6ImportNamedImportInExportAssignment_1.js] -import { a } from "es6ImportNamedImportInExportAssignment_0"; +import { a } from "./es6ImportNamedImportInExportAssignment_0"; //// [es6ImportNamedImportInExportAssignment_0.d.ts] export declare var a: number; //// [es6ImportNamedImportInExportAssignment_1.d.ts] -import { a } from "es6ImportNamedImportInExportAssignment_0"; +import { a } from "./es6ImportNamedImportInExportAssignment_0"; export = a; diff --git a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.js b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.js index f457e31f53c..418cd76c907 100644 --- a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.js +++ b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.js @@ -8,7 +8,7 @@ export module a { } //// [es6ImportNamedImportInIndirectExportAssignment_1.ts] -import { a } from "es6ImportNamedImportInIndirectExportAssignment_0"; +import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; import x = a; export = x; @@ -23,7 +23,7 @@ var a; a.c = c; })(a = exports.a || (exports.a = {})); //// [es6ImportNamedImportInIndirectExportAssignment_1.js] -var es6ImportNamedImportInIndirectExportAssignment_0_1 = require("es6ImportNamedImportInIndirectExportAssignment_0"); +var es6ImportNamedImportInIndirectExportAssignment_0_1 = require("./es6ImportNamedImportInIndirectExportAssignment_0"); var x = es6ImportNamedImportInIndirectExportAssignment_0_1.a; module.exports = x; @@ -34,6 +34,6 @@ export declare module a { } } //// [es6ImportNamedImportInIndirectExportAssignment_1.d.ts] -import { a } from "es6ImportNamedImportInIndirectExportAssignment_0"; +import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; import x = a; export = x; diff --git a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.symbols b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.symbols index 2598735d6d8..24eab96f54b 100644 --- a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.symbols +++ b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.symbols @@ -9,13 +9,13 @@ export module a { } === tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment_1.ts === -import { a } from "es6ImportNamedImportInIndirectExportAssignment_0"; +import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; >a : Symbol(a, Decl(es6ImportNamedImportInIndirectExportAssignment_1.ts, 0, 8)) import x = a; ->x : Symbol(x, Decl(es6ImportNamedImportInIndirectExportAssignment_1.ts, 0, 69)) +>x : Symbol(x, Decl(es6ImportNamedImportInIndirectExportAssignment_1.ts, 0, 71)) >a : Symbol(a, Decl(es6ImportNamedImportInIndirectExportAssignment_0.ts, 0, 0)) export = x; ->x : Symbol(x, Decl(es6ImportNamedImportInIndirectExportAssignment_1.ts, 0, 69)) +>x : Symbol(x, Decl(es6ImportNamedImportInIndirectExportAssignment_1.ts, 0, 71)) diff --git a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.types b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.types index 36792ece82e..d4dd62aacb2 100644 --- a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.types +++ b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.types @@ -9,7 +9,7 @@ export module a { } === tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment_1.ts === -import { a } from "es6ImportNamedImportInIndirectExportAssignment_0"; +import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; >a : typeof a import x = a; diff --git a/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt b/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt index b9461b6caca..4fca12ee8e1 100644 --- a/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt @@ -12,22 +12,22 @@ tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(10,16): error TS2300: export var z1 = a; ==== tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts (4 errors) ==== - import { a } from "es6ImportNamedImportMergeErrors_0"; + import { a } from "./es6ImportNamedImportMergeErrors_0"; interface a { } // shouldnt be error - import { x as x1 } from "es6ImportNamedImportMergeErrors_0"; + import { x as x1 } from "./es6ImportNamedImportMergeErrors_0"; interface x1 { } // shouldnt be error - import { x } from "es6ImportNamedImportMergeErrors_0"; // should be error + import { x } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~ !!! error TS2440: Import declaration conflicts with local declaration of 'x' var x = 10; - import { x as x44 } from "es6ImportNamedImportMergeErrors_0"; // should be error + import { x as x44 } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~~~~~~~~ !!! error TS2440: Import declaration conflicts with local declaration of 'x44' var x44 = 10; - import { z } from "es6ImportNamedImportMergeErrors_0"; // should be error + import { z } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~ !!! error TS2300: Duplicate identifier 'z'. - import { z1 as z } from "es6ImportNamedImportMergeErrors_0"; // should be error + import { z1 as z } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~ !!! error TS2300: Duplicate identifier 'z'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportMergeErrors.js b/tests/baselines/reference/es6ImportNamedImportMergeErrors.js index fad411f557d..63bf1127a53 100644 --- a/tests/baselines/reference/es6ImportNamedImportMergeErrors.js +++ b/tests/baselines/reference/es6ImportNamedImportMergeErrors.js @@ -8,16 +8,16 @@ export var z = a; export var z1 = a; //// [es6ImportNamedImportMergeErrors_1.ts] -import { a } from "es6ImportNamedImportMergeErrors_0"; +import { a } from "./es6ImportNamedImportMergeErrors_0"; interface a { } // shouldnt be error -import { x as x1 } from "es6ImportNamedImportMergeErrors_0"; +import { x as x1 } from "./es6ImportNamedImportMergeErrors_0"; interface x1 { } // shouldnt be error -import { x } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { x } from "./es6ImportNamedImportMergeErrors_0"; // should be error var x = 10; -import { x as x44 } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { x as x44 } from "./es6ImportNamedImportMergeErrors_0"; // should be error var x44 = 10; -import { z } from "es6ImportNamedImportMergeErrors_0"; // should be error -import { z1 as z } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { z } from "./es6ImportNamedImportMergeErrors_0"; // should be error +import { z1 as z } from "./es6ImportNamedImportMergeErrors_0"; // should be error //// [es6ImportNamedImportMergeErrors_0.js] diff --git a/tests/baselines/reference/es6ImportNamedImportNoExportMember.errors.txt b/tests/baselines/reference/es6ImportNamedImportNoExportMember.errors.txt index 57a77410cb2..47a836fd422 100644 --- a/tests/baselines/reference/es6ImportNamedImportNoExportMember.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportNoExportMember.errors.txt @@ -8,9 +8,9 @@ tests/cases/compiler/es6ImportNamedImport_1.ts(2,10): error TS2305: Module '"tes export var x = a; ==== tests/cases/compiler/es6ImportNamedImport_1.ts (2 errors) ==== - import { a1 } from "es6ImportNamedImportNoExportMember_0"; + import { a1 } from "./es6ImportNamedImportNoExportMember_0"; ~~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportNamedImportNoExportMember_0"' has no exported member 'a1'. - import { x1 as x } from "es6ImportNamedImportNoExportMember_0"; + import { x1 as x } from "./es6ImportNamedImportNoExportMember_0"; ~~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportNamedImportNoExportMember_0"' has no exported member 'x1'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportNoExportMember.js b/tests/baselines/reference/es6ImportNamedImportNoExportMember.js index da473fa42a3..ba607b4626f 100644 --- a/tests/baselines/reference/es6ImportNamedImportNoExportMember.js +++ b/tests/baselines/reference/es6ImportNamedImportNoExportMember.js @@ -6,8 +6,8 @@ export var a = 10; export var x = a; //// [es6ImportNamedImport_1.ts] -import { a1 } from "es6ImportNamedImportNoExportMember_0"; -import { x1 as x } from "es6ImportNamedImportNoExportMember_0"; +import { a1 } from "./es6ImportNamedImportNoExportMember_0"; +import { x1 as x } from "./es6ImportNamedImportNoExportMember_0"; //// [es6ImportNamedImportNoExportMember_0.js] exports.a = 10; diff --git a/tests/baselines/reference/es6ImportNamedImportNoNamedExports.errors.txt b/tests/baselines/reference/es6ImportNamedImportNoNamedExports.errors.txt index a5abd986ee8..e2cacba59e8 100644 --- a/tests/baselines/reference/es6ImportNamedImportNoNamedExports.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportNoNamedExports.errors.txt @@ -8,9 +8,9 @@ tests/cases/compiler/es6ImportNamedImportNoNamedExports_1.ts(2,10): error TS2305 export = a; ==== tests/cases/compiler/es6ImportNamedImportNoNamedExports_1.ts (2 errors) ==== - import { a } from "es6ImportNamedImportNoNamedExports_0"; + import { a } from "./es6ImportNamedImportNoNamedExports_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportNamedImportNoNamedExports_0"' has no exported member 'a'. - import { a as x } from "es6ImportNamedImportNoNamedExports_0"; + import { a as x } from "./es6ImportNamedImportNoNamedExports_0"; ~ !!! error TS2305: Module '"tests/cases/compiler/es6ImportNamedImportNoNamedExports_0"' has no exported member 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportNoNamedExports.js b/tests/baselines/reference/es6ImportNamedImportNoNamedExports.js index 524860827e6..273f9a3fc3a 100644 --- a/tests/baselines/reference/es6ImportNamedImportNoNamedExports.js +++ b/tests/baselines/reference/es6ImportNamedImportNoNamedExports.js @@ -6,8 +6,8 @@ var a = 10; export = a; //// [es6ImportNamedImportNoNamedExports_1.ts] -import { a } from "es6ImportNamedImportNoNamedExports_0"; -import { a as x } from "es6ImportNamedImportNoNamedExports_0"; +import { a } from "./es6ImportNamedImportNoNamedExports_0"; +import { a as x } from "./es6ImportNamedImportNoNamedExports_0"; //// [es6ImportNamedImportNoNamedExports_0.js] var a = 10; diff --git a/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt b/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt index ff8fe604622..a5a4301683e 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt @@ -24,54 +24,54 @@ tests/cases/compiler/client.ts(26,1): error TS1191: An import declaration cannot export var aaaa = 10; ==== tests/cases/compiler/client.ts (12 errors) ==== - export import { } from "server"; + export import { } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. - export import { a } from "server"; + export import { a } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a; - export import { a as b } from "server"; + export import { a as b } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = b; - export import { x, a as y } from "server"; + export import { x, a as y } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = x; export var xxxx = y; - export import { x as z, } from "server"; + export import { x as z, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = z; - export import { m, } from "server"; + export import { m, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = m; - export import { a1, x1 } from "server"; + export import { a1, x1 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a1; export var xxxx = x1; - export import { a1 as a11, x1 as x11 } from "server"; + export import { a1 as a11, x1 as x11 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a11; export var xxxx = x11; - export import { z1 } from "server"; + export import { z1 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var z111 = z1; - export import { z2 as z3 } from "server"; + export import { z2 as z3 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var z2 = z3; // z2 shouldn't give redeclare error // Non referenced imports - export import { aaaa } from "server"; + export import { aaaa } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. - export import { aaaa as bbbb } from "server"; + export import { aaaa as bbbb } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportWithExport.js b/tests/baselines/reference/es6ImportNamedImportWithExport.js index 60ba6bf706b..5175554f0f9 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithExport.js +++ b/tests/baselines/reference/es6ImportNamedImportWithExport.js @@ -12,32 +12,32 @@ export var z2 = 10; export var aaaa = 10; //// [client.ts] -export import { } from "server"; -export import { a } from "server"; +export import { } from "./server"; +export import { a } from "./server"; export var xxxx = a; -export import { a as b } from "server"; +export import { a as b } from "./server"; export var xxxx = b; -export import { x, a as y } from "server"; +export import { x, a as y } from "./server"; export var xxxx = x; export var xxxx = y; -export import { x as z, } from "server"; +export import { x as z, } from "./server"; export var xxxx = z; -export import { m, } from "server"; +export import { m, } from "./server"; export var xxxx = m; -export import { a1, x1 } from "server"; +export import { a1, x1 } from "./server"; export var xxxx = a1; export var xxxx = x1; -export import { a1 as a11, x1 as x11 } from "server"; +export import { a1 as a11, x1 as x11 } from "./server"; export var xxxx = a11; export var xxxx = x11; -export import { z1 } from "server"; +export import { z1 } from "./server"; export var z111 = z1; -export import { z2 as z3 } from "server"; +export import { z2 as z3 } from "./server"; export var z2 = z3; // z2 shouldn't give redeclare error // Non referenced imports -export import { aaaa } from "server"; -export import { aaaa as bbbb } from "server"; +export import { aaaa } from "./server"; +export import { aaaa as bbbb } from "./server"; //// [server.js] @@ -50,26 +50,26 @@ exports.z1 = 10; exports.z2 = 10; exports.aaaa = 10; //// [client.js] -var server_1 = require("server"); +var server_1 = require("./server"); exports.xxxx = server_1.a; -var server_2 = require("server"); +var server_2 = require("./server"); exports.xxxx = server_2.a; -var server_3 = require("server"); +var server_3 = require("./server"); exports.xxxx = server_3.x; exports.xxxx = server_3.a; -var server_4 = require("server"); +var server_4 = require("./server"); exports.xxxx = server_4.x; -var server_5 = require("server"); +var server_5 = require("./server"); exports.xxxx = server_5.m; -var server_6 = require("server"); +var server_6 = require("./server"); exports.xxxx = server_6.a1; exports.xxxx = server_6.x1; -var server_7 = require("server"); +var server_7 = require("./server"); exports.xxxx = server_7.a1; exports.xxxx = server_7.x1; -var server_8 = require("server"); +var server_8 = require("./server"); exports.z111 = server_8.z1; -var server_9 = require("server"); +var server_9 = require("./server"); exports.z2 = server_9.z2; // z2 shouldn't give redeclare error diff --git a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.js b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.js index dcf99c5359a..8593f4e6343 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.js +++ b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.js @@ -16,7 +16,7 @@ export class C2 implements I2 { } //// [client.ts] -import { C, I, C2 } from "server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file +import { C, I, C2 } from "./server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file export type cValInterface = I; export var cVal = new C(); @@ -36,7 +36,7 @@ var C2 = (function () { })(); exports.C2 = C2; //// [client.js] -var server_1 = require("server"); // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file +var server_1 = require("./server"); // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file exports.cVal = new server_1.C(); @@ -54,6 +54,6 @@ export declare class C2 implements I2 { prop2: string; } //// [client.d.ts] -import { C, I } from "server"; +import { C, I } from "./server"; export declare type cValInterface = I; export declare var cVal: C; diff --git a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols index e294124c6f4..cff0406b220 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols +++ b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.symbols @@ -28,13 +28,13 @@ export class C2 implements I2 { } === tests/cases/compiler/client.ts === -import { C, I, C2 } from "server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file +import { C, I, C2 } from "./server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file >C : Symbol(C, Decl(client.ts, 0, 8)) >I : Symbol(I, Decl(client.ts, 0, 11)) >C2 : Symbol(C2, Decl(client.ts, 0, 14)) export type cValInterface = I; ->cValInterface : Symbol(cValInterface, Decl(client.ts, 0, 34)) +>cValInterface : Symbol(cValInterface, Decl(client.ts, 0, 36)) >I : Symbol(I, Decl(client.ts, 0, 11)) export var cVal = new C(); diff --git a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.types b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.types index 12e5271c8b0..a65a2978e1b 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.types +++ b/tests/baselines/reference/es6ImportNamedImportWithTypesAndValues.types @@ -30,7 +30,7 @@ export class C2 implements I2 { } === tests/cases/compiler/client.ts === -import { C, I, C2 } from "server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file +import { C, I, C2 } from "./server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file >C : typeof C >I : any >C2 : typeof C2 diff --git a/tests/baselines/reference/exportAssignClassAndModule.js b/tests/baselines/reference/exportAssignClassAndModule.js index 37fecdcc53f..d440fb9a8e5 100644 --- a/tests/baselines/reference/exportAssignClassAndModule.js +++ b/tests/baselines/reference/exportAssignClassAndModule.js @@ -12,7 +12,7 @@ export = Foo; //// [exportAssignClassAndModule_1.ts] /// -import Foo = require('exportAssignClassAndModule_0'); +import Foo = require('./exportAssignClassAndModule_0'); var z: Foo.Bar; var zz: Foo; diff --git a/tests/baselines/reference/exportAssignClassAndModule.symbols b/tests/baselines/reference/exportAssignClassAndModule.symbols index 9f38ed80b1b..016e91f79a2 100644 --- a/tests/baselines/reference/exportAssignClassAndModule.symbols +++ b/tests/baselines/reference/exportAssignClassAndModule.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/exportAssignClassAndModule_1.ts === /// -import Foo = require('exportAssignClassAndModule_0'); +import Foo = require('./exportAssignClassAndModule_0'); >Foo : Symbol(Foo, Decl(exportAssignClassAndModule_1.ts, 0, 0)) var z: Foo.Bar; diff --git a/tests/baselines/reference/exportAssignClassAndModule.types b/tests/baselines/reference/exportAssignClassAndModule.types index aa1ede6b2d4..5517d32badc 100644 --- a/tests/baselines/reference/exportAssignClassAndModule.types +++ b/tests/baselines/reference/exportAssignClassAndModule.types @@ -1,6 +1,6 @@ === tests/cases/compiler/exportAssignClassAndModule_1.ts === /// -import Foo = require('exportAssignClassAndModule_0'); +import Foo = require('./exportAssignClassAndModule_0'); >Foo : typeof Foo var z: Foo.Bar; diff --git a/tests/baselines/reference/exportAssignmentEnum.js b/tests/baselines/reference/exportAssignmentEnum.js index a484e43738f..06438fb2b53 100644 --- a/tests/baselines/reference/exportAssignmentEnum.js +++ b/tests/baselines/reference/exportAssignmentEnum.js @@ -10,7 +10,7 @@ enum E { export = E; //// [exportAssignmentEnum_B.ts] -import EnumE = require("exportAssignmentEnum_A"); +import EnumE = require("./exportAssignmentEnum_A"); var a = EnumE.A; var b = EnumE.B; @@ -25,7 +25,7 @@ var E; })(E || (E = {})); module.exports = E; //// [exportAssignmentEnum_B.js] -var EnumE = require("exportAssignmentEnum_A"); +var EnumE = require("./exportAssignmentEnum_A"); var a = EnumE.A; var b = EnumE.B; var c = EnumE.C; diff --git a/tests/baselines/reference/exportAssignmentEnum.symbols b/tests/baselines/reference/exportAssignmentEnum.symbols index 07eb5f7b907..dea194b3508 100644 --- a/tests/baselines/reference/exportAssignmentEnum.symbols +++ b/tests/baselines/reference/exportAssignmentEnum.symbols @@ -1,5 +1,5 @@ === tests/cases/compiler/exportAssignmentEnum_B.ts === -import EnumE = require("exportAssignmentEnum_A"); +import EnumE = require("./exportAssignmentEnum_A"); >EnumE : Symbol(EnumE, Decl(exportAssignmentEnum_B.ts, 0, 0)) var a = EnumE.A; diff --git a/tests/baselines/reference/exportAssignmentEnum.types b/tests/baselines/reference/exportAssignmentEnum.types index 9dfa34d3777..a186cf6f255 100644 --- a/tests/baselines/reference/exportAssignmentEnum.types +++ b/tests/baselines/reference/exportAssignmentEnum.types @@ -1,5 +1,5 @@ === tests/cases/compiler/exportAssignmentEnum_B.ts === -import EnumE = require("exportAssignmentEnum_A"); +import EnumE = require("./exportAssignmentEnum_A"); >EnumE : typeof EnumE var a = EnumE.A; diff --git a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt index f6736e468f0..b0bfac0adfd 100644 --- a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt +++ b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts(4,9): error T ==== tests/cases/compiler/exportAssignmentOfDeclaredExternalModule_1.ts (2 errors) ==== /// - import Sammy = require('exportAssignmentOfDeclaredExternalModule_0'); + import Sammy = require('./exportAssignmentOfDeclaredExternalModule_0'); var x = new Sammy(); // error to use as constructor as there is not constructor symbol ~~~~~ !!! error TS2304: Cannot find name 'Sammy'. diff --git a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.js b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.js index c8ba8324ad2..460707a3502 100644 --- a/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.js +++ b/tests/baselines/reference/exportAssignmentOfDeclaredExternalModule.js @@ -9,7 +9,7 @@ export = Sammy; //// [exportAssignmentOfDeclaredExternalModule_1.ts] /// -import Sammy = require('exportAssignmentOfDeclaredExternalModule_0'); +import Sammy = require('./exportAssignmentOfDeclaredExternalModule_0'); var x = new Sammy(); // error to use as constructor as there is not constructor symbol var y = Sammy(); // error to use interface name as call target var z: Sammy; // no error - z is of type interface Sammy from module 'M' diff --git a/tests/baselines/reference/exportAssignmentVariable.js b/tests/baselines/reference/exportAssignmentVariable.js index c20e6ec4f7b..8afbf222e6d 100644 --- a/tests/baselines/reference/exportAssignmentVariable.js +++ b/tests/baselines/reference/exportAssignmentVariable.js @@ -6,7 +6,7 @@ var x = 0; export = x; //// [exportAssignmentVariable_B.ts] -import y = require("exportAssignmentVariable_A"); +import y = require("./exportAssignmentVariable_A"); var n: number = y; @@ -14,5 +14,5 @@ var n: number = y; var x = 0; module.exports = x; //// [exportAssignmentVariable_B.js] -var y = require("exportAssignmentVariable_A"); +var y = require("./exportAssignmentVariable_A"); var n = y; diff --git a/tests/baselines/reference/exportAssignmentVariable.symbols b/tests/baselines/reference/exportAssignmentVariable.symbols index b819678d080..919a96ded33 100644 --- a/tests/baselines/reference/exportAssignmentVariable.symbols +++ b/tests/baselines/reference/exportAssignmentVariable.symbols @@ -1,5 +1,5 @@ === tests/cases/compiler/exportAssignmentVariable_B.ts === -import y = require("exportAssignmentVariable_A"); +import y = require("./exportAssignmentVariable_A"); >y : Symbol(y, Decl(exportAssignmentVariable_B.ts, 0, 0)) var n: number = y; diff --git a/tests/baselines/reference/exportAssignmentVariable.types b/tests/baselines/reference/exportAssignmentVariable.types index 71f0afdea68..7c6d9b45cce 100644 --- a/tests/baselines/reference/exportAssignmentVariable.types +++ b/tests/baselines/reference/exportAssignmentVariable.types @@ -1,5 +1,5 @@ === tests/cases/compiler/exportAssignmentVariable_B.ts === -import y = require("exportAssignmentVariable_A"); +import y = require("./exportAssignmentVariable_A"); >y : number var n: number = y; diff --git a/tests/baselines/reference/exportEqualMemberMissing.errors.txt b/tests/baselines/reference/exportEqualMemberMissing.errors.txt index 3e6e7a35a12..4cd142668b9 100644 --- a/tests/baselines/reference/exportEqualMemberMissing.errors.txt +++ b/tests/baselines/reference/exportEqualMemberMissing.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/exportEqualMemberMissing_1.ts(3,23): error TS2339: Property ==== tests/cases/compiler/exportEqualMemberMissing_1.ts (1 errors) ==== /// - import connect = require('exportEqualMemberMissing_0'); + import connect = require('./exportEqualMemberMissing_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. ~~~~~~ !!! error TS2339: Property 'static' does not exist on type '{ (): connectExport; foo: Date; }'. diff --git a/tests/baselines/reference/exportEqualMemberMissing.js b/tests/baselines/reference/exportEqualMemberMissing.js index 583176f12f3..85972ce0945 100644 --- a/tests/baselines/reference/exportEqualMemberMissing.js +++ b/tests/baselines/reference/exportEqualMemberMissing.js @@ -17,7 +17,7 @@ export = server; //// [exportEqualMemberMissing_1.ts] /// -import connect = require('exportEqualMemberMissing_0'); +import connect = require('./exportEqualMemberMissing_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. @@ -26,5 +26,5 @@ var server; module.exports = server; //// [exportEqualMemberMissing_1.js] /// -var connect = require('exportEqualMemberMissing_0'); +var connect = require('./exportEqualMemberMissing_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. diff --git a/tests/baselines/reference/exportStarFromEmptyModule.errors.txt b/tests/baselines/reference/exportStarFromEmptyModule.errors.txt index c88ac3b3f19..9d781da2707 100644 --- a/tests/baselines/reference/exportStarFromEmptyModule.errors.txt +++ b/tests/baselines/reference/exportStarFromEmptyModule.errors.txt @@ -12,17 +12,17 @@ tests/cases/compiler/exportStarFromEmptyModule_module4.ts(4,5): error TS2339: Pr // empty ==== tests/cases/compiler/exportStarFromEmptyModule_module3.ts (1 errors) ==== - export * from "exportStarFromEmptyModule_module2"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + export * from "./exportStarFromEmptyModule_module2"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2306: File 'exportStarFromEmptyModule_module2.ts' is not a module. - export * from "exportStarFromEmptyModule_module1"; + export * from "./exportStarFromEmptyModule_module1"; export class A { static q; } ==== tests/cases/compiler/exportStarFromEmptyModule_module4.ts (1 errors) ==== - import * as X from "exportStarFromEmptyModule_module3"; + import * as X from "./exportStarFromEmptyModule_module3"; var s: X.A; X.A.q; X.A.r; // Error diff --git a/tests/baselines/reference/exportStarFromEmptyModule.js b/tests/baselines/reference/exportStarFromEmptyModule.js index 9b486af4eae..d433e7b3682 100644 --- a/tests/baselines/reference/exportStarFromEmptyModule.js +++ b/tests/baselines/reference/exportStarFromEmptyModule.js @@ -10,15 +10,15 @@ export class A { // empty //// [exportStarFromEmptyModule_module3.ts] -export * from "exportStarFromEmptyModule_module2"; -export * from "exportStarFromEmptyModule_module1"; +export * from "./exportStarFromEmptyModule_module2"; +export * from "./exportStarFromEmptyModule_module1"; export class A { static q; } //// [exportStarFromEmptyModule_module4.ts] -import * as X from "exportStarFromEmptyModule_module3"; +import * as X from "./exportStarFromEmptyModule_module3"; var s: X.A; X.A.q; X.A.r; // Error @@ -36,8 +36,8 @@ exports.A = A; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } -__export(require("exportStarFromEmptyModule_module2")); -__export(require("exportStarFromEmptyModule_module1")); +__export(require("./exportStarFromEmptyModule_module2")); +__export(require("./exportStarFromEmptyModule_module1")); var A = (function () { function A() { } @@ -45,7 +45,7 @@ var A = (function () { })(); exports.A = A; //// [exportStarFromEmptyModule_module4.js] -var X = require("exportStarFromEmptyModule_module3"); +var X = require("./exportStarFromEmptyModule_module3"); var s; X.A.q; X.A.r; // Error @@ -57,8 +57,8 @@ export declare class A { } //// [exportStarFromEmptyModule_module2.d.ts] //// [exportStarFromEmptyModule_module3.d.ts] -export * from "exportStarFromEmptyModule_module2"; -export * from "exportStarFromEmptyModule_module1"; +export * from "./exportStarFromEmptyModule_module2"; +export * from "./exportStarFromEmptyModule_module1"; export declare class A { static q: any; } diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index 297a7527ec0..3c05ccc6866 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -6,21 +6,21 @@ export class Model { } //// [extendingClassFromAliasAndUsageInIndexer_moduleA.ts] -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } //// [extendingClassFromAliasAndUsageInIndexer_moduleB.ts] -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { // different interesting stuff here } //// [extendingClassFromAliasAndUsageInIndexer_main.ts] -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); -import moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); -import moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); +import moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); +import moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } @@ -45,7 +45,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -60,7 +60,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { @@ -70,8 +70,8 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_main.js] -var moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); -var moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); +var moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); +var moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); var moduleATyped = moduleA; var moduleMap = { "moduleA": moduleA, diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols index 02d57509a55..33e0c226e67 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.symbols @@ -1,15 +1,15 @@ === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_main.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 0)) -import moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); ->moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 79)) +import moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); +>moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 81)) -import moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); ->moduleB : Symbol(moduleB, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 1, 77)) +import moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); +>moduleB : Symbol(moduleB, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 1, 79)) interface IHasVisualizationModel { ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 77)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 79)) VisualizationModel: typeof Backbone.Model; >VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 3, 34)) @@ -19,19 +19,19 @@ interface IHasVisualizationModel { } var moduleATyped: IHasVisualizationModel = moduleA; >moduleATyped : Symbol(moduleATyped, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 6, 3)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 77)) ->moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 79)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 79)) +>moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 81)) var moduleMap: { [key: string]: IHasVisualizationModel } = { >moduleMap : Symbol(moduleMap, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 7, 3)) >key : Symbol(key, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 7, 18)) ->IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 77)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 2, 79)) "moduleA": moduleA, ->moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 79)) +>moduleA : Symbol(moduleA, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 0, 81)) "moduleB": moduleB ->moduleB : Symbol(moduleB, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 1, 77)) +>moduleB : Symbol(moduleB, Decl(extendingClassFromAliasAndUsageInIndexer_main.ts, 1, 79)) }; var moduleName: string; @@ -53,11 +53,11 @@ export class Model { } === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_moduleA.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_moduleA.ts, 0, 79)) +>VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_moduleA.ts, 0, 81)) >Backbone.Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_moduleA.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) @@ -66,11 +66,11 @@ export class VisualizationModel extends Backbone.Model { } === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleB.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_moduleB.ts, 0, 0)) export class VisualizationModel extends Backbone.Model { ->VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_moduleB.ts, 0, 79)) +>VisualizationModel : Symbol(VisualizationModel, Decl(extendingClassFromAliasAndUsageInIndexer_moduleB.ts, 0, 81)) >Backbone.Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) >Backbone : Symbol(Backbone, Decl(extendingClassFromAliasAndUsageInIndexer_moduleB.ts, 0, 0)) >Model : Symbol(Backbone.Model, Decl(extendingClassFromAliasAndUsageInIndexer_backbone.ts, 0, 0)) diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types index b5323ae5c85..e1bfd195698 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.types @@ -1,11 +1,11 @@ === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_main.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : typeof Backbone -import moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); +import moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); >moduleA : typeof moduleA -import moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); +import moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); >moduleB : typeof moduleB interface IHasVisualizationModel { @@ -56,7 +56,7 @@ export class Model { } === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleA.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { @@ -69,7 +69,7 @@ export class VisualizationModel extends Backbone.Model { } === tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer_moduleB.ts === -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); >Backbone : typeof Backbone export class VisualizationModel extends Backbone.Model { diff --git a/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt b/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt index c8712b20864..7825345a1b5 100644 --- a/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt +++ b/tests/baselines/reference/externalModuleExportingGenericClass.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/externalModuleExportingGenericClass_file1.ts(2,8): error TS ==== tests/cases/compiler/externalModuleExportingGenericClass_file1.ts (1 errors) ==== - import a = require('externalModuleExportingGenericClass_file0'); + import a = require('./externalModuleExportingGenericClass_file0'); var v: a; // this should report error ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/externalModuleExportingGenericClass.js b/tests/baselines/reference/externalModuleExportingGenericClass.js index 14f18ddfc04..5dc1e9bea1d 100644 --- a/tests/baselines/reference/externalModuleExportingGenericClass.js +++ b/tests/baselines/reference/externalModuleExportingGenericClass.js @@ -9,7 +9,7 @@ export = C; //// [externalModuleExportingGenericClass_file1.ts] -import a = require('externalModuleExportingGenericClass_file0'); +import a = require('./externalModuleExportingGenericClass_file0'); var v: a; // this should report error var v2: any = (new a()).foo; var v3: number = (new a()).foo; @@ -23,7 +23,7 @@ var C = (function () { })(); module.exports = C; //// [externalModuleExportingGenericClass_file1.js] -var a = require('externalModuleExportingGenericClass_file0'); +var a = require('./externalModuleExportingGenericClass_file0'); var v; // this should report error var v2 = (new a()).foo; var v3 = (new a()).foo; diff --git a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt index 8ab07c26851..a6040c154f0 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt +++ b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist ==== tests/cases/compiler/f2.ts (10 errors) ==== // all mutations below are illegal and should be fixed - import * as stuff from 'f1'; + import * as stuff from './f1'; var n = 'baz'; diff --git a/tests/baselines/reference/externalModuleImmutableBindings.js b/tests/baselines/reference/externalModuleImmutableBindings.js index 5e5ba6c2294..47d83ded80c 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.js +++ b/tests/baselines/reference/externalModuleImmutableBindings.js @@ -6,7 +6,7 @@ export var x = 1; //// [f2.ts] // all mutations below are illegal and should be fixed -import * as stuff from 'f1'; +import * as stuff from './f1'; var n = 'baz'; @@ -55,7 +55,7 @@ for ((stuff[n]) of []) {} exports.x = 1; //// [f2.js] // all mutations below are illegal and should be fixed -var stuff = require('f1'); +var stuff = require('./f1'); var n = 'baz'; stuff.x = 0; stuff['x'] = 1; diff --git a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt index 588183c6283..a0b34ecbee1 100644 --- a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt +++ b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts(3,7): error TS2339: Property 'foo' does not exist on type 'typeof "externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. +tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts(4,7): error TS2339: Property 'bar' does not exist on type 'typeof "tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. ==== tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts (1 errors) ==== /// - import file1 = require('externalModuleRefernceResolutionOrderInImportDeclaration_file1'); + import file1 = require('./externalModuleRefernceResolutionOrderInImportDeclaration_file1'); file1.foo(); - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'typeof "externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. file1.bar(); + ~~~ +!!! error TS2339: Property 'bar' does not exist on type 'typeof "tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file1"'. ==== tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration_file1.ts (0 errors) ==== diff --git a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.js b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.js index f1d1d9fb561..48411da4a02 100644 --- a/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.js +++ b/tests/baselines/reference/externalModuleRefernceResolutionOrderInImportDeclaration.js @@ -11,7 +11,7 @@ declare module "externalModuleRefernceResolutionOrderInImportDeclaration_file1" //// [externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts] /// -import file1 = require('externalModuleRefernceResolutionOrderInImportDeclaration_file1'); +import file1 = require('./externalModuleRefernceResolutionOrderInImportDeclaration_file1'); file1.foo(); file1.bar(); @@ -24,6 +24,6 @@ exports.foo = foo; ; //// [externalModuleRefernceResolutionOrderInImportDeclaration_file3.js] /// -var file1 = require('externalModuleRefernceResolutionOrderInImportDeclaration_file1'); +var file1 = require('./externalModuleRefernceResolutionOrderInImportDeclaration_file1'); file1.foo(); file1.bar(); diff --git a/tests/baselines/reference/importAsBaseClass.errors.txt b/tests/baselines/reference/importAsBaseClass.errors.txt index 835fd143f70..8f23baad543 100644 --- a/tests/baselines/reference/importAsBaseClass.errors.txt +++ b/tests/baselines/reference/importAsBaseClass.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/importAsBaseClass_1.ts(2,21): error TS2507: Type 'typeof "t ==== tests/cases/compiler/importAsBaseClass_1.ts (1 errors) ==== - import Greeter = require("importAsBaseClass_0"); + import Greeter = require("./importAsBaseClass_0"); class Hello extends Greeter { } ~~~~~~~ !!! error TS2507: Type 'typeof "tests/cases/compiler/importAsBaseClass_0"' is not a constructor function type. diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index b79905911b1..57d71af2cda 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -6,7 +6,7 @@ export class Greeter { } //// [importAsBaseClass_1.ts] -import Greeter = require("importAsBaseClass_0"); +import Greeter = require("./importAsBaseClass_0"); class Hello extends Greeter { } @@ -24,7 +24,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Greeter = require("importAsBaseClass_0"); +var Greeter = require("./importAsBaseClass_0"); var Hello = (function (_super) { __extends(Hello, _super); function Hello() { diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index fb2aa6e0d1f..4b2672c4135 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -29,7 +29,7 @@ export var x: d; export function foo(): d { return null; } //// [importDecl_require4.ts] -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); export function foo2(): m4.d { return null; } //// [importDecl_1.ts] @@ -38,7 +38,7 @@ export function foo2(): m4.d { return null; } /// /// /// -import m4 = require("importDecl_require"); // Emit used +import m4 = require("./importDecl_require"); // Emit used export var x4 = m4.x; export var d4 = m4.d; export var f4 = m4.foo(); @@ -54,16 +54,16 @@ export module m1 { } //Emit global only usage -import glo_m4 = require("importDecl_require1"); +import glo_m4 = require("./importDecl_require1"); export var useGlo_m4_d4 = glo_m4.d; export var useGlo_m4_f4 = glo_m4.foo(); //Emit even when used just in function type -import fncOnly_m4 = require("importDecl_require2"); +import fncOnly_m4 = require("./importDecl_require2"); export var useFncOnly_m4_f4 = fncOnly_m4.foo(); // only used privately no need to emit -import private_m4 = require("importDecl_require3"); +import private_m4 = require("./importDecl_require3"); export module usePrivate_m4_m1 { var x3 = private_m4.x; var d3 = private_m4.d; @@ -71,11 +71,11 @@ export module usePrivate_m4_m1 { } // Do not emit unused import -import m5 = require("importDecl_require4"); +import m5 = require("./importDecl_require4"); export var d = m5.foo2(); // Do not emit multiple used import statements -import multiImport_m4 = require("importDecl_require"); // Emit used +import multiImport_m4 = require("./importDecl_require"); // Emit used export var useMultiImport_m4_x4 = multiImport_m4.x; export var useMultiImport_m4_d4 = multiImport_m4.d; export var useMultiImport_m4_f4 = multiImport_m4.foo(); @@ -127,7 +127,7 @@ exports.foo2 = foo2; /// /// /// -var m4 = require("importDecl_require"); // Emit used +var m4 = require("./importDecl_require"); // Emit used exports.x4 = m4.x; exports.d4 = m4.d; exports.f4 = m4.foo(); @@ -141,14 +141,14 @@ var m1; var f3 = m4.foo(); })(m1 = exports.m1 || (exports.m1 = {})); //Emit global only usage -var glo_m4 = require("importDecl_require1"); +var glo_m4 = require("./importDecl_require1"); exports.useGlo_m4_d4 = glo_m4.d; exports.useGlo_m4_f4 = glo_m4.foo(); //Emit even when used just in function type -var fncOnly_m4 = require("importDecl_require2"); +var fncOnly_m4 = require("./importDecl_require2"); exports.useFncOnly_m4_f4 = fncOnly_m4.foo(); // only used privately no need to emit -var private_m4 = require("importDecl_require3"); +var private_m4 = require("./importDecl_require3"); var usePrivate_m4_m1; (function (usePrivate_m4_m1) { var x3 = private_m4.x; @@ -156,10 +156,10 @@ var usePrivate_m4_m1; var f3 = private_m4.foo(); })(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {})); // Do not emit unused import -var m5 = require("importDecl_require4"); +var m5 = require("./importDecl_require4"); exports.d = m5.foo2(); // Do not emit multiple used import statements -var multiImport_m4 = require("importDecl_require"); // Emit used +var multiImport_m4 = require("./importDecl_require"); // Emit used exports.useMultiImport_m4_x4 = multiImport_m4.x; exports.useMultiImport_m4_d4 = multiImport_m4.d; exports.useMultiImport_m4_f4 = multiImport_m4.foo(); @@ -189,7 +189,7 @@ export declare class d { export declare var x: d; export declare function foo(): d; //// [importDecl_require4.d.ts] -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); export declare function foo2(): m4.d; //// [importDecl_1.d.ts] /// @@ -197,7 +197,7 @@ export declare function foo2(): m4.d; /// /// /// -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); export declare var x4: m4.d; export declare var d4: typeof m4.d; export declare var f4: m4.d; @@ -206,10 +206,10 @@ export declare module m1 { var d2: typeof m4.d; var f2: m4.d; } -import glo_m4 = require("importDecl_require1"); +import glo_m4 = require("./importDecl_require1"); export declare var useGlo_m4_d4: typeof glo_m4.d; export declare var useGlo_m4_f4: glo_m4.d; -import fncOnly_m4 = require("importDecl_require2"); +import fncOnly_m4 = require("./importDecl_require2"); export declare var useFncOnly_m4_f4: fncOnly_m4.d; export declare module usePrivate_m4_m1 { } diff --git a/tests/baselines/reference/importDecl.symbols b/tests/baselines/reference/importDecl.symbols index 2341101b672..32b9f3bb2a7 100644 --- a/tests/baselines/reference/importDecl.symbols +++ b/tests/baselines/reference/importDecl.symbols @@ -4,7 +4,7 @@ /// /// /// -import m4 = require("importDecl_require"); // Emit used +import m4 = require("./importDecl_require"); // Emit used >m4 : Symbol(m4, Decl(importDecl_1.ts, 0, 0)) export var x4 = m4.x; @@ -66,7 +66,7 @@ export module m1 { } //Emit global only usage -import glo_m4 = require("importDecl_require1"); +import glo_m4 = require("./importDecl_require1"); >glo_m4 : Symbol(glo_m4, Decl(importDecl_1.ts, 18, 1)) export var useGlo_m4_d4 = glo_m4.d; @@ -82,7 +82,7 @@ export var useGlo_m4_f4 = glo_m4.foo(); >foo : Symbol(glo_m4.foo, Decl(importDecl_require1.ts, 3, 9)) //Emit even when used just in function type -import fncOnly_m4 = require("importDecl_require2"); +import fncOnly_m4 = require("./importDecl_require2"); >fncOnly_m4 : Symbol(fncOnly_m4, Decl(importDecl_1.ts, 23, 39)) export var useFncOnly_m4_f4 = fncOnly_m4.foo(); @@ -92,11 +92,11 @@ export var useFncOnly_m4_f4 = fncOnly_m4.foo(); >foo : Symbol(fncOnly_m4.foo, Decl(importDecl_require2.ts, 3, 16)) // only used privately no need to emit -import private_m4 = require("importDecl_require3"); +import private_m4 = require("./importDecl_require3"); >private_m4 : Symbol(private_m4, Decl(importDecl_1.ts, 27, 47)) export module usePrivate_m4_m1 { ->usePrivate_m4_m1 : Symbol(usePrivate_m4_m1, Decl(importDecl_1.ts, 30, 51)) +>usePrivate_m4_m1 : Symbol(usePrivate_m4_m1, Decl(importDecl_1.ts, 30, 53)) var x3 = private_m4.x; >x3 : Symbol(x3, Decl(importDecl_1.ts, 32, 7)) @@ -118,17 +118,17 @@ export module usePrivate_m4_m1 { } // Do not emit unused import -import m5 = require("importDecl_require4"); +import m5 = require("./importDecl_require4"); >m5 : Symbol(m5, Decl(importDecl_1.ts, 35, 1)) export var d = m5.foo2(); >d : Symbol(d, Decl(importDecl_1.ts, 39, 10)) ->m5.foo2 : Symbol(m5.foo2, Decl(importDecl_require4.ts, 0, 42)) +>m5.foo2 : Symbol(m5.foo2, Decl(importDecl_require4.ts, 0, 44)) >m5 : Symbol(m5, Decl(importDecl_1.ts, 35, 1)) ->foo2 : Symbol(m5.foo2, Decl(importDecl_require4.ts, 0, 42)) +>foo2 : Symbol(m5.foo2, Decl(importDecl_require4.ts, 0, 44)) // Do not emit multiple used import statements -import multiImport_m4 = require("importDecl_require"); // Emit used +import multiImport_m4 = require("./importDecl_require"); // Emit used >multiImport_m4 : Symbol(multiImport_m4, Decl(importDecl_1.ts, 39, 25)) export var useMultiImport_m4_x4 = multiImport_m4.x; @@ -210,11 +210,11 @@ export function foo(): d { return null; } >d : Symbol(d, Decl(importDecl_require3.ts, 0, 0)) === tests/cases/compiler/importDecl_require4.ts === -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); >m4 : Symbol(m4, Decl(importDecl_require4.ts, 0, 0)) export function foo2(): m4.d { return null; } ->foo2 : Symbol(foo2, Decl(importDecl_require4.ts, 0, 42)) +>foo2 : Symbol(foo2, Decl(importDecl_require4.ts, 0, 44)) >m4 : Symbol(m4, Decl(importDecl_require4.ts, 0, 0)) >d : Symbol(m4.d, Decl(importDecl_require.ts, 0, 0)) diff --git a/tests/baselines/reference/importDecl.types b/tests/baselines/reference/importDecl.types index 58a56281bae..7bf4da78121 100644 --- a/tests/baselines/reference/importDecl.types +++ b/tests/baselines/reference/importDecl.types @@ -4,7 +4,7 @@ /// /// /// -import m4 = require("importDecl_require"); // Emit used +import m4 = require("./importDecl_require"); // Emit used >m4 : typeof m4 export var x4 = m4.x; @@ -69,7 +69,7 @@ export module m1 { } //Emit global only usage -import glo_m4 = require("importDecl_require1"); +import glo_m4 = require("./importDecl_require1"); >glo_m4 : typeof glo_m4 export var useGlo_m4_d4 = glo_m4.d; @@ -86,7 +86,7 @@ export var useGlo_m4_f4 = glo_m4.foo(); >foo : () => glo_m4.d //Emit even when used just in function type -import fncOnly_m4 = require("importDecl_require2"); +import fncOnly_m4 = require("./importDecl_require2"); >fncOnly_m4 : typeof fncOnly_m4 export var useFncOnly_m4_f4 = fncOnly_m4.foo(); @@ -97,7 +97,7 @@ export var useFncOnly_m4_f4 = fncOnly_m4.foo(); >foo : () => fncOnly_m4.d // only used privately no need to emit -import private_m4 = require("importDecl_require3"); +import private_m4 = require("./importDecl_require3"); >private_m4 : typeof private_m4 export module usePrivate_m4_m1 { @@ -124,7 +124,7 @@ export module usePrivate_m4_m1 { } // Do not emit unused import -import m5 = require("importDecl_require4"); +import m5 = require("./importDecl_require4"); >m5 : typeof m5 export var d = m5.foo2(); @@ -135,7 +135,7 @@ export var d = m5.foo2(); >foo2 : () => m4.d // Do not emit multiple used import statements -import multiImport_m4 = require("importDecl_require"); // Emit used +import multiImport_m4 = require("./importDecl_require"); // Emit used >multiImport_m4 : typeof m4 export var useMultiImport_m4_x4 = multiImport_m4.x; @@ -222,7 +222,7 @@ export function foo(): d { return null; } >null : null === tests/cases/compiler/importDecl_require4.ts === -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); >m4 : typeof m4 export function foo2(): m4.d { return null; } diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js index 70244f47381..51839c35df2 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js @@ -7,7 +7,7 @@ export class B { //// [importDeclarationUsedAsTypeQuery_1.ts] /// -import a = require('importDeclarationUsedAsTypeQuery_require'); +import a = require('./importDeclarationUsedAsTypeQuery_require'); export var x: typeof a; @@ -27,5 +27,5 @@ export declare class B { } //// [importDeclarationUsedAsTypeQuery_1.d.ts] /// -import a = require('importDeclarationUsedAsTypeQuery_require'); +import a = require('./importDeclarationUsedAsTypeQuery_require'); export declare var x: typeof a; diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols index 2664691972f..0cd2498e2af 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/importDeclarationUsedAsTypeQuery_1.ts === /// -import a = require('importDeclarationUsedAsTypeQuery_require'); +import a = require('./importDeclarationUsedAsTypeQuery_require'); >a : Symbol(a, Decl(importDeclarationUsedAsTypeQuery_1.ts, 0, 0)) export var x: typeof a; diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types index 2f449c2aa87..5d4c8efc7d4 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.types @@ -1,6 +1,6 @@ === tests/cases/compiler/importDeclarationUsedAsTypeQuery_1.ts === /// -import a = require('importDeclarationUsedAsTypeQuery_require'); +import a = require('./importDeclarationUsedAsTypeQuery_require'); >a : typeof a export var x: typeof a; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index e86b1a41456..129e7b44fd7 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -5,7 +5,7 @@ export class Super { foo: string; } //// [importUsedInExtendsList1_1.ts] /// -import foo = require('importUsedInExtendsList1_require'); +import foo = require('./importUsedInExtendsList1_require'); class Sub extends foo.Super { } var s: Sub; var r: string = s.foo; @@ -25,7 +25,7 @@ var __extends = (this && this.__extends) || function (d, b) { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /// -var foo = require('importUsedInExtendsList1_require'); +var foo = require('./importUsedInExtendsList1_require'); var Sub = (function (_super) { __extends(Sub, _super); function Sub() { diff --git a/tests/baselines/reference/importUsedInExtendsList1.symbols b/tests/baselines/reference/importUsedInExtendsList1.symbols index 1b3ac99ee9d..263b4f50ed8 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.symbols +++ b/tests/baselines/reference/importUsedInExtendsList1.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/importUsedInExtendsList1_1.ts === /// -import foo = require('importUsedInExtendsList1_require'); +import foo = require('./importUsedInExtendsList1_require'); >foo : Symbol(foo, Decl(importUsedInExtendsList1_1.ts, 0, 0)) class Sub extends foo.Super { } ->Sub : Symbol(Sub, Decl(importUsedInExtendsList1_1.ts, 1, 57)) +>Sub : Symbol(Sub, Decl(importUsedInExtendsList1_1.ts, 1, 59)) >foo.Super : Symbol(foo.Super, Decl(importUsedInExtendsList1_require.ts, 0, 0)) >foo : Symbol(foo, Decl(importUsedInExtendsList1_1.ts, 0, 0)) >Super : Symbol(foo.Super, Decl(importUsedInExtendsList1_require.ts, 0, 0)) var s: Sub; >s : Symbol(s, Decl(importUsedInExtendsList1_1.ts, 3, 3)) ->Sub : Symbol(Sub, Decl(importUsedInExtendsList1_1.ts, 1, 57)) +>Sub : Symbol(Sub, Decl(importUsedInExtendsList1_1.ts, 1, 59)) var r: string = s.foo; >r : Symbol(r, Decl(importUsedInExtendsList1_1.ts, 4, 3)) diff --git a/tests/baselines/reference/importUsedInExtendsList1.types b/tests/baselines/reference/importUsedInExtendsList1.types index 3c1b69f5a83..752f4764976 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.types +++ b/tests/baselines/reference/importUsedInExtendsList1.types @@ -1,6 +1,6 @@ === tests/cases/compiler/importUsedInExtendsList1_1.ts === /// -import foo = require('importUsedInExtendsList1_require'); +import foo = require('./importUsedInExtendsList1_require'); >foo : typeof foo class Sub extends foo.Super { } diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 9e003197e41..2ea5a2f413a 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/compiler/indexTypeCheck.ts (7 errors) ==== @@ -72,7 +72,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression yellow[blue]; // error ~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.js b/tests/baselines/reference/jsxEmitAttributeWithPreserve.js new file mode 100644 index 00000000000..07cb0dee485 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.js @@ -0,0 +1,7 @@ +//// [jsxEmitAttributeWithPreserve.tsx] + +declare var React: any; + + +//// [jsxEmitAttributeWithPreserve.jsx] +; diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols b/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols new file mode 100644 index 00000000000..4ffadb8e888 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx === + +declare var React: any; +>React : Symbol(React, Decl(jsxEmitAttributeWithPreserve.tsx, 1, 11)) + + +>data : Symbol(unknown) + diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.types b/tests/baselines/reference/jsxEmitAttributeWithPreserve.types new file mode 100644 index 00000000000..972ca1c3d88 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx === + +declare var React: any; +>React : any + + +> : any +>foo : any +>data : any + diff --git a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js index daf344b08da..d623e127be7 100644 --- a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js +++ b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js @@ -47,9 +47,9 @@ a / > ; < a; b > ; b > ; -; +; b.c > ; -; +; c > ; ; < .a > ; @@ -67,7 +67,7 @@ var x =
one
two
;; var x =
one
/* intervening comment */ /* intervening comment */
two
;; {"str"}}; id="b" />; -
>; +
>;
;
stuff
...props}>; diff --git a/tests/baselines/reference/jsxReactTestSuite.js b/tests/baselines/reference/jsxReactTestSuite.js index 300274a1614..18013d4be9b 100644 --- a/tests/baselines/reference/jsxReactTestSuite.js +++ b/tests/baselines/reference/jsxReactTestSuite.js @@ -158,14 +158,14 @@ var x =
; ; ; -; +; ; ; ; ; ; ; -; +; ; ; Text; diff --git a/tests/baselines/reference/keywordInJsxIdentifier.js b/tests/baselines/reference/keywordInJsxIdentifier.js new file mode 100644 index 00000000000..677a79138e6 --- /dev/null +++ b/tests/baselines/reference/keywordInJsxIdentifier.js @@ -0,0 +1,14 @@ +//// [keywordInJsxIdentifier.tsx] + +declare var React: any; +; +; +; +; + + +//// [keywordInJsxIdentifier.js] +React.createElement("foo", {"class-id": true}); +React.createElement("foo", {"class": true}); +React.createElement("foo", {"class-id": "1"}); +React.createElement("foo", {"class": "1"}); diff --git a/tests/baselines/reference/keywordInJsxIdentifier.symbols b/tests/baselines/reference/keywordInJsxIdentifier.symbols new file mode 100644 index 00000000000..874d7801a7f --- /dev/null +++ b/tests/baselines/reference/keywordInJsxIdentifier.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/keywordInJsxIdentifier.tsx === + +declare var React: any; +>React : Symbol(React, Decl(keywordInJsxIdentifier.tsx, 1, 11)) + +; +>class-id : Symbol(unknown) + +; +>class : Symbol(unknown) + +; +>class-id : Symbol(unknown) + +; +>class : Symbol(unknown) + diff --git a/tests/baselines/reference/keywordInJsxIdentifier.types b/tests/baselines/reference/keywordInJsxIdentifier.types new file mode 100644 index 00000000000..745fa5998b5 --- /dev/null +++ b/tests/baselines/reference/keywordInJsxIdentifier.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/keywordInJsxIdentifier.tsx === + +declare var React: any; +>React : any + +; +> : any +>foo : any +>class-id : any + +; +> : any +>foo : any +>class : any + +; +> : any +>foo : any +>class-id : any + +; +> : any +>foo : any +>class : any + diff --git a/tests/baselines/reference/localAliasExportAssignment.js b/tests/baselines/reference/localAliasExportAssignment.js index ce0f57d57cb..686ab4126a2 100644 --- a/tests/baselines/reference/localAliasExportAssignment.js +++ b/tests/baselines/reference/localAliasExportAssignment.js @@ -9,7 +9,7 @@ export = server; //// [localAliasExportAssignment_1.ts] /// -import connect = require('localAliasExportAssignment_0'); +import connect = require('./localAliasExportAssignment_0'); connect(); @@ -21,5 +21,5 @@ var server; module.exports = server; //// [localAliasExportAssignment_1.js] /// -var connect = require('localAliasExportAssignment_0'); +var connect = require('./localAliasExportAssignment_0'); connect(); diff --git a/tests/baselines/reference/localAliasExportAssignment.symbols b/tests/baselines/reference/localAliasExportAssignment.symbols index 43c99941384..0c73dfd79de 100644 --- a/tests/baselines/reference/localAliasExportAssignment.symbols +++ b/tests/baselines/reference/localAliasExportAssignment.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/localAliasExportAssignment_1.ts === /// -import connect = require('localAliasExportAssignment_0'); +import connect = require('./localAliasExportAssignment_0'); >connect : Symbol(connect, Decl(localAliasExportAssignment_1.ts, 0, 0)) connect(); diff --git a/tests/baselines/reference/localAliasExportAssignment.types b/tests/baselines/reference/localAliasExportAssignment.types index 5ea0d3085c1..f83b63fedb7 100644 --- a/tests/baselines/reference/localAliasExportAssignment.types +++ b/tests/baselines/reference/localAliasExportAssignment.types @@ -1,6 +1,6 @@ === tests/cases/compiler/localAliasExportAssignment_1.ts === /// -import connect = require('localAliasExportAssignment_0'); +import connect = require('./localAliasExportAssignment_0'); >connect : () => any connect(); diff --git a/tests/baselines/reference/missingAndExcessProperties.errors.txt b/tests/baselines/reference/missingAndExcessProperties.errors.txt new file mode 100644 index 00000000000..0ee69d9af30 --- /dev/null +++ b/tests/baselines/reference/missingAndExcessProperties.errors.txt @@ -0,0 +1,97 @@ +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(13,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(14,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(20,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(20,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(21,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(22,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(29,14): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(29,20): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(30,22): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: number; }'. + + +==== tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts (20 errors) ==== + // Missing properties + function f1() { + var { x, y } = {}; + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var { x = 1, y } = {}; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var { x, y = 1 } = {}; + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. + var { x = 1, y = 1 } = {}; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. + } + + // Missing properties + function f2() { + var x: number, y: number; + ({ x, y } = {}); + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ({ x: x = 1, y } = {}); + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ({ x, y: y = 1 } = {}); + ~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ({ x: x = 1, y: y = 1 } = {}); + } + + // Excess properties + function f3() { + var { } = { x: 0, y: 0 }; + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. + var { x } = { x: 0, y: 0 }; + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. + var { y } = { x: 0, y: 0 }; + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. + var { x, y } = { x: 0, y: 0 }; + } + + // Excess properties + function f4() { + var x: number, y: number; + ({ } = { x: 0, y: 0 }); + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'. + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'. + ({ x } = { x: 0, y: 0 }); + ~ +!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'. + ({ y } = { x: 0, y: 0 }); + ~ +!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: number; }'. + ({ x, y } = { x: 0, y: 0 }); + } + \ No newline at end of file diff --git a/tests/baselines/reference/missingAndExcessProperties.js b/tests/baselines/reference/missingAndExcessProperties.js new file mode 100644 index 00000000000..b9fcadd9519 --- /dev/null +++ b/tests/baselines/reference/missingAndExcessProperties.js @@ -0,0 +1,69 @@ +//// [missingAndExcessProperties.ts] +// Missing properties +function f1() { + var { x, y } = {}; + var { x = 1, y } = {}; + var { x, y = 1 } = {}; + var { x = 1, y = 1 } = {}; +} + +// Missing properties +function f2() { + var x: number, y: number; + ({ x, y } = {}); + ({ x: x = 1, y } = {}); + ({ x, y: y = 1 } = {}); + ({ x: x = 1, y: y = 1 } = {}); +} + +// Excess properties +function f3() { + var { } = { x: 0, y: 0 }; + var { x } = { x: 0, y: 0 }; + var { y } = { x: 0, y: 0 }; + var { x, y } = { x: 0, y: 0 }; +} + +// Excess properties +function f4() { + var x: number, y: number; + ({ } = { x: 0, y: 0 }); + ({ x } = { x: 0, y: 0 }); + ({ y } = { x: 0, y: 0 }); + ({ x, y } = { x: 0, y: 0 }); +} + + +//// [missingAndExcessProperties.js] +// Missing properties +function f1() { + var _a = {}, x = _a.x, y = _a.y; + var _b = {}, _c = _b.x, x = _c === void 0 ? 1 : _c, y = _b.y; + var _d = {}, x = _d.x, _e = _d.y, y = _e === void 0 ? 1 : _e; + var _f = {}, _g = _f.x, x = _g === void 0 ? 1 : _g, _h = _f.y, y = _h === void 0 ? 1 : _h; +} +// Missing properties +function f2() { + var x, y; + (_a = {}, x = _a.x, y = _a.y, _a); + (_b = {}, _c = _b.x, x = _c === void 0 ? 1 : _c, y = _b.y, _b); + (_d = {}, x = _d.x, _e = _d.y, y = _e === void 0 ? 1 : _e, _d); + (_f = {}, _g = _f.x, x = _g === void 0 ? 1 : _g, _h = _f.y, y = _h === void 0 ? 1 : _h, _f); + var _a, _b, _c, _d, _e, _f, _g, _h; +} +// Excess properties +function f3() { + var _a = { x: 0, y: 0 }; + var x = { x: 0, y: 0 }.x; + var y = { x: 0, y: 0 }.y; + var _b = { x: 0, y: 0 }, x = _b.x, y = _b.y; +} +// Excess properties +function f4() { + var x, y; + ({ x: 0, y: 0 }); + (_a = { x: 0, y: 0 }, x = _a.x, _a); + (_b = { x: 0, y: 0 }, y = _b.y, _b); + (_c = { x: 0, y: 0 }, x = _c.x, y = _c.y, _c); + var _a, _b, _c; +} diff --git a/tests/baselines/reference/moduleInTypePosition1.errors.txt b/tests/baselines/reference/moduleInTypePosition1.errors.txt index a5b5076e172..ff5fa2da4eb 100644 --- a/tests/baselines/reference/moduleInTypePosition1.errors.txt +++ b/tests/baselines/reference/moduleInTypePosition1.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/moduleInTypePosition1_1.ts(3,14): error TS2304: Cannot find ==== tests/cases/compiler/moduleInTypePosition1_1.ts (1 errors) ==== /// - import WinJS = require('moduleInTypePosition1_0'); + import WinJS = require('./moduleInTypePosition1_0'); var x = (w1: WinJS) => { }; ~~~~~ !!! error TS2304: Cannot find name 'WinJS'. diff --git a/tests/baselines/reference/moduleInTypePosition1.js b/tests/baselines/reference/moduleInTypePosition1.js index 972bbae63d1..bcce5f74632 100644 --- a/tests/baselines/reference/moduleInTypePosition1.js +++ b/tests/baselines/reference/moduleInTypePosition1.js @@ -7,7 +7,7 @@ export class Promise { //// [moduleInTypePosition1_1.ts] /// -import WinJS = require('moduleInTypePosition1_0'); +import WinJS = require('./moduleInTypePosition1_0'); var x = (w1: WinJS) => { }; diff --git a/tests/baselines/reference/multiImportExport.js b/tests/baselines/reference/multiImportExport.js index 06d81f7e984..5a03f3c848d 100644 --- a/tests/baselines/reference/multiImportExport.js +++ b/tests/baselines/reference/multiImportExport.js @@ -5,10 +5,10 @@ import Drawing = require('./Drawing'); var addr = new Drawing.Math.Adder(); //// [Drawing.ts] -export import Math = require('Math/Math') +export import Math = require('./Math/Math') //// [Math.ts] -import Adder = require('Math/Adder'); +import Adder = require('./Adder'); var Math = { Adder:Adder @@ -35,13 +35,13 @@ var Adder = (function () { })(); module.exports = Adder; //// [Math.js] -var Adder = require('Math/Adder'); +var Adder = require('./Adder'); var Math = { Adder: Adder }; module.exports = Math; //// [Drawing.js] -exports.Math = require('Math/Math'); +exports.Math = require('./Math/Math'); //// [consumer.js] var Drawing = require('./Drawing'); var addr = new Drawing.Math.Adder(); @@ -53,11 +53,11 @@ declare class Adder { } export = Adder; //// [Math.d.ts] -import Adder = require('Math/Adder'); +import Adder = require('./Adder'); declare var Math: { Adder: typeof Adder; }; export = Math; //// [Drawing.d.ts] -export import Math = require('Math/Math'); +export import Math = require('./Math/Math'); //// [consumer.d.ts] diff --git a/tests/baselines/reference/multiImportExport.symbols b/tests/baselines/reference/multiImportExport.symbols index 6601571aabc..45b59752b2a 100644 --- a/tests/baselines/reference/multiImportExport.symbols +++ b/tests/baselines/reference/multiImportExport.symbols @@ -11,11 +11,11 @@ var addr = new Drawing.Math.Adder(); >Adder : Symbol(Adder, Decl(Math.ts, 2, 12)) === tests/cases/compiler/Drawing.ts === -export import Math = require('Math/Math') +export import Math = require('./Math/Math') >Math : Symbol(Math, Decl(Drawing.ts, 0, 0)) === tests/cases/compiler/Math/Math.ts === -import Adder = require('Math/Adder'); +import Adder = require('./Adder'); >Adder : Symbol(Adder, Decl(Math.ts, 0, 0)) var Math = { diff --git a/tests/baselines/reference/multiImportExport.types b/tests/baselines/reference/multiImportExport.types index aac60aaee90..4a94eef9865 100644 --- a/tests/baselines/reference/multiImportExport.types +++ b/tests/baselines/reference/multiImportExport.types @@ -12,11 +12,11 @@ var addr = new Drawing.Math.Adder(); >Adder : typeof Adder === tests/cases/compiler/Drawing.ts === -export import Math = require('Math/Math') +export import Math = require('./Math/Math') >Math : { Adder: typeof Adder; } === tests/cases/compiler/Math/Math.ts === -import Adder = require('Math/Adder'); +import Adder = require('./Adder'); >Adder : typeof Adder var Math = { diff --git a/tests/baselines/reference/multipleDefaultExports01.errors.txt b/tests/baselines/reference/multipleDefaultExports01.errors.txt index 7b49afe1a4e..72898d474e8 100644 --- a/tests/baselines/reference/multipleDefaultExports01.errors.txt +++ b/tests/baselines/reference/multipleDefaultExports01.errors.txt @@ -24,7 +24,7 @@ tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typ !!! error TS2300: Duplicate identifier 'default'. ==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ==== - import Entity from "m1" + import Entity from "./m1" Entity(); ~~~~~~~~ diff --git a/tests/baselines/reference/multipleDefaultExports01.js b/tests/baselines/reference/multipleDefaultExports01.js index e633cf69f55..b1ff3b4353c 100644 --- a/tests/baselines/reference/multipleDefaultExports01.js +++ b/tests/baselines/reference/multipleDefaultExports01.js @@ -14,7 +14,7 @@ var x = 10; export default x; //// [m2.ts] -import Entity from "m1" +import Entity from "./m1" Entity(); @@ -34,5 +34,5 @@ var x = 10; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = x; //// [m2.js] -var m1_1 = require("m1"); +var m1_1 = require("./m1"); m1_1.default(); diff --git a/tests/baselines/reference/multipleDefaultExports02.errors.txt b/tests/baselines/reference/multipleDefaultExports02.errors.txt index 51220ecfae2..235f8f7c3e3 100644 --- a/tests/baselines/reference/multipleDefaultExports02.errors.txt +++ b/tests/baselines/reference/multipleDefaultExports02.errors.txt @@ -17,6 +17,6 @@ tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2393: Duplicate functio } ==== tests/cases/conformance/es6/modules/m2.ts (0 errors) ==== - import Entity from "m1" + import Entity from "./m1" Entity(); \ No newline at end of file diff --git a/tests/baselines/reference/multipleDefaultExports02.js b/tests/baselines/reference/multipleDefaultExports02.js index 3d1b84ff6a6..7b43c43ee60 100644 --- a/tests/baselines/reference/multipleDefaultExports02.js +++ b/tests/baselines/reference/multipleDefaultExports02.js @@ -11,7 +11,7 @@ export default function bar() { } //// [m2.ts] -import Entity from "m1" +import Entity from "./m1" Entity(); @@ -25,5 +25,5 @@ function bar() { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = bar; //// [m2.js] -var m1_1 = require("m1"); +var m1_1 = require("./m1"); m1_1.default(); diff --git a/tests/baselines/reference/nodeResolution4.js b/tests/baselines/reference/nodeResolution4.js new file mode 100644 index 00000000000..0965c257da9 --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/nodeResolution4.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [a.ts] +/// +export var y; + +//// [b.ts] +import y = require("./a"); + +//// [ref.js] +var x = 1; +//// [a.js] +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution4.symbols b/tests/baselines/reference/nodeResolution4.symbols new file mode 100644 index 00000000000..b8e0b59284a --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : Symbol(y, Decl(b.ts, 0, 0)) + +=== tests/cases/compiler/ref.ts === + +var x = 1; +>x : Symbol(x, Decl(ref.ts, 1, 3)) + +=== tests/cases/compiler/a.ts === +/// +export var y; +>y : Symbol(y, Decl(a.ts, 1, 10)) + diff --git a/tests/baselines/reference/nodeResolution4.types b/tests/baselines/reference/nodeResolution4.types new file mode 100644 index 00000000000..b273b203bde --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : typeof y + +=== tests/cases/compiler/ref.ts === + +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/a.ts === +/// +export var y; +>y : any + diff --git a/tests/baselines/reference/nodeResolution5.errors.txt b/tests/baselines/reference/nodeResolution5.errors.txt new file mode 100644 index 00000000000..c36cce45b6d --- /dev/null +++ b/tests/baselines/reference/nodeResolution5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a.d.ts' is not a module. Please contact the package author to update the package definition. + + +==== tests/cases/compiler/b.ts (1 errors) ==== + import y = require("a"); + ~~~ +!!! error TS2656: Exported external package typings file 'a.d.ts' is not a module. Please contact the package author to update the package definition. + +==== tests/cases/compiler/node_modules/a.d.ts (0 errors) ==== + + declare module "a" { + var x: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution5.js b/tests/baselines/reference/nodeResolution5.js new file mode 100644 index 00000000000..2bc009c1522 --- /dev/null +++ b/tests/baselines/reference/nodeResolution5.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/nodeResolution5.ts] //// + +//// [a.d.ts] + +declare module "a" { + var x: number; +} + +//// [b.ts] +import y = require("a"); + + +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution6.errors.txt b/tests/baselines/reference/nodeResolution6.errors.txt new file mode 100644 index 00000000000..6bab6e34389 --- /dev/null +++ b/tests/baselines/reference/nodeResolution6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. + + +==== tests/cases/compiler/b.ts (0 errors) ==== + import y = require("a"); + +==== tests/cases/compiler/node_modules/ref.ts (0 errors) ==== + + var x = 1; + +==== tests/cases/compiler/node_modules/a.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. + export declare var y; + + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution6.js b/tests/baselines/reference/nodeResolution6.js new file mode 100644 index 00000000000..140edd61f5a --- /dev/null +++ b/tests/baselines/reference/nodeResolution6.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/nodeResolution6.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [a.d.ts] +/// +export declare var y; + + +//// [b.ts] +import y = require("a"); + + +//// [ref.js] +var x = 1; +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution7.errors.txt b/tests/baselines/reference/nodeResolution7.errors.txt new file mode 100644 index 00000000000..f9e8ef7ac0f --- /dev/null +++ b/tests/baselines/reference/nodeResolution7.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a/index.d.ts' is not a module. Please contact the package author to update the package definition. + + +==== tests/cases/compiler/b.ts (1 errors) ==== + import y = require("a"); + ~~~ +!!! error TS2656: Exported external package typings file 'index.d.ts' is not a module. Please contact the package author to update the package definition. + +==== tests/cases/compiler/node_modules/a/index.d.ts (0 errors) ==== + + declare module "a" { + var x: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution7.js b/tests/baselines/reference/nodeResolution7.js new file mode 100644 index 00000000000..abfbbad52a6 --- /dev/null +++ b/tests/baselines/reference/nodeResolution7.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/nodeResolution7.ts] //// + +//// [index.d.ts] + +declare module "a" { + var x: number; +} + +//// [b.ts] +import y = require("a"); + + +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution8.errors.txt b/tests/baselines/reference/nodeResolution8.errors.txt new file mode 100644 index 00000000000..3f14a4313c8 --- /dev/null +++ b/tests/baselines/reference/nodeResolution8.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. + + +==== tests/cases/compiler/b.ts (0 errors) ==== + import y = require("a"); +==== tests/cases/compiler/node_modules/a/ref.ts (0 errors) ==== + + var x = 1; + +==== tests/cases/compiler/node_modules/a/index.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. + export declare var y; + + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution8.js b/tests/baselines/reference/nodeResolution8.js new file mode 100644 index 00000000000..aa67f4bf9cc --- /dev/null +++ b/tests/baselines/reference/nodeResolution8.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/nodeResolution8.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [index.d.ts] +/// +export declare var y; + + +//// [b.ts] +import y = require("a"); + +//// [ref.js] +var x = 1; +//// [b.js] diff --git a/tests/baselines/reference/nonIterableRestElement1.types b/tests/baselines/reference/nonIterableRestElement1.types index 4973b67d4ae..a15fe5afd38 100644 --- a/tests/baselines/reference/nonIterableRestElement1.types +++ b/tests/baselines/reference/nonIterableRestElement1.types @@ -5,7 +5,7 @@ var c = {}; [...c] = ["", 0]; >[...c] = ["", 0] : (string | number)[] ->[...c] : {}[] +>[...c] : undefined[] >...c : any >c : {} >["", 0] : (string | number)[] diff --git a/tests/baselines/reference/nonIterableRestElement2.types b/tests/baselines/reference/nonIterableRestElement2.types index e6d84d5297e..c39a592d2e6 100644 --- a/tests/baselines/reference/nonIterableRestElement2.types +++ b/tests/baselines/reference/nonIterableRestElement2.types @@ -5,7 +5,7 @@ var c = {}; [...c] = ["", 0]; >[...c] = ["", 0] : (string | number)[] ->[...c] : {}[] +>[...c] : undefined[] >...c : any >c : {} >["", 0] : (string | number)[] diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index b2f3bd9d824..ef50db9e4e5 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? @@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/pinnedComments1.js b/tests/baselines/reference/pinnedComments1.js index c4b8b41fbd7..9ab2a147e6a 100644 --- a/tests/baselines/reference/pinnedComments1.js +++ b/tests/baselines/reference/pinnedComments1.js @@ -1,12 +1,19 @@ //// [pinnedComments1.ts] +/*!========= + Keep this pinned comment + ========= +*/ /* unpinned comment */ -/*! pinned comment */ +/*! pinned comment that need to be removed */ class C { } //// [pinnedComments1.js] -/*! pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ var C = (function () { function C() { } diff --git a/tests/baselines/reference/pinnedComments1.symbols b/tests/baselines/reference/pinnedComments1.symbols index 53d46ecbaf6..6ee37435dfa 100644 --- a/tests/baselines/reference/pinnedComments1.symbols +++ b/tests/baselines/reference/pinnedComments1.symbols @@ -1,7 +1,11 @@ === tests/cases/compiler/pinnedComments1.ts === +/*!========= + Keep this pinned comment + ========= +*/ /* unpinned comment */ -/*! pinned comment */ +/*! pinned comment that need to be removed */ class C { >C : Symbol(C, Decl(pinnedComments1.ts, 0, 0)) } diff --git a/tests/baselines/reference/pinnedComments1.types b/tests/baselines/reference/pinnedComments1.types index d55feb67659..df97cbdbec9 100644 --- a/tests/baselines/reference/pinnedComments1.types +++ b/tests/baselines/reference/pinnedComments1.types @@ -1,7 +1,11 @@ === tests/cases/compiler/pinnedComments1.ts === +/*!========= + Keep this pinned comment + ========= +*/ /* unpinned comment */ -/*! pinned comment */ +/*! pinned comment that need to be removed */ class C { >C : C } diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt index 578baa694fd..b5d0ea8223e 100644 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt @@ -9,7 +9,7 @@ tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(66,9): error ==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts (8 errors) ==== - import exporter = require("privacyCannotNameAccessorDeclFile_exporter"); + import exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); export class publicClassWithWithPrivateGetAccessorTypes { static get myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~ @@ -144,7 +144,7 @@ tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(66,9): error ==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_exporter.ts (0 errors) ==== /// - import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets"); + import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js index 0295e42e654..8c4108ea9e8 100644 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js @@ -35,7 +35,7 @@ export module SpecializedWidget { //// [privacyCannotNameAccessorDeclFile_exporter.ts] /// -import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -51,7 +51,7 @@ export function createExportedWidget4() { } //// [privacyCannotNameAccessorDeclFile_consumer.ts] -import exporter = require("privacyCannotNameAccessorDeclFile_exporter"); +import exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); export class publicClassWithWithPrivateGetAccessorTypes { static get myPublicStaticMethod() { // Error return exporter.createExportedWidget1(); @@ -165,7 +165,7 @@ var SpecializedWidget; })(SpecializedWidget = exports.SpecializedWidget || (exports.SpecializedWidget = {})); //// [privacyCannotNameAccessorDeclFile_exporter.js] /// -var Widgets = require("privacyCannotNameAccessorDeclFile_Widgets"); +var Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); var Widgets1 = require("GlobalWidgets"); function createExportedWidget1() { return Widgets.createWidget1(); @@ -184,7 +184,7 @@ function createExportedWidget4() { } exports.createExportedWidget4 = createExportedWidget4; //// [privacyCannotNameAccessorDeclFile_consumer.js] -var exporter = require("privacyCannotNameAccessorDeclFile_exporter"); +var exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); var publicClassWithWithPrivateGetAccessorTypes = (function () { function publicClassWithWithPrivateGetAccessorTypes() { } @@ -403,7 +403,7 @@ export declare module SpecializedWidget { } //// [privacyCannotNameAccessorDeclFile_exporter.d.ts] /// -import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt index 7f155f0e454..e76474d2d33 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt @@ -13,7 +13,7 @@ tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error ==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts (12 errors) ==== - import exporter = require("privacyCannotNameVarTypeDeclFile_exporter"); + import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); export class publicClassWithWithPrivatePropertyTypes { static myPublicStaticProperty = exporter.createExportedWidget1(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -120,7 +120,7 @@ tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error ==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_exporter.ts (0 errors) ==== /// - import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets"); + import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index d1f04ee3cef..b40d1dc4980 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -36,7 +36,7 @@ export module SpecializedWidget { //// [privacyCannotNameVarTypeDeclFile_exporter.ts] /// -import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } //// [privacyCannotNameVarTypeDeclFile_consumer.ts] -import exporter = require("privacyCannotNameVarTypeDeclFile_exporter"); +import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); export class publicClassWithWithPrivatePropertyTypes { static myPublicStaticProperty = exporter.createExportedWidget1(); // Error private static myPrivateStaticProperty = exporter.createExportedWidget1(); @@ -129,7 +129,7 @@ var SpecializedWidget; })(SpecializedWidget = exports.SpecializedWidget || (exports.SpecializedWidget = {})); //// [privacyCannotNameVarTypeDeclFile_exporter.js] /// -var Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets"); +var Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); var Widgets1 = require("GlobalWidgets"); function createExportedWidget1() { return Widgets.createWidget1(); @@ -148,7 +148,7 @@ function createExportedWidget4() { } exports.createExportedWidget4 = createExportedWidget4; //// [privacyCannotNameVarTypeDeclFile_consumer.js] -var exporter = require("privacyCannotNameVarTypeDeclFile_exporter"); +var exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); var publicClassWithWithPrivatePropertyTypes = (function () { function publicClassWithWithPrivatePropertyTypes() { this.myPublicProperty = exporter.createExportedWidget1(); // Error @@ -231,7 +231,7 @@ export declare module SpecializedWidget { } //// [privacyCannotNameVarTypeDeclFile_exporter.d.ts] /// -import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.js b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.js index eeaea58e0ab..8ed0b3cfa1b 100644 --- a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.js +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.js @@ -7,7 +7,7 @@ class Foo { } //// [privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts] -import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); +import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); export = Bar; interface Bar { foo: Foo; @@ -31,7 +31,7 @@ declare class Foo { constructor(a: A); } //// [privacyCheckExternalModuleExportAssignmentOfGenericClass_1.d.ts] -import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); +import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); export = Bar; interface Bar { foo: Foo; diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols index fed3799f950..75ebd0bff0a 100644 --- a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.symbols @@ -1,5 +1,5 @@ === tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts === -import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); +import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); >Foo : Symbol(Foo, Decl(privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts, 0, 0)) export = Bar; diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.types b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.types index 2259b039c91..ebf2a0e3ff6 100644 --- a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.types +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.types @@ -1,5 +1,5 @@ === tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts === -import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); +import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); >Foo : typeof Foo export = Bar; diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt index 1e221ccd70a..76fd8b4e80a 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt @@ -25,7 +25,7 @@ tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts( ==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts (24 errors) ==== - import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter"); + import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -212,7 +212,7 @@ tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts( ==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts (0 errors) ==== /// - import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); + import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js index 7acd56927c7..bf2d820e2ea 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js @@ -36,7 +36,7 @@ export module SpecializedWidget { //// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts] /// -import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } //// [privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts] -import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter"); +import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error } @@ -185,7 +185,7 @@ var SpecializedWidget; })(SpecializedWidget = exports.SpecializedWidget || (exports.SpecializedWidget = {})); //// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.js] /// -var Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); +var Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); var Widgets1 = require("GlobalWidgets"); function createExportedWidget1() { return Widgets.createWidget1(); @@ -204,7 +204,7 @@ function createExportedWidget4() { } exports.createExportedWidget4 = createExportedWidget4; //// [privacyFunctionCannotNameParameterTypeDeclFile_consumer.js] -var exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter"); +var exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); var publicClassWithWithPrivateParmeterTypes = (function () { function publicClassWithWithPrivateParmeterTypes(param, param1, param2) { if (param === void 0) { param = exporter.createExportedWidget1(); } @@ -417,7 +417,7 @@ export declare module SpecializedWidget { } //// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.d.ts] /// -import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt index 4be9aec9abe..bc6229815f5 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt @@ -13,7 +13,7 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error ==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts (12 errors) ==== - import exporter = require("privacyFunctionReturnTypeDeclFile_exporter"); + import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error ==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_exporter.ts (0 errors) ==== /// - import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets"); + import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js index 5f822929a48..8de50f4ea8a 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js @@ -36,7 +36,7 @@ export module SpecializedWidget { //// [privacyFunctionReturnTypeDeclFile_exporter.ts] /// -import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } //// [privacyFunctionReturnTypeDeclFile_consumer.ts] -import exporter = require("privacyFunctionReturnTypeDeclFile_exporter"); +import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod() { // Error return exporter.createExportedWidget1(); @@ -192,7 +192,7 @@ var SpecializedWidget; })(SpecializedWidget = exports.SpecializedWidget || (exports.SpecializedWidget = {})); //// [privacyFunctionReturnTypeDeclFile_exporter.js] /// -var Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets"); +var Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); var Widgets1 = require("GlobalWidgets"); function createExportedWidget1() { return Widgets.createWidget1(); @@ -211,7 +211,7 @@ function createExportedWidget4() { } exports.createExportedWidget4 = createExportedWidget4; //// [privacyFunctionReturnTypeDeclFile_consumer.js] -var exporter = require("privacyFunctionReturnTypeDeclFile_exporter"); +var exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); var publicClassWithWithPrivateParmeterTypes = (function () { function publicClassWithWithPrivateParmeterTypes() { } @@ -374,7 +374,7 @@ export declare module SpecializedWidget { } //// [privacyFunctionReturnTypeDeclFile_exporter.d.ts] /// -import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.js b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.js index f0ee8c1bb6c..4d184dfe714 100644 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.js +++ b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.js @@ -32,8 +32,8 @@ declare module 'm2' { /// /// // Privacy errors - importing private elements -export import im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); -export import im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); +export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); export import im_public_mi_public = require("m"); export import im_public_mu_public = require("m2"); @@ -69,8 +69,8 @@ exports.c_public = c_public; /// /// // Privacy errors - importing private elements -exports.im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); -exports.im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +exports.im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); +exports.im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); exports.im_public_mi_public = require("m"); exports.im_public_mu_public = require("m2"); // Usage of privacy error imports @@ -107,8 +107,8 @@ export declare class c_public { //// [privacyTopLevelAmbientExternalModuleImportWithExport_core.d.ts] /// /// -export import im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); -export import im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); +export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); export import im_public_mi_public = require("m"); export import im_public_mu_public = require("m2"); export declare var publicUse_im_public_mi_private: im_public_mi_private.c_public; diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols index 3c0bd5ff61b..2dcddbbfa06 100644 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols +++ b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols @@ -2,14 +2,14 @@ /// /// // Privacy errors - importing private elements -export import im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); +export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); >im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0)) -export import im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); ->im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 109)) +export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111)) export import im_public_mi_public = require("m"); ->im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 110)) +>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112)) export import im_public_mu_public = require("m2"); >im_public_mu_public : Symbol(im_public_mu_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 5, 49)) @@ -30,37 +30,37 @@ export var publicUse_im_public_mi_private = new im_public_mi_private.c_public(); var privateUse_im_public_mu_private = new im_public_mu_private.c_public(); >privateUse_im_public_mu_private : Symbol(privateUse_im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 11, 3)) >im_public_mu_private.c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0)) ->im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 109)) +>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111)) >c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0)) export var publicUse_im_public_mu_private = new im_public_mu_private.c_public(); >publicUse_im_public_mu_private : Symbol(publicUse_im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 12, 10)) >im_public_mu_private.c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0)) ->im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 109)) +>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111)) >c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0)) var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); >privateUse_im_public_mi_public : Symbol(privateUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 15, 3)) >im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) ->im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 110)) +>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112)) >c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); >publicUse_im_public_mi_public : Symbol(publicUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 16, 10)) >im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) ->im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 110)) +>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112)) >c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); >privateUse_im_public_mi_public : Symbol(privateUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 15, 3)) >im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) ->im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 110)) +>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112)) >c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); >publicUse_im_public_mi_public : Symbol(publicUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 16, 10)) >im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) ->im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 110)) +>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112)) >c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) === tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts === diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types index b6d3d2967dc..5c082bef5de 100644 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types +++ b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types @@ -2,10 +2,10 @@ /// /// // Privacy errors - importing private elements -export import im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); +export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); >im_public_mi_private : typeof im_public_mi_private -export import im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); >im_public_mu_private : typeof im_public_mu_private export import im_public_mi_public = require("m"); diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index d9cd90a48fc..7d496f87751 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature var ll = numIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. // Bracket notation property access using string value on type with string index signature and no numeric index signature var mm = strIndex['N']; @@ -127,7 +127,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using values of other types on type with no index signatures var uu = noIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. // Bracket notation property access using numeric value on type with numeric index signature and string index signature var vv = noIndex[32]; @@ -152,7 +152,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature var zzzz = bothIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. var x1 = numIndex[stringOrNumber]; var x1: any; diff --git a/tests/baselines/reference/requireOfAnEmptyFile1.errors.txt b/tests/baselines/reference/requireOfAnEmptyFile1.errors.txt index 7094bc6699f..d02593feff9 100644 --- a/tests/baselines/reference/requireOfAnEmptyFile1.errors.txt +++ b/tests/baselines/reference/requireOfAnEmptyFile1.errors.txt @@ -4,8 +4,8 @@ tests/cases/compiler/requireOfAnEmptyFile1_a.ts(3,21): error TS2306: File 'tests ==== tests/cases/compiler/requireOfAnEmptyFile1_a.ts (1 errors) ==== //requireOfAnEmptyFile1 - import fs = require('requireOfAnEmptyFile1_b'); - ~~~~~~~~~~~~~~~~~~~~~~~~~ + import fs = require('./requireOfAnEmptyFile1_b'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2306: File 'requireOfAnEmptyFile1_b.ts' is not a module. ==== tests/cases/compiler/requireOfAnEmptyFile1_b.ts (0 errors) ==== diff --git a/tests/baselines/reference/requireOfAnEmptyFile1.js b/tests/baselines/reference/requireOfAnEmptyFile1.js index 779bc887140..b2079afa6ef 100644 --- a/tests/baselines/reference/requireOfAnEmptyFile1.js +++ b/tests/baselines/reference/requireOfAnEmptyFile1.js @@ -3,7 +3,7 @@ //// [requireOfAnEmptyFile1_a.ts] //requireOfAnEmptyFile1 -import fs = require('requireOfAnEmptyFile1_b'); +import fs = require('./requireOfAnEmptyFile1_b'); //// [requireOfAnEmptyFile1_b.ts] diff --git a/tests/baselines/reference/reuseInnerModuleMember.js b/tests/baselines/reference/reuseInnerModuleMember.js index 8999ccea633..a15ec5e39a2 100644 --- a/tests/baselines/reference/reuseInnerModuleMember.js +++ b/tests/baselines/reference/reuseInnerModuleMember.js @@ -9,7 +9,7 @@ declare module bar { interface alpha { } } -import f = require('reuseInnerModuleMember_0'); +import f = require('./reuseInnerModuleMember_0'); module bar { var x: alpha; } diff --git a/tests/baselines/reference/reuseInnerModuleMember.symbols b/tests/baselines/reference/reuseInnerModuleMember.symbols index 27301f1256b..5dbd830293f 100644 --- a/tests/baselines/reference/reuseInnerModuleMember.symbols +++ b/tests/baselines/reference/reuseInnerModuleMember.symbols @@ -1,17 +1,17 @@ === tests/cases/compiler/reuseInnerModuleMember_1.ts === /// declare module bar { ->bar : Symbol(bar, Decl(reuseInnerModuleMember_1.ts, 0, 0), Decl(reuseInnerModuleMember_1.ts, 5, 47)) +>bar : Symbol(bar, Decl(reuseInnerModuleMember_1.ts, 0, 0), Decl(reuseInnerModuleMember_1.ts, 5, 49)) interface alpha { } >alpha : Symbol(alpha, Decl(reuseInnerModuleMember_1.ts, 1, 20)) } -import f = require('reuseInnerModuleMember_0'); +import f = require('./reuseInnerModuleMember_0'); >f : Symbol(f, Decl(reuseInnerModuleMember_1.ts, 3, 1)) module bar { ->bar : Symbol(bar, Decl(reuseInnerModuleMember_1.ts, 0, 0), Decl(reuseInnerModuleMember_1.ts, 5, 47)) +>bar : Symbol(bar, Decl(reuseInnerModuleMember_1.ts, 0, 0), Decl(reuseInnerModuleMember_1.ts, 5, 49)) var x: alpha; >x : Symbol(x, Decl(reuseInnerModuleMember_1.ts, 7, 7)) diff --git a/tests/baselines/reference/reuseInnerModuleMember.types b/tests/baselines/reference/reuseInnerModuleMember.types index d42e071e16b..433da749b49 100644 --- a/tests/baselines/reference/reuseInnerModuleMember.types +++ b/tests/baselines/reference/reuseInnerModuleMember.types @@ -7,7 +7,7 @@ declare module bar { >alpha : alpha } -import f = require('reuseInnerModuleMember_0'); +import f = require('./reuseInnerModuleMember_0'); >f : typeof f module bar { diff --git a/tests/baselines/reference/staticInstanceResolution3.js b/tests/baselines/reference/staticInstanceResolution3.js index 92a4e6522c7..0a41cd77909 100644 --- a/tests/baselines/reference/staticInstanceResolution3.js +++ b/tests/baselines/reference/staticInstanceResolution3.js @@ -9,7 +9,7 @@ export class Promise { //// [staticInstanceResolution3_1.ts] /// -import WinJS = require('staticInstanceResolution3_0'); +import WinJS = require('./staticInstanceResolution3_0'); WinJS.Promise.timeout(10); //// [staticInstanceResolution3_0.js] @@ -24,5 +24,5 @@ var Promise = (function () { exports.Promise = Promise; //// [staticInstanceResolution3_1.js] /// -var WinJS = require('staticInstanceResolution3_0'); +var WinJS = require('./staticInstanceResolution3_0'); WinJS.Promise.timeout(10); diff --git a/tests/baselines/reference/staticInstanceResolution3.symbols b/tests/baselines/reference/staticInstanceResolution3.symbols index 8d4fecbaab2..f1afeecd34e 100644 --- a/tests/baselines/reference/staticInstanceResolution3.symbols +++ b/tests/baselines/reference/staticInstanceResolution3.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/staticInstanceResolution3_1.ts === /// -import WinJS = require('staticInstanceResolution3_0'); +import WinJS = require('./staticInstanceResolution3_0'); >WinJS : Symbol(WinJS, Decl(staticInstanceResolution3_1.ts, 0, 0)) WinJS.Promise.timeout(10); diff --git a/tests/baselines/reference/staticInstanceResolution3.types b/tests/baselines/reference/staticInstanceResolution3.types index ef5c1cc5166..fe50c659f6d 100644 --- a/tests/baselines/reference/staticInstanceResolution3.types +++ b/tests/baselines/reference/staticInstanceResolution3.types @@ -1,6 +1,6 @@ === tests/cases/compiler/staticInstanceResolution3_1.ts === /// -import WinJS = require('staticInstanceResolution3_0'); +import WinJS = require('./staticInstanceResolution3_0'); >WinJS : typeof WinJS WinJS.Promise.timeout(10); diff --git a/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt b/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt index 7f25510e00b..1cac31dec40 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt +++ b/tests/baselines/reference/superSymbolIndexedAccess3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts(11,16): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts(11,16): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess [symbol]() { return super[Bar](); ~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. } } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt index 7658744eb55..03002cd92b2 100644 --- a/tests/baselines/reference/symbolProperty53.errors.txt +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== @@ -11,4 +11,4 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An i obj[Symbol.for]; ~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. \ No newline at end of file +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/systemModule17.js b/tests/baselines/reference/systemModule17.js new file mode 100644 index 00000000000..90efdc8872a --- /dev/null +++ b/tests/baselines/reference/systemModule17.js @@ -0,0 +1,84 @@ +//// [tests/cases/compiler/systemModule17.ts] //// + +//// [f1.ts] + + +export class A {} +export interface I {} + +//// [f2.ts] + +var x = 1; +interface I { } + +namespace N { + export var x = 1; + export interface I { } +} + +import IX = N.x; +import II = N.I; +import { A, A as EA, I as EI } from "f1"; + +export {x}; +export {x as x1}; + +export {I}; +export {I as I1}; + +export {A}; +export {A as A1}; + +export {EA}; +export {EA as EA1}; + +export {EI }; +export {EI as EI1}; + +export {IX}; +export {IX as IX1}; + +export {II}; +export {II as II1}; + +//// [f1.js] +System.register([], function(exports_1) { + var A; + return { + setters:[], + execute: function() { + A = (function () { + function A() { + } + return A; + })(); + exports_1("A", A); + } + } +}); +//// [f2.js] +System.register(["f1"], function(exports_1) { + var f1_1; + var x, N, IX; + return { + setters:[ + function (f1_1_1) { + f1_1 = f1_1_1; + }], + execute: function() { + x = 1; + (function (N) { + N.x = 1; + })(N || (N = {})); + IX = N.x; + exports_1("x", x); + exports_1("x1", x); + exports_1("A", f1_1.A); + exports_1("A1", f1_1.A); + exports_1("EA", f1_1.A); + exports_1("EA1", f1_1.A); + exports_1("IX", IX); + exports_1("IX1", IX); + } + } +}); diff --git a/tests/baselines/reference/systemModule17.symbols b/tests/baselines/reference/systemModule17.symbols new file mode 100644 index 00000000000..3bf19dad950 --- /dev/null +++ b/tests/baselines/reference/systemModule17.symbols @@ -0,0 +1,93 @@ +=== tests/cases/compiler/f1.ts === + + +export class A {} +>A : Symbol(A, Decl(f1.ts, 0, 0)) + +export interface I {} +>I : Symbol(I, Decl(f1.ts, 2, 17)) + +=== tests/cases/compiler/f2.ts === + +var x = 1; +>x : Symbol(x, Decl(f2.ts, 1, 3)) + +interface I { } +>I : Symbol(I, Decl(f2.ts, 1, 10)) + +namespace N { +>N : Symbol(N, Decl(f2.ts, 2, 15)) + + export var x = 1; +>x : Symbol(x, Decl(f2.ts, 5, 11)) + + export interface I { } +>I : Symbol(I, Decl(f2.ts, 5, 18)) +} + +import IX = N.x; +>IX : Symbol(IX, Decl(f2.ts, 7, 1)) +>N : Symbol(N, Decl(f2.ts, 2, 15)) +>x : Symbol(IX, Decl(f2.ts, 5, 11)) + +import II = N.I; +>II : Symbol(II, Decl(f2.ts, 9, 16)) +>N : Symbol(N, Decl(f2.ts, 2, 15)) +>I : Symbol(II, Decl(f2.ts, 5, 18)) + +import { A, A as EA, I as EI } from "f1"; +>A : Symbol(A, Decl(f2.ts, 11, 8)) +>A : Symbol(EA, Decl(f2.ts, 11, 11)) +>EA : Symbol(EA, Decl(f2.ts, 11, 11)) +>I : Symbol(EI, Decl(f2.ts, 11, 20)) +>EI : Symbol(EI, Decl(f2.ts, 11, 20)) + +export {x}; +>x : Symbol(x, Decl(f2.ts, 13, 8)) + +export {x as x1}; +>x : Symbol(x1, Decl(f2.ts, 14, 8)) +>x1 : Symbol(x1, Decl(f2.ts, 14, 8)) + +export {I}; +>I : Symbol(I, Decl(f2.ts, 16, 8)) + +export {I as I1}; +>I : Symbol(I1, Decl(f2.ts, 17, 8)) +>I1 : Symbol(I1, Decl(f2.ts, 17, 8)) + +export {A}; +>A : Symbol(A, Decl(f2.ts, 19, 8)) + +export {A as A1}; +>A : Symbol(A1, Decl(f2.ts, 20, 8)) +>A1 : Symbol(A1, Decl(f2.ts, 20, 8)) + +export {EA}; +>EA : Symbol(EA, Decl(f2.ts, 22, 8)) + +export {EA as EA1}; +>EA : Symbol(EA1, Decl(f2.ts, 23, 8)) +>EA1 : Symbol(EA1, Decl(f2.ts, 23, 8)) + +export {EI }; +>EI : Symbol(EI, Decl(f2.ts, 25, 8)) + +export {EI as EI1}; +>EI : Symbol(EI1, Decl(f2.ts, 26, 8)) +>EI1 : Symbol(EI1, Decl(f2.ts, 26, 8)) + +export {IX}; +>IX : Symbol(IX, Decl(f2.ts, 28, 8)) + +export {IX as IX1}; +>IX : Symbol(IX1, Decl(f2.ts, 29, 8)) +>IX1 : Symbol(IX1, Decl(f2.ts, 29, 8)) + +export {II}; +>II : Symbol(II, Decl(f2.ts, 31, 8)) + +export {II as II1}; +>II : Symbol(II1, Decl(f2.ts, 32, 8)) +>II1 : Symbol(II1, Decl(f2.ts, 32, 8)) + diff --git a/tests/baselines/reference/systemModule17.types b/tests/baselines/reference/systemModule17.types new file mode 100644 index 00000000000..1f0b1b51842 --- /dev/null +++ b/tests/baselines/reference/systemModule17.types @@ -0,0 +1,95 @@ +=== tests/cases/compiler/f1.ts === + + +export class A {} +>A : A + +export interface I {} +>I : I + +=== tests/cases/compiler/f2.ts === + +var x = 1; +>x : number +>1 : number + +interface I { } +>I : I + +namespace N { +>N : typeof N + + export var x = 1; +>x : number +>1 : number + + export interface I { } +>I : I +} + +import IX = N.x; +>IX : number +>N : typeof N +>x : number + +import II = N.I; +>II : any +>N : typeof N +>I : II + +import { A, A as EA, I as EI } from "f1"; +>A : typeof A +>A : typeof A +>EA : typeof A +>I : any +>EI : any + +export {x}; +>x : number + +export {x as x1}; +>x : number +>x1 : number + +export {I}; +>I : any + +export {I as I1}; +>I : any +>I1 : any + +export {A}; +>A : typeof A + +export {A as A1}; +>A : typeof A +>A1 : typeof A + +export {EA}; +>EA : typeof A + +export {EA as EA1}; +>EA : typeof A +>EA1 : typeof A + +export {EI }; +>EI : any + +export {EI as EI1}; +>EI : any +>EI1 : any + +export {IX}; +>IX : number + +export {IX as IX1}; +>IX : number +>IX1 : number + +export {II}; +>II : any + +export {II as II1}; +>II : any +>II1 : any + diff --git a/tests/baselines/reference/topLevelFileModule.js b/tests/baselines/reference/topLevelFileModule.js index 5d655f78397..a6e7a151eb9 100644 --- a/tests/baselines/reference/topLevelFileModule.js +++ b/tests/baselines/reference/topLevelFileModule.js @@ -7,13 +7,13 @@ export var x: number; export declare var y: number; //// [foo_1.ts] -import foo = require("vs/foo_0"); -import fum = require("vs/fum"); +import foo = require("./vs/foo_0"); +import fum = require("./vs/fum"); var z = foo.x + fum.y; //// [foo_0.js] //// [foo_1.js] -var foo = require("vs/foo_0"); -var fum = require("vs/fum"); +var foo = require("./vs/foo_0"); +var fum = require("./vs/fum"); var z = foo.x + fum.y; diff --git a/tests/baselines/reference/topLevelFileModule.symbols b/tests/baselines/reference/topLevelFileModule.symbols index a677274ec07..d3961c0fa72 100644 --- a/tests/baselines/reference/topLevelFileModule.symbols +++ b/tests/baselines/reference/topLevelFileModule.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/externalModules/foo_1.ts === -import foo = require("vs/foo_0"); +import foo = require("./vs/foo_0"); >foo : Symbol(foo, Decl(foo_1.ts, 0, 0)) -import fum = require("vs/fum"); ->fum : Symbol(fum, Decl(foo_1.ts, 0, 33)) +import fum = require("./vs/fum"); +>fum : Symbol(fum, Decl(foo_1.ts, 0, 35)) var z = foo.x + fum.y; >z : Symbol(z, Decl(foo_1.ts, 2, 3)) @@ -11,7 +11,7 @@ var z = foo.x + fum.y; >foo : Symbol(foo, Decl(foo_1.ts, 0, 0)) >x : Symbol(foo.x, Decl(foo_0.ts, 0, 10)) >fum.y : Symbol(fum.y, Decl(fum.d.ts, 0, 18)) ->fum : Symbol(fum, Decl(foo_1.ts, 0, 33)) +>fum : Symbol(fum, Decl(foo_1.ts, 0, 35)) >y : Symbol(fum.y, Decl(fum.d.ts, 0, 18)) === tests/cases/conformance/externalModules/vs/foo_0.ts === diff --git a/tests/baselines/reference/topLevelFileModule.types b/tests/baselines/reference/topLevelFileModule.types index 033dbf197d3..2706fd75670 100644 --- a/tests/baselines/reference/topLevelFileModule.types +++ b/tests/baselines/reference/topLevelFileModule.types @@ -1,8 +1,8 @@ === tests/cases/conformance/externalModules/foo_1.ts === -import foo = require("vs/foo_0"); +import foo = require("./vs/foo_0"); >foo : typeof foo -import fum = require("vs/fum"); +import fum = require("./vs/fum"); >fum : typeof fum var z = foo.x + fum.y; diff --git a/tests/baselines/reference/topLevelModuleDeclarationAndFile.errors.txt b/tests/baselines/reference/topLevelModuleDeclarationAndFile.errors.txt index de343803529..cb555b7a603 100644 --- a/tests/baselines/reference/topLevelModuleDeclarationAndFile.errors.txt +++ b/tests/baselines/reference/topLevelModuleDeclarationAndFile.errors.txt @@ -9,7 +9,7 @@ tests/cases/conformance/externalModules/foo_2.ts(3,14): error TS2339: Property ' !!! error TS2339: Property 'x' does not exist on type 'typeof "vs/foo_0"'. var z2 = foo.y() + 10; // Should resolve -==== tests/cases/conformance/externalModules/vs/foo_0.ts (0 errors) ==== +==== tests/cases/conformance/externalModules/vs/foo_0/index.ts (0 errors) ==== export var x: number = 42; ==== tests/cases/conformance/externalModules/foo_1.ts (0 errors) ==== diff --git a/tests/baselines/reference/topLevelModuleDeclarationAndFile.js b/tests/baselines/reference/topLevelModuleDeclarationAndFile.js index c47de516108..e223a293d7c 100644 --- a/tests/baselines/reference/topLevelModuleDeclarationAndFile.js +++ b/tests/baselines/reference/topLevelModuleDeclarationAndFile.js @@ -1,6 +1,6 @@ //// [tests/cases/conformance/externalModules/topLevelModuleDeclarationAndFile.ts] //// -//// [foo_0.ts] +//// [index.ts] export var x: number = 42; //// [foo_1.ts] @@ -17,8 +17,6 @@ var z2 = foo.y() + 10; // Should resolve //// [foo_1.js] -//// [foo_0.js] -exports.x = 42; //// [foo_2.js] /// var foo = require("vs/foo_0"); diff --git a/tests/baselines/reference/tsxAttributeResolution6.js b/tests/baselines/reference/tsxAttributeResolution6.js index f4af0ba875a..5d6ad1e20c6 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.js +++ b/tests/baselines/reference/tsxAttributeResolution6.js @@ -20,10 +20,10 @@ declare module JSX { //// [tsxAttributeResolution6.jsx] // Error -; +; ; ; // OK -; +; ; -; +; diff --git a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js index f493347ca9c..ece48831f8e 100644 --- a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js +++ b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js @@ -42,5 +42,5 @@ x3(); var x4 = () => ; x4.isElement; // This is an element -var x5 = () => ; +var x5 = () => ; x5.isElement; diff --git a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.js b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.js index b25ad480a9d..e75fa63c4b7 100644 --- a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.js +++ b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.js @@ -7,7 +7,7 @@ var classes = undefined; } //// [file2.ts] -import f = require('file1'); +import f = require('./file1'); f.foo(); @@ -18,7 +18,7 @@ function foo() { } exports.foo = foo; //// [file2.js] -var f = require('file1'); +var f = require('./file1'); f.foo(); diff --git a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.symbols b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.symbols index 2326ee5a8cd..4a4e4ef57da 100644 --- a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.symbols +++ b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.symbols @@ -1,5 +1,5 @@ === tests/cases/compiler/file2.ts === -import f = require('file1'); +import f = require('./file1'); >f : Symbol(f, Decl(file2.ts, 0, 0)) f.foo(); diff --git a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types index 23d2c3167d6..044de70c5cd 100644 --- a/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types +++ b/tests/baselines/reference/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.types @@ -1,5 +1,5 @@ === tests/cases/compiler/file2.ts === -import f = require('file1'); +import f = require('./file1'); >f : typeof f f.foo(); diff --git a/tests/baselines/reference/typeofAmbientExternalModules.errors.txt b/tests/baselines/reference/typeofAmbientExternalModules.errors.txt index cde3247b7cd..9046972c895 100644 --- a/tests/baselines/reference/typeofAmbientExternalModules.errors.txt +++ b/tests/baselines/reference/typeofAmbientExternalModules.errors.txt @@ -7,8 +7,8 @@ tests/cases/compiler/typeofAmbientExternalModules_2.ts(9,1): error TS2322: Type ==== tests/cases/compiler/typeofAmbientExternalModules_2.ts (2 errors) ==== /// /// - import ext = require('typeofAmbientExternalModules_0'); - import exp = require('typeofAmbientExternalModules_1'); + import ext = require('./typeofAmbientExternalModules_0'); + import exp = require('./typeofAmbientExternalModules_1'); var y1: typeof ext = ext; y1 = exp; diff --git a/tests/baselines/reference/typeofAmbientExternalModules.js b/tests/baselines/reference/typeofAmbientExternalModules.js index 1bfd549fb04..66e6d7d45ea 100644 --- a/tests/baselines/reference/typeofAmbientExternalModules.js +++ b/tests/baselines/reference/typeofAmbientExternalModules.js @@ -10,8 +10,8 @@ export = D; //// [typeofAmbientExternalModules_2.ts] /// /// -import ext = require('typeofAmbientExternalModules_0'); -import exp = require('typeofAmbientExternalModules_1'); +import ext = require('./typeofAmbientExternalModules_0'); +import exp = require('./typeofAmbientExternalModules_1'); var y1: typeof ext = ext; y1 = exp; @@ -35,8 +35,8 @@ module.exports = D; //// [typeofAmbientExternalModules_2.js] /// /// -var ext = require('typeofAmbientExternalModules_0'); -var exp = require('typeofAmbientExternalModules_1'); +var ext = require('./typeofAmbientExternalModules_0'); +var exp = require('./typeofAmbientExternalModules_1'); var y1 = ext; y1 = exp; var y2 = exp; diff --git a/tests/baselines/reference/typeofExternalModules.errors.txt b/tests/baselines/reference/typeofExternalModules.errors.txt index 05b56c9fe1b..0290a40c326 100644 --- a/tests/baselines/reference/typeofExternalModules.errors.txt +++ b/tests/baselines/reference/typeofExternalModules.errors.txt @@ -5,8 +5,8 @@ tests/cases/compiler/typeofExternalModules_core.ts(7,1): error TS2322: Type 'typ ==== tests/cases/compiler/typeofExternalModules_core.ts (2 errors) ==== - import ext = require('typeofExternalModules_external'); - import exp = require('typeofExternalModules_exportAssign'); + import ext = require('./typeofExternalModules_external'); + import exp = require('./typeofExternalModules_exportAssign'); var y1: typeof ext = ext; y1 = exp; diff --git a/tests/baselines/reference/typeofExternalModules.js b/tests/baselines/reference/typeofExternalModules.js index 8ffea8ca8ec..676f6f10b9f 100644 --- a/tests/baselines/reference/typeofExternalModules.js +++ b/tests/baselines/reference/typeofExternalModules.js @@ -8,8 +8,8 @@ class D { } export = D; //// [typeofExternalModules_core.ts] -import ext = require('typeofExternalModules_external'); -import exp = require('typeofExternalModules_exportAssign'); +import ext = require('./typeofExternalModules_external'); +import exp = require('./typeofExternalModules_exportAssign'); var y1: typeof ext = ext; y1 = exp; @@ -31,8 +31,8 @@ var D = (function () { })(); module.exports = D; //// [typeofExternalModules_core.js] -var ext = require('typeofExternalModules_external'); -var exp = require('typeofExternalModules_exportAssign'); +var ext = require('./typeofExternalModules_external'); +var exp = require('./typeofExternalModules_exportAssign'); var y1 = ext; y1 = exp; var y2 = exp; diff --git a/tests/baselines/reference/unusedImportDeclaration.js b/tests/baselines/reference/unusedImportDeclaration.js index 54885f09e36..04e897c081a 100644 --- a/tests/baselines/reference/unusedImportDeclaration.js +++ b/tests/baselines/reference/unusedImportDeclaration.js @@ -7,7 +7,7 @@ class TesterB { export = TesterB; //// [unusedImportDeclaration_testerA.ts] -import B = require("unusedImportDeclaration_testerB"); +import B = require("./unusedImportDeclaration_testerB"); var thingy: B = { me: "A" }; diff --git a/tests/baselines/reference/unusedImportDeclaration.symbols b/tests/baselines/reference/unusedImportDeclaration.symbols index 5506c4ad6b6..a298ba94631 100644 --- a/tests/baselines/reference/unusedImportDeclaration.symbols +++ b/tests/baselines/reference/unusedImportDeclaration.symbols @@ -1,5 +1,5 @@ === tests/cases/compiler/unusedImportDeclaration_testerA.ts === -import B = require("unusedImportDeclaration_testerB"); +import B = require("./unusedImportDeclaration_testerB"); >B : Symbol(B, Decl(unusedImportDeclaration_testerA.ts, 0, 0)) var thingy: B = { diff --git a/tests/baselines/reference/unusedImportDeclaration.types b/tests/baselines/reference/unusedImportDeclaration.types index dcedf3fd350..c14338756da 100644 --- a/tests/baselines/reference/unusedImportDeclaration.types +++ b/tests/baselines/reference/unusedImportDeclaration.types @@ -1,5 +1,5 @@ === tests/cases/compiler/unusedImportDeclaration_testerA.ts === -import B = require("unusedImportDeclaration_testerB"); +import B = require("./unusedImportDeclaration_testerB"); >B : typeof B var thingy: B = { diff --git a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.js b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.js index e3f60cfa17b..660a4017a7f 100644 --- a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.js +++ b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.js @@ -3,8 +3,8 @@ //// [visibilityOfCrossModuleTypeUsage_commands.ts] //visibilityOfCrossModuleTypeUsage -import fs = require('visibilityOfCrossModuleTypeUsage_fs'); -import server = require('visibilityOfCrossModuleTypeUsage_server'); +import fs = require('./visibilityOfCrossModuleTypeUsage_fs'); +import server = require('./visibilityOfCrossModuleTypeUsage_server'); export interface IConfiguration { workspace: server.IWorkspace; @@ -20,7 +20,7 @@ export interface IWorkspace { } //// [visibilityOfCrossModuleTypeUsage_fs.ts] -import commands = require('visibilityOfCrossModuleTypeUsage_commands'); +import commands = require('./visibilityOfCrossModuleTypeUsage_commands'); function run(configuration: commands.IConfiguration) { var absoluteWorkspacePath = configuration.workspace.toAbsolutePath(configuration.server); } diff --git a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols index 0fdd5c4fbe1..d1132151097 100644 --- a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols +++ b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.symbols @@ -1,12 +1,12 @@ === tests/cases/compiler/visibilityOfCrossModuleTypeUsage_fs.ts === -import commands = require('visibilityOfCrossModuleTypeUsage_commands'); +import commands = require('./visibilityOfCrossModuleTypeUsage_commands'); >commands : Symbol(commands, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 0, 0)) function run(configuration: commands.IConfiguration) { ->run : Symbol(run, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 0, 71)) +>run : Symbol(run, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 0, 73)) >configuration : Symbol(configuration, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 1, 13)) >commands : Symbol(commands, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 0, 0)) ->IConfiguration : Symbol(commands.IConfiguration, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 3, 67)) +>IConfiguration : Symbol(commands.IConfiguration, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 3, 69)) var absoluteWorkspacePath = configuration.workspace.toAbsolutePath(configuration.server); >absoluteWorkspacePath : Symbol(absoluteWorkspacePath, Decl(visibilityOfCrossModuleTypeUsage_fs.ts, 2, 7)) @@ -22,23 +22,23 @@ function run(configuration: commands.IConfiguration) { === tests/cases/compiler/visibilityOfCrossModuleTypeUsage_commands.ts === //visibilityOfCrossModuleTypeUsage -import fs = require('visibilityOfCrossModuleTypeUsage_fs'); +import fs = require('./visibilityOfCrossModuleTypeUsage_fs'); >fs : Symbol(fs, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 0, 0)) -import server = require('visibilityOfCrossModuleTypeUsage_server'); ->server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 59)) +import server = require('./visibilityOfCrossModuleTypeUsage_server'); +>server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 61)) export interface IConfiguration { ->IConfiguration : Symbol(IConfiguration, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 3, 67)) +>IConfiguration : Symbol(IConfiguration, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 3, 69)) workspace: server.IWorkspace; >workspace : Symbol(workspace, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 5, 33)) ->server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 59)) +>server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 61)) >IWorkspace : Symbol(server.IWorkspace, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 1, 1)) server?: server.IServer; >server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 6, 33)) ->server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 59)) +>server : Symbol(server, Decl(visibilityOfCrossModuleTypeUsage_commands.ts, 2, 61)) >IServer : Symbol(server.IServer, Decl(visibilityOfCrossModuleTypeUsage_server.ts, 0, 0)) } diff --git a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.types b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.types index 90cb54fe1e0..2ee7189a77c 100644 --- a/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.types +++ b/tests/baselines/reference/visibilityOfCrossModuleTypeUsage.types @@ -1,5 +1,5 @@ === tests/cases/compiler/visibilityOfCrossModuleTypeUsage_fs.ts === -import commands = require('visibilityOfCrossModuleTypeUsage_commands'); +import commands = require('./visibilityOfCrossModuleTypeUsage_commands'); >commands : typeof commands function run(configuration: commands.IConfiguration) { @@ -23,10 +23,10 @@ function run(configuration: commands.IConfiguration) { === tests/cases/compiler/visibilityOfCrossModuleTypeUsage_commands.ts === //visibilityOfCrossModuleTypeUsage -import fs = require('visibilityOfCrossModuleTypeUsage_fs'); +import fs = require('./visibilityOfCrossModuleTypeUsage_fs'); >fs : typeof fs -import server = require('visibilityOfCrossModuleTypeUsage_server'); +import server = require('./visibilityOfCrossModuleTypeUsage_server'); >server : typeof server export interface IConfiguration { diff --git a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt index aa61a114145..ce8b52f316c 100644 --- a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt +++ b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,17): error TS2394: Over ==== tests/cases/compiler/voidAsNonAmbiguousReturnType_1.ts (0 errors) ==== /// - import fs = require("voidAsNonAmbiguousReturnType_0"); + import fs = require("./voidAsNonAmbiguousReturnType_0"); function main() { fs.mkdirSync('test'); // should not error - return types are the same diff --git a/tests/baselines/reference/voidAsNonAmbiguousReturnType.js b/tests/baselines/reference/voidAsNonAmbiguousReturnType.js index 713c4ffe47b..0ab15304493 100644 --- a/tests/baselines/reference/voidAsNonAmbiguousReturnType.js +++ b/tests/baselines/reference/voidAsNonAmbiguousReturnType.js @@ -6,7 +6,7 @@ export function mkdirSync(path: string, mode?: string): void {} //// [voidAsNonAmbiguousReturnType_1.ts] /// -import fs = require("voidAsNonAmbiguousReturnType_0"); +import fs = require("./voidAsNonAmbiguousReturnType_0"); function main() { fs.mkdirSync('test'); // should not error - return types are the same @@ -18,7 +18,7 @@ function mkdirSync(path, mode) { } exports.mkdirSync = mkdirSync; //// [voidAsNonAmbiguousReturnType_1.js] /// -var fs = require("voidAsNonAmbiguousReturnType_0"); +var fs = require("./voidAsNonAmbiguousReturnType_0"); function main() { fs.mkdirSync('test'); // should not error - return types are the same } diff --git a/tests/cases/compiler/aliasAssignments.ts b/tests/cases/compiler/aliasAssignments.ts index 4a83ee80da7..6a7ed9a9974 100644 --- a/tests/cases/compiler/aliasAssignments.ts +++ b/tests/cases/compiler/aliasAssignments.ts @@ -5,7 +5,7 @@ export class someClass { } // @Filename: aliasAssignments_1.ts -import moduleA = require("aliasAssignments_moduleA"); +import moduleA = require("./aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error var y = 1; diff --git a/tests/cases/compiler/aliasUsageInAccessorsOfClass.ts b/tests/cases/compiler/aliasUsageInAccessorsOfClass.ts index 2aeddbad947..c6d1b1480c0 100644 --- a/tests/cases/compiler/aliasUsageInAccessorsOfClass.ts +++ b/tests/cases/compiler/aliasUsageInAccessorsOfClass.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @target: ES5 // @Filename: aliasUsage1_backbone.ts export class Model { @@ -6,14 +6,14 @@ export class Model { } // @Filename: aliasUsage1_moduleA.ts -import Backbone = require("aliasUsage1_backbone"); +import Backbone = require("./aliasUsage1_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsage1_main.ts -import Backbone = require("aliasUsage1_backbone"); -import moduleA = require("aliasUsage1_moduleA"); +import Backbone = require("./aliasUsage1_backbone"); +import moduleA = require("./aliasUsage1_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInArray.ts b/tests/cases/compiler/aliasUsageInArray.ts index 9c2e4e64e48..7f71b00e72a 100644 --- a/tests/cases/compiler/aliasUsageInArray.ts +++ b/tests/cases/compiler/aliasUsageInArray.ts @@ -5,14 +5,14 @@ export class Model { } // @Filename: aliasUsageInArray_moduleA.ts -import Backbone = require("aliasUsageInArray_backbone"); +import Backbone = require("./aliasUsageInArray_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInArray_main.ts -import Backbone = require("aliasUsageInArray_backbone"); -import moduleA = require("aliasUsageInArray_moduleA"); +import Backbone = require("./aliasUsageInArray_backbone"); +import moduleA = require("./aliasUsageInArray_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInFunctionExpression.ts b/tests/cases/compiler/aliasUsageInFunctionExpression.ts index 47b377c5b28..4c9a91b713b 100644 --- a/tests/cases/compiler/aliasUsageInFunctionExpression.ts +++ b/tests/cases/compiler/aliasUsageInFunctionExpression.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInFunctionExpression_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInFunctionExpression_moduleA.ts -import Backbone = require("aliasUsageInFunctionExpression_backbone"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInFunctionExpression_main.ts -import Backbone = require("aliasUsageInFunctionExpression_backbone"); -import moduleA = require("aliasUsageInFunctionExpression_moduleA"); +import Backbone = require("./aliasUsageInFunctionExpression_backbone"); +import moduleA = require("./aliasUsageInFunctionExpression_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInGenericFunction.ts b/tests/cases/compiler/aliasUsageInGenericFunction.ts index d9966dbd299..f153195009c 100644 --- a/tests/cases/compiler/aliasUsageInGenericFunction.ts +++ b/tests/cases/compiler/aliasUsageInGenericFunction.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInGenericFunction_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInGenericFunction_moduleA.ts -import Backbone = require("aliasUsageInGenericFunction_backbone"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInGenericFunction_main.ts -import Backbone = require("aliasUsageInGenericFunction_backbone"); -import moduleA = require("aliasUsageInGenericFunction_moduleA"); +import Backbone = require("./aliasUsageInGenericFunction_backbone"); +import moduleA = require("./aliasUsageInGenericFunction_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInIndexerOfClass.ts b/tests/cases/compiler/aliasUsageInIndexerOfClass.ts index a6df86fbc99..a9aca7d2970 100644 --- a/tests/cases/compiler/aliasUsageInIndexerOfClass.ts +++ b/tests/cases/compiler/aliasUsageInIndexerOfClass.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInIndexerOfClass_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInIndexerOfClass_moduleA.ts -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInIndexerOfClass_main.ts -import Backbone = require("aliasUsageInIndexerOfClass_backbone"); -import moduleA = require("aliasUsageInIndexerOfClass_moduleA"); +import Backbone = require("./aliasUsageInIndexerOfClass_backbone"); +import moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInObjectLiteral.ts b/tests/cases/compiler/aliasUsageInObjectLiteral.ts index a9d2017d50c..e16d5552fe6 100644 --- a/tests/cases/compiler/aliasUsageInObjectLiteral.ts +++ b/tests/cases/compiler/aliasUsageInObjectLiteral.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInObjectLiteral_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInObjectLiteral_moduleA.ts -import Backbone = require("aliasUsageInObjectLiteral_backbone"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInObjectLiteral_main.ts -import Backbone = require("aliasUsageInObjectLiteral_backbone"); -import moduleA = require("aliasUsageInObjectLiteral_moduleA"); +import Backbone = require("./aliasUsageInObjectLiteral_backbone"); +import moduleA = require("./aliasUsageInObjectLiteral_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInOrExpression.ts b/tests/cases/compiler/aliasUsageInOrExpression.ts index e7ddd4014f0..540a3ae91c0 100644 --- a/tests/cases/compiler/aliasUsageInOrExpression.ts +++ b/tests/cases/compiler/aliasUsageInOrExpression.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInOrExpression_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInOrExpression_moduleA.ts -import Backbone = require("aliasUsageInOrExpression_backbone"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInOrExpression_main.ts -import Backbone = require("aliasUsageInOrExpression_backbone"); -import moduleA = require("aliasUsageInOrExpression_moduleA"); +import Backbone = require("./aliasUsageInOrExpression_backbone"); +import moduleA = require("./aliasUsageInOrExpression_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause.ts b/tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause.ts index 548963ff123..c09c715ed3a 100644 --- a/tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause.ts +++ b/tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInTypeArgumentOfExtendsClause_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInTypeArgumentOfExtendsClause_main.ts -import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone"); -import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); +import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsageInVarAssignment.ts b/tests/cases/compiler/aliasUsageInVarAssignment.ts index 1644c825a4d..ed14d4241f5 100644 --- a/tests/cases/compiler/aliasUsageInVarAssignment.ts +++ b/tests/cases/compiler/aliasUsageInVarAssignment.ts @@ -1,18 +1,18 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsageInVarAssignment_backbone.ts export class Model { public someData: string; } // @Filename: aliasUsageInVarAssignment_moduleA.ts -import Backbone = require("aliasUsageInVarAssignment_backbone"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: aliasUsageInVarAssignment_main.ts -import Backbone = require("aliasUsageInVarAssignment_backbone"); -import moduleA = require("aliasUsageInVarAssignment_moduleA"); +import Backbone = require("./aliasUsageInVarAssignment_backbone"); +import moduleA = require("./aliasUsageInVarAssignment_moduleA"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/aliasUsedAsNameValue.ts b/tests/cases/compiler/aliasUsedAsNameValue.ts index 20b60b53d1e..2426399252b 100644 --- a/tests/cases/compiler/aliasUsedAsNameValue.ts +++ b/tests/cases/compiler/aliasUsedAsNameValue.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasUsedAsNameValue_0.ts export var id: number; @@ -8,8 +8,8 @@ export function b(a: any): any { return null; } // @Filename: aliasUsedAsNameValue_2.ts /// /// -import mod = require("aliasUsedAsNameValue_0"); -import b = require("aliasUsedAsNameValue_1"); +import mod = require("./aliasUsedAsNameValue_0"); +import b = require("./aliasUsedAsNameValue_1"); export var a = function () { //var x = mod.id; // TODO needed hack that mod is loaded diff --git a/tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer.ts b/tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer.ts index f4d818d9562..37a6c42caee 100644 --- a/tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer.ts +++ b/tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.ts interface c { q3: number; @@ -6,5 +6,5 @@ interface c { export = c; // @Filename: aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts -import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); +import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0"); var d = b.q3; \ No newline at end of file diff --git a/tests/cases/compiler/arrayOfExportedClass.ts b/tests/cases/compiler/arrayOfExportedClass.ts index 020be79408c..794a83fbd83 100644 --- a/tests/cases/compiler/arrayOfExportedClass.ts +++ b/tests/cases/compiler/arrayOfExportedClass.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: arrayOfExportedClass_0.ts class Car { foo: string; @@ -8,7 +8,7 @@ export = Car; // @Filename: arrayOfExportedClass_1.ts /// -import Car = require('arrayOfExportedClass_0'); +import Car = require('./arrayOfExportedClass_0'); class Road { diff --git a/tests/cases/compiler/castExpressionParentheses.ts b/tests/cases/compiler/castExpressionParentheses.ts index 93b26ebaf4e..06908f39936 100644 --- a/tests/cases/compiler/castExpressionParentheses.ts +++ b/tests/cases/compiler/castExpressionParentheses.ts @@ -6,6 +6,11 @@ declare var a; ([1,3,]); ("string"); (23.0); +(1); +(1.); +(1.0); +(12e+34); +(0xff); (/regexp/g); (false); (true); @@ -22,6 +27,12 @@ declare var a; declare var A; // should keep the parentheses in emit +(1).foo; +(1.).foo; +(1.0).foo; +(12e+34).foo; +(0xff).foo; +((1.0)); (new A).foo; (typeof A).x; (-A).x; diff --git a/tests/cases/compiler/chainedImportAlias.ts b/tests/cases/compiler/chainedImportAlias.ts index 97bf28bf4a5..5b91c58f4bc 100644 --- a/tests/cases/compiler/chainedImportAlias.ts +++ b/tests/cases/compiler/chainedImportAlias.ts @@ -1,10 +1,10 @@ -//@module: commonjs +// @module: commonjs // @Filename: chainedImportAlias_file0.ts export module m { export function foo() { } } // @Filename: chainedImportAlias_file1.ts -import x = require('chainedImportAlias_file0'); +import x = require('./chainedImportAlias_file0'); import y = x; y.m.foo(); diff --git a/tests/cases/compiler/classExpressionExtendingAbstractClass.ts b/tests/cases/compiler/classExpressionExtendingAbstractClass.ts new file mode 100644 index 00000000000..aadec5be7a4 --- /dev/null +++ b/tests/cases/compiler/classExpressionExtendingAbstractClass.ts @@ -0,0 +1,7 @@ +abstract class A { + abstract foo(): void; +} + +var C = class extends A { // no error reported! +}; + diff --git a/tests/cases/compiler/commentInEmptyParameterList1.ts b/tests/cases/compiler/commentInEmptyParameterList1.ts index cae197735d5..65ddbca16dd 100644 --- a/tests/cases/compiler/commentInEmptyParameterList1.ts +++ b/tests/cases/compiler/commentInEmptyParameterList1.ts @@ -1,3 +1,3 @@ -// @comments:true +// @removeComments: false function foo(/** nothing */) { } \ No newline at end of file diff --git a/tests/cases/compiler/commentOnAmbientClass1.ts b/tests/cases/compiler/commentOnAmbientClass1.ts index c13e4193512..1c153e86bf2 100644 --- a/tests/cases/compiler/commentOnAmbientClass1.ts +++ b/tests/cases/compiler/commentOnAmbientClass1.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare class C { } diff --git a/tests/cases/compiler/commentOnAmbientEnum.ts b/tests/cases/compiler/commentOnAmbientEnum.ts index a9ebe107c98..20d89c1b70d 100644 --- a/tests/cases/compiler/commentOnAmbientEnum.ts +++ b/tests/cases/compiler/commentOnAmbientEnum.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare enum C { a, b, diff --git a/tests/cases/compiler/commentOnAmbientModule.ts b/tests/cases/compiler/commentOnAmbientModule.ts index 41e12a61902..a8aeab7efba 100644 --- a/tests/cases/compiler/commentOnAmbientModule.ts +++ b/tests/cases/compiler/commentOnAmbientModule.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare module C { function foo(); } diff --git a/tests/cases/compiler/commentOnAmbientVariable1.ts b/tests/cases/compiler/commentOnAmbientVariable1.ts index 0124be05053..ef539441bd2 100644 --- a/tests/cases/compiler/commentOnAmbientVariable1.ts +++ b/tests/cases/compiler/commentOnAmbientVariable1.ts @@ -1,4 +1,9 @@ -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare var v: number; // Don't keep this comment. diff --git a/tests/cases/compiler/commentOnAmbientfunction.ts b/tests/cases/compiler/commentOnAmbientfunction.ts index d549303fc4f..51f3b6194b5 100644 --- a/tests/cases/compiler/commentOnAmbientfunction.ts +++ b/tests/cases/compiler/commentOnAmbientfunction.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!========= + Keep this pinned comment + ========= +*/ + +/*! Don't keep this pinned comment */ declare function foo(); // Don't keep this comment. diff --git a/tests/cases/compiler/commentOnClassMethod1.ts b/tests/cases/compiler/commentOnClassMethod1.ts index 048e0de984c..a4cca2be8a2 100644 --- a/tests/cases/compiler/commentOnClassMethod1.ts +++ b/tests/cases/compiler/commentOnClassMethod1.ts @@ -1,4 +1,4 @@ -// @comments:true +// @removeComments: false class WebControls { /** * Render a control diff --git a/tests/cases/compiler/commentOnElidedModule1.ts b/tests/cases/compiler/commentOnElidedModule1.ts index 22014a86f5b..0cdb7694273 100644 --- a/tests/cases/compiler/commentOnElidedModule1.ts +++ b/tests/cases/compiler/commentOnElidedModule1.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ module ElidedModule { } diff --git a/tests/cases/compiler/commentOnExpressionStatement1.ts b/tests/cases/compiler/commentOnExpressionStatement1.ts index 430d226ff70..2f64fbcc08d 100644 --- a/tests/cases/compiler/commentOnExpressionStatement1.ts +++ b/tests/cases/compiler/commentOnExpressionStatement1.ts @@ -1,3 +1,3 @@ -// @comments: true +// @removeComments: false 1 + 1; // Comment. \ No newline at end of file diff --git a/tests/cases/compiler/commentOnIfStatement1.ts b/tests/cases/compiler/commentOnIfStatement1.ts index afff0000c86..295a0f513f7 100644 --- a/tests/cases/compiler/commentOnIfStatement1.ts +++ b/tests/cases/compiler/commentOnIfStatement1.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false // Test if (true) { diff --git a/tests/cases/compiler/commentOnImportStatement1.ts b/tests/cases/compiler/commentOnImportStatement1.ts index e26faf21fb6..597509075b3 100644 --- a/tests/cases/compiler/commentOnImportStatement1.ts +++ b/tests/cases/compiler/commentOnImportStatement1.ts @@ -1,5 +1,5 @@ -//@module: amd -// @comments: true +// @module: amd +// @removeComments: false /* Copyright */ import foo = require('./foo'); diff --git a/tests/cases/compiler/commentOnImportStatement2.ts b/tests/cases/compiler/commentOnImportStatement2.ts index 096041f3f5b..ccb5b57887a 100644 --- a/tests/cases/compiler/commentOnImportStatement2.ts +++ b/tests/cases/compiler/commentOnImportStatement2.ts @@ -1,4 +1,4 @@ -//@module: commonjs -// @comments: true +// @module: commonjs +// @removeComments: false /* not copyright */ import foo = require('./foo'); \ No newline at end of file diff --git a/tests/cases/compiler/commentOnImportStatement3.ts b/tests/cases/compiler/commentOnImportStatement3.ts index 0cfef3feeff..d60756ecf7e 100644 --- a/tests/cases/compiler/commentOnImportStatement3.ts +++ b/tests/cases/compiler/commentOnImportStatement3.ts @@ -1,5 +1,5 @@ -//@module: commonjs -// @comments: true +// @module: commonjs +// @removeComments: false /* copyright */ /* not copyright */ diff --git a/tests/cases/compiler/commentOnInterface1.ts b/tests/cases/compiler/commentOnInterface1.ts index a394da0dd2c..c22229b7ccf 100644 --- a/tests/cases/compiler/commentOnInterface1.ts +++ b/tests/cases/compiler/commentOnInterface1.ts @@ -1,5 +1,10 @@ //@filename: a.ts -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ interface I { } diff --git a/tests/cases/compiler/commentOnSignature1.ts b/tests/cases/compiler/commentOnSignature1.ts index 770c103a9fc..e8d2d831e8b 100644 --- a/tests/cases/compiler/commentOnSignature1.ts +++ b/tests/cases/compiler/commentOnSignature1.ts @@ -1,5 +1,10 @@ // @filename: a.ts -/*! Keep this pinned comment */ +/*!================= + Keep this pinned + ================= +*/ + +/*! Don't keep this pinned comment */ function foo(n: number): void; // Don't keep this comment. function foo(s: string): void; diff --git a/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts b/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts index 548548de3d6..b1edc61cb82 100644 --- a/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts +++ b/tests/cases/compiler/commentOnSimpleArrowFunctionBody1.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false function Foo(x: any) { } diff --git a/tests/cases/compiler/commentsBeforeFunctionExpression1.ts b/tests/cases/compiler/commentsBeforeFunctionExpression1.ts index 64fe3b7b6ec..d3b21c18475 100644 --- a/tests/cases/compiler/commentsBeforeFunctionExpression1.ts +++ b/tests/cases/compiler/commentsBeforeFunctionExpression1.ts @@ -1,4 +1,4 @@ -// @comments:true +// @removeComments: false var v = { f: /**own f*/ (a) => 0 } diff --git a/tests/cases/compiler/commentsBeforeVariableStatement1.ts b/tests/cases/compiler/commentsBeforeVariableStatement1.ts index e6c49f17d7f..e4e019cef5e 100644 --- a/tests/cases/compiler/commentsBeforeVariableStatement1.ts +++ b/tests/cases/compiler/commentsBeforeVariableStatement1.ts @@ -1,4 +1,4 @@ -//@module: amd -// @comments: true +// @module: amd +// @removeComments: false /** b's comment*/ export var b: number; diff --git a/tests/cases/compiler/commentsClass.ts b/tests/cases/compiler/commentsClass.ts index e9a8f3cee1d..8823f5db6d2 100644 --- a/tests/cases/compiler/commentsClass.ts +++ b/tests/cases/compiler/commentsClass.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** This is class c2 without constuctor*/ class c2 { diff --git a/tests/cases/compiler/commentsClassMembers.ts b/tests/cases/compiler/commentsClassMembers.ts index 92a3a1356f2..414f560c2a7 100644 --- a/tests/cases/compiler/commentsClassMembers.ts +++ b/tests/cases/compiler/commentsClassMembers.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** This is comment for c1*/ class c1 { diff --git a/tests/cases/compiler/commentsCommentParsing.ts b/tests/cases/compiler/commentsCommentParsing.ts index 7bfc9de4fd2..a1fbf50c61f 100644 --- a/tests/cases/compiler/commentsCommentParsing.ts +++ b/tests/cases/compiler/commentsCommentParsing.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /// This is simple /// comments function simple() { diff --git a/tests/cases/compiler/commentsDottedModuleName.ts b/tests/cases/compiler/commentsDottedModuleName.ts index 136d189d1ac..55266931036 100644 --- a/tests/cases/compiler/commentsDottedModuleName.ts +++ b/tests/cases/compiler/commentsDottedModuleName.ts @@ -1,7 +1,7 @@ -//@module: amd +// @module: amd // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** this is multi declare module*/ export module outerModule.InnerModule { diff --git a/tests/cases/compiler/commentsEnums.ts b/tests/cases/compiler/commentsEnums.ts index 2d69c863f2d..d7d654c1e72 100644 --- a/tests/cases/compiler/commentsEnums.ts +++ b/tests/cases/compiler/commentsEnums.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** Enum of colors*/ enum Colors { diff --git a/tests/cases/compiler/commentsExternalModules.ts b/tests/cases/compiler/commentsExternalModules.ts index 86c6b2be8d3..04489611427 100644 --- a/tests/cases/compiler/commentsExternalModules.ts +++ b/tests/cases/compiler/commentsExternalModules.ts @@ -1,7 +1,7 @@ -//@module: amd +// @module: amd // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @Filename: commentsExternalModules_0.ts /** Module comment*/ diff --git a/tests/cases/compiler/commentsExternalModules2.ts b/tests/cases/compiler/commentsExternalModules2.ts index 354e74738be..b1dfb04902b 100644 --- a/tests/cases/compiler/commentsExternalModules2.ts +++ b/tests/cases/compiler/commentsExternalModules2.ts @@ -1,7 +1,7 @@ -//@module: amd +// @module: amd // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @Filename: commentsExternalModules2_0.ts /** Module comment*/ diff --git a/tests/cases/compiler/commentsExternalModules3.ts b/tests/cases/compiler/commentsExternalModules3.ts index 2f214c5d28c..a59458893ca 100644 --- a/tests/cases/compiler/commentsExternalModules3.ts +++ b/tests/cases/compiler/commentsExternalModules3.ts @@ -1,7 +1,7 @@ -//@module: commonjs +// @module: commonjs // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @Filename: commentsExternalModules2_0.ts /** Module comment*/ @@ -56,7 +56,7 @@ var myvar2 = new m4.m2.c(); // @Filename: commentsExternalModules_1.ts /**This is on import declaration*/ -import extMod = require("commentsExternalModules2_0"); // trailing comment 1 +import extMod = require("./commentsExternalModules2_0"); // trailing comment 1 extMod.m1.fooExport(); export var newVar = new extMod.m1.m2.c(); extMod.m4.fooExport(); diff --git a/tests/cases/compiler/commentsFormatting.ts b/tests/cases/compiler/commentsFormatting.ts index b413f0f92ea..c0f2d3093f9 100644 --- a/tests/cases/compiler/commentsFormatting.ts +++ b/tests/cases/compiler/commentsFormatting.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false module m { /** this is first line - aligned to class declaration diff --git a/tests/cases/compiler/commentsFunction.ts b/tests/cases/compiler/commentsFunction.ts index b71da4ae085..1b379fd15c6 100644 --- a/tests/cases/compiler/commentsFunction.ts +++ b/tests/cases/compiler/commentsFunction.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** This comment should appear for foo*/ function foo() { diff --git a/tests/cases/compiler/commentsInheritance.ts b/tests/cases/compiler/commentsInheritance.ts index aa4c54ee128..40924851766 100644 --- a/tests/cases/compiler/commentsInheritance.ts +++ b/tests/cases/compiler/commentsInheritance.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** i1 is interface with properties*/ interface i1 { diff --git a/tests/cases/compiler/commentsInterface.ts b/tests/cases/compiler/commentsInterface.ts index b6455e9235d..2e35a95f207 100644 --- a/tests/cases/compiler/commentsInterface.ts +++ b/tests/cases/compiler/commentsInterface.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** this is interface 1*/ interface i1 { } diff --git a/tests/cases/compiler/commentsModules.ts b/tests/cases/compiler/commentsModules.ts index 29ac0c22373..943ef640545 100644 --- a/tests/cases/compiler/commentsModules.ts +++ b/tests/cases/compiler/commentsModules.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** Module comment*/ module m1 { /** b's comment*/ diff --git a/tests/cases/compiler/commentsMultiModuleMultiFile.ts b/tests/cases/compiler/commentsMultiModuleMultiFile.ts index 2d19f775bda..04066b975ab 100644 --- a/tests/cases/compiler/commentsMultiModuleMultiFile.ts +++ b/tests/cases/compiler/commentsMultiModuleMultiFile.ts @@ -1,7 +1,7 @@ -//@module: amd +// @module: amd // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @Filename: commentsMultiModuleMultiFile_0.ts /** this is multi declare module*/ diff --git a/tests/cases/compiler/commentsMultiModuleSingleFile.ts b/tests/cases/compiler/commentsMultiModuleSingleFile.ts index a9871d31dbe..651a3cb07ba 100644 --- a/tests/cases/compiler/commentsMultiModuleSingleFile.ts +++ b/tests/cases/compiler/commentsMultiModuleSingleFile.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** this is multi declare module*/ module multiM { diff --git a/tests/cases/compiler/commentsOnObjectLiteral1.ts b/tests/cases/compiler/commentsOnObjectLiteral1.ts index 7bc92e8664e..79e5aa81205 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral1.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral1.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false var Person = makeClass( /** @scope Person diff --git a/tests/cases/compiler/commentsOnObjectLiteral2.ts b/tests/cases/compiler/commentsOnObjectLiteral2.ts index da2ee14b730..952df7ed969 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral2.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral2.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false var Person = makeClass( { /** diff --git a/tests/cases/compiler/commentsOnObjectLiteral3.ts b/tests/cases/compiler/commentsOnObjectLiteral3.ts index 6650b21e167..b983364bf1f 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral3.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral3.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false // @target: ES5 var v = { diff --git a/tests/cases/compiler/commentsOnObjectLiteral4.ts b/tests/cases/compiler/commentsOnObjectLiteral4.ts index e13668530c7..d685304f31e 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral4.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral4.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false // @target: ES5 var v = { diff --git a/tests/cases/compiler/commentsOnReturnStatement1.ts b/tests/cases/compiler/commentsOnReturnStatement1.ts index 966d66511b3..0f689fb4681 100644 --- a/tests/cases/compiler/commentsOnReturnStatement1.ts +++ b/tests/cases/compiler/commentsOnReturnStatement1.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false class DebugClass { public static debugFunc() { // Start Debugger Test Code diff --git a/tests/cases/compiler/commentsOnStaticMembers.ts b/tests/cases/compiler/commentsOnStaticMembers.ts index 7dc1a41c953..dd5169a972a 100644 --- a/tests/cases/compiler/commentsOnStaticMembers.ts +++ b/tests/cases/compiler/commentsOnStaticMembers.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false class test { /** diff --git a/tests/cases/compiler/commentsOverloads.ts b/tests/cases/compiler/commentsOverloads.ts index 85a1a9d8064..efb5d73df8f 100644 --- a/tests/cases/compiler/commentsOverloads.ts +++ b/tests/cases/compiler/commentsOverloads.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** this is signature 1*/ function f1(/**param a*/a: number): number; function f1(b: string): number; diff --git a/tests/cases/compiler/commentsPropertySignature1.ts b/tests/cases/compiler/commentsPropertySignature1.ts index b92b9c6ded7..48ba5c3fda1 100644 --- a/tests/cases/compiler/commentsPropertySignature1.ts +++ b/tests/cases/compiler/commentsPropertySignature1.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false var a = { /** own x*/ x: 0 diff --git a/tests/cases/compiler/commentsTypeParameters.ts b/tests/cases/compiler/commentsTypeParameters.ts index 4fc3a30a192..c1e49280ed0 100644 --- a/tests/cases/compiler/commentsTypeParameters.ts +++ b/tests/cases/compiler/commentsTypeParameters.ts @@ -1,5 +1,5 @@ // @declaration: true -// @comments: true +// @removeComments: false class C { method(a: U) { } diff --git a/tests/cases/compiler/commentsVarDecl.ts b/tests/cases/compiler/commentsVarDecl.ts index 3b7d56e4078..cb244e94365 100644 --- a/tests/cases/compiler/commentsVarDecl.ts +++ b/tests/cases/compiler/commentsVarDecl.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** Variable comments*/ var myVariable = 10; // This trailing Comment1 diff --git a/tests/cases/compiler/commentsVariableStatement1.ts b/tests/cases/compiler/commentsVariableStatement1.ts index 368115af17c..e9c9ca28a08 100644 --- a/tests/cases/compiler/commentsVariableStatement1.ts +++ b/tests/cases/compiler/commentsVariableStatement1.ts @@ -1,5 +1,5 @@ // @declaration: true -// @comments: true +// @removeComments: false /** Comment */ var v = 1; \ No newline at end of file diff --git a/tests/cases/compiler/commentsdoNotEmitComments.ts b/tests/cases/compiler/commentsdoNotEmitComments.ts index 6895f67b6b0..e2aaa269e1f 100644 --- a/tests/cases/compiler/commentsdoNotEmitComments.ts +++ b/tests/cases/compiler/commentsdoNotEmitComments.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: false +// @removeComments: true /** Variable comments*/ var myVariable = 10; diff --git a/tests/cases/compiler/commentsemitComments.ts b/tests/cases/compiler/commentsemitComments.ts index fdedb787739..b20fbb9641a 100644 --- a/tests/cases/compiler/commentsemitComments.ts +++ b/tests/cases/compiler/commentsemitComments.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false /** Variable comments*/ var myVariable = 10; diff --git a/tests/cases/compiler/constEnumToStringNoComments.ts b/tests/cases/compiler/constEnumToStringNoComments.ts index 802ee9068bb..f98ae8d509e 100644 --- a/tests/cases/compiler/constEnumToStringNoComments.ts +++ b/tests/cases/compiler/constEnumToStringNoComments.ts @@ -1,4 +1,4 @@ -// @comments: false +// @removeComments: true const enum Foo { X = 100, Y = 0.5, diff --git a/tests/cases/compiler/constEnumToStringWithComments.ts b/tests/cases/compiler/constEnumToStringWithComments.ts index e10c3591131..ce85d8b256f 100644 --- a/tests/cases/compiler/constEnumToStringWithComments.ts +++ b/tests/cases/compiler/constEnumToStringWithComments.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false const enum Foo { X = 100, Y = 0.5, diff --git a/tests/cases/compiler/declFileAccessors.ts b/tests/cases/compiler/declFileAccessors.ts index ea9b05f2fef..bc41722f77d 100644 --- a/tests/cases/compiler/declFileAccessors.ts +++ b/tests/cases/compiler/declFileAccessors.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileAccessors_0.ts diff --git a/tests/cases/compiler/declFileAliasUseBeforeDeclaration.ts b/tests/cases/compiler/declFileAliasUseBeforeDeclaration.ts index c803f65cf7c..63cd2761a9e 100644 --- a/tests/cases/compiler/declFileAliasUseBeforeDeclaration.ts +++ b/tests/cases/compiler/declFileAliasUseBeforeDeclaration.ts @@ -1,9 +1,9 @@ -//@module: commonjs -//@declaration: true +// @module: commonjs +// @declaration: true // @Filename: declFileAliasUseBeforeDeclaration_foo.ts export class Foo { } // @Filename: declFileAliasUseBeforeDeclaration_test.ts export function bar(a: foo.Foo) { } -import foo = require("declFileAliasUseBeforeDeclaration_foo"); \ No newline at end of file +import foo = require("./declFileAliasUseBeforeDeclaration_foo"); \ No newline at end of file diff --git a/tests/cases/compiler/declFileCallSignatures.ts b/tests/cases/compiler/declFileCallSignatures.ts index 9ff74730fbf..4225c580755 100644 --- a/tests/cases/compiler/declFileCallSignatures.ts +++ b/tests/cases/compiler/declFileCallSignatures.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileCallSignatures_0.ts diff --git a/tests/cases/compiler/declFileConstructSignatures.ts b/tests/cases/compiler/declFileConstructSignatures.ts index b81e4f831ea..717619e8b2f 100644 --- a/tests/cases/compiler/declFileConstructSignatures.ts +++ b/tests/cases/compiler/declFileConstructSignatures.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileConstructSignatures_0.ts diff --git a/tests/cases/compiler/declFileConstructors.ts b/tests/cases/compiler/declFileConstructors.ts index c1f4862e44c..8a6a8a6c473 100644 --- a/tests/cases/compiler/declFileConstructors.ts +++ b/tests/cases/compiler/declFileConstructors.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileConstructors_0.ts diff --git a/tests/cases/compiler/declFileForExportedImport.ts b/tests/cases/compiler/declFileForExportedImport.ts index ec286c2711e..8809d0baa37 100644 --- a/tests/cases/compiler/declFileForExportedImport.ts +++ b/tests/cases/compiler/declFileForExportedImport.ts @@ -5,7 +5,7 @@ export var x: number; // @Filename: declFileForExportedImport_1.ts /// -export import a = require('declFileForExportedImport_0'); +export import a = require('./declFileForExportedImport_0'); var y = a.x; export import b = a; diff --git a/tests/cases/compiler/declFileFunctions.ts b/tests/cases/compiler/declFileFunctions.ts index 7b9c55e9214..4217fdf6e95 100644 --- a/tests/cases/compiler/declFileFunctions.ts +++ b/tests/cases/compiler/declFileFunctions.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileFunctions_0.ts diff --git a/tests/cases/compiler/declFileImportModuleWithExportAssignment.ts b/tests/cases/compiler/declFileImportModuleWithExportAssignment.ts index 3e00557eec5..3a619905768 100644 --- a/tests/cases/compiler/declFileImportModuleWithExportAssignment.ts +++ b/tests/cases/compiler/declFileImportModuleWithExportAssignment.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @declaration: true // @Filename: declFileImportModuleWithExportAssignment_0.ts @@ -21,6 +21,6 @@ export = m2; // @Filename: declFileImportModuleWithExportAssignment_1.ts /**This is on import declaration*/ -import a1 = require("declFileImportModuleWithExportAssignment_0"); +import a1 = require("./declFileImportModuleWithExportAssignment_0"); export var a = a1; a.test1(null, null, null); diff --git a/tests/cases/compiler/declFileIndexSignatures.ts b/tests/cases/compiler/declFileIndexSignatures.ts index 3c9aaf34bfc..efc43f80e1f 100644 --- a/tests/cases/compiler/declFileIndexSignatures.ts +++ b/tests/cases/compiler/declFileIndexSignatures.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileIndexSignatures_0.ts diff --git a/tests/cases/compiler/declFileMethods.ts b/tests/cases/compiler/declFileMethods.ts index a5c31728ccd..50add66d97c 100644 --- a/tests/cases/compiler/declFileMethods.ts +++ b/tests/cases/compiler/declFileMethods.ts @@ -1,6 +1,6 @@ // @target: ES5 // @declaration: true -// @comments: true +// @removeComments: false // @module: commonjs // @Filename: declFileMethods_0.ts diff --git a/tests/cases/compiler/declarationEmit_exportAssignment.ts b/tests/cases/compiler/declarationEmit_exportAssignment.ts index 166f4abe8e7..bf9e443c85a 100644 --- a/tests/cases/compiler/declarationEmit_exportAssignment.ts +++ b/tests/cases/compiler/declarationEmit_exportAssignment.ts @@ -8,5 +8,5 @@ export function bar() { } export interface Buzz { } // @filename: index.ts -import {foo} from "utils"; +import {foo} from "./utils"; export = foo; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_exportDeclaration.ts b/tests/cases/compiler/declarationEmit_exportDeclaration.ts index a9e0bda761f..c7cff923b08 100644 --- a/tests/cases/compiler/declarationEmit_exportDeclaration.ts +++ b/tests/cases/compiler/declarationEmit_exportDeclaration.ts @@ -8,7 +8,7 @@ export function bar() { } export interface Buzz { } // @filename: index.ts -import {foo, bar, Buzz} from "utils"; +import {foo, bar, Buzz} from "./utils"; foo(); let obj: Buzz; diff --git a/tests/cases/compiler/declarationEmit_nameConflicts.ts b/tests/cases/compiler/declarationEmit_nameConflicts.ts index 66eb732ddae..a30f4b2ff1b 100644 --- a/tests/cases/compiler/declarationEmit_nameConflicts.ts +++ b/tests/cases/compiler/declarationEmit_nameConflicts.ts @@ -5,7 +5,7 @@ module f { export class c { } } export = f; // @Filename: declarationEmit_nameConflicts_0.ts -import im = require('declarationEmit_nameConflicts_1'); +import im = require('./declarationEmit_nameConflicts_1'); export module M { export function f() { } export class C { } diff --git a/tests/cases/compiler/decoratorMetadataOnInferredType.ts b/tests/cases/compiler/decoratorMetadataOnInferredType.ts new file mode 100644 index 00000000000..170afe3b3e5 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataOnInferredType.ts @@ -0,0 +1,21 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs + +declare var console: { + log(msg: string): void; +}; + +class A { + constructor() { console.log('new A'); } +} + +function decorator(target: Object, propertyKey: string) { +} + +export class B { + @decorator + x = new A(); +} diff --git a/tests/cases/compiler/doNotEmitDetachedComments.ts b/tests/cases/compiler/doNotEmitDetachedComments.ts new file mode 100644 index 00000000000..13facb6625e --- /dev/null +++ b/tests/cases/compiler/doNotEmitDetachedComments.ts @@ -0,0 +1,27 @@ +// @removeComments: true +/* + + multi line + comment +*/ + +var x = 10; + +// Single Line comment + +function foo() { } + + +/* + multi-line comment + +*/ + + +//======================== + + +function bar() { } + + +//======================== diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts new file mode 100644 index 00000000000..094d624df40 --- /dev/null +++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts @@ -0,0 +1,38 @@ +// @removeComments: true +class A { + constructor() { + // Single Line Comment + + var x = 10; + } +} + +class B { + constructor() { + /* + Multi-line comment + */ + + var y = 10; + } +} + +class C { + constructor() { + // Single Line Comment with more than one blank line + + + var x = 10; + } +} + +class D { + constructor() { + /* + Multi-line comment with more than one blank line + */ + + + var y = 10; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts new file mode 100644 index 00000000000..83dd8716df2 --- /dev/null +++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts @@ -0,0 +1,33 @@ +// @removeComments: true +function foo1() { + // Single line comment + + return 42; +} + +function foo2() { + /* + + multi line + comment + */ + + return 42; +} + +function foo3() { + // Single line comment with more than one blank line + + + return 42; +} + +function foo4() { + /* + + multi line comment with more than one blank line + */ + + return 42; +} + diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts new file mode 100644 index 00000000000..be6cd7b37ce --- /dev/null +++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts @@ -0,0 +1,30 @@ +// @removeComments: true +() => { + // Single line comment + + return 0; +} + +() => { + /* + multi-line comment + */ + + return 0; +} + +() => { + // Single line comment with more than one blank line + + + return 0; +} + +() => { + /* + multi-line comment with more than one blank line + */ + + + return 0; +} diff --git a/tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts b/tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts new file mode 100644 index 00000000000..bae1654af87 --- /dev/null +++ b/tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts @@ -0,0 +1,10 @@ +// @removeComments: true +var x = 10; + +/*! + + multi line + comment +*/ + +var x = 10; \ No newline at end of file diff --git a/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNode.ts b/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNode.ts new file mode 100644 index 00000000000..23a1000fa11 --- /dev/null +++ b/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNode.ts @@ -0,0 +1,13 @@ +// @removeComments: true + +class C { + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) + public foo(x: string, y: number) { } +} + +// @Filename: file1.ts +var x = 10; + +/*! remove pinned comment anywhere else */ +declare var OData: any; \ No newline at end of file diff --git a/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts b/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts new file mode 100644 index 00000000000..27c5c5f6b7b --- /dev/null +++ b/tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts @@ -0,0 +1,10 @@ +// @removeComments: true + +class C { + /*! remove pinned comment anywhere else */ + public foo(x: string, y: any) + public foo(x: string, y: number) { } +} + +/*! remove pinned comment anywhere else */ +declare var OData: any; \ No newline at end of file diff --git a/tests/cases/compiler/doNotEmitPinnedDetachedComments.ts b/tests/cases/compiler/doNotEmitPinnedDetachedComments.ts new file mode 100644 index 00000000000..f30dc9299ee --- /dev/null +++ b/tests/cases/compiler/doNotEmitPinnedDetachedComments.ts @@ -0,0 +1,32 @@ +// @removeComments: true +var x = 10; + +/*! Single Line comment */ + +function baz() { } + + +/*! + multi-line comment + +*/ + + +//======================== + + +function bar() { + /*! + Remove this comment + */ + +} + +function foo() { + /*! Remove this */ + + return 0; +} + + +//======================== diff --git a/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts b/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts new file mode 100644 index 00000000000..357ce67dbed --- /dev/null +++ b/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts @@ -0,0 +1,10 @@ +// @removeComments: true + +// @Filename: file0.ts + +// @Filename: file1.ts + +// @Filename: file2.ts +/// +/// +/// \ No newline at end of file diff --git a/tests/cases/compiler/doNotEmitTripleSlashCommentsOnNotEmittedNode.ts b/tests/cases/compiler/doNotEmitTripleSlashCommentsOnNotEmittedNode.ts new file mode 100644 index 00000000000..bfa5c5ffc67 --- /dev/null +++ b/tests/cases/compiler/doNotEmitTripleSlashCommentsOnNotEmittedNode.ts @@ -0,0 +1,10 @@ +// @removeComments: true + +// @Filename: file0.ts +/// +declare var OData: any; + +// @Filename: file1.ts +/// +interface F { } + diff --git a/tests/cases/compiler/doNotemitTripleSlashComments.ts b/tests/cases/compiler/doNotemitTripleSlashComments.ts new file mode 100644 index 00000000000..14fdfda2d72 --- /dev/null +++ b/tests/cases/compiler/doNotemitTripleSlashComments.ts @@ -0,0 +1,35 @@ +// @removeComments: true + +// @Filename: file0.ts +/// +/// +/// +var x = 10; + +/// +var y = "hello"; + + +/// + +// @Filename: file1.ts +/// + +function foo() { } + + +/// + + +var z = "world"; + +// @Filename: file2.ts +/// + + +/// ==================================== + + +function bar() { } + + diff --git a/tests/cases/compiler/elidingImportNames.ts b/tests/cases/compiler/elidingImportNames.ts index b5893461664..f9cbf457d53 100644 --- a/tests/cases/compiler/elidingImportNames.ts +++ b/tests/cases/compiler/elidingImportNames.ts @@ -1,10 +1,10 @@ // @module: commonjs // @Filename: elidingImportNames_test.ts -import a = require('elidingImportNames_main'); // alias used in typeof +import a = require('./elidingImportNames_main'); // alias used in typeof var b = a; var x: typeof a; -import a2 = require('elidingImportNames_main1'); // alias not used in typeof +import a2 = require('./elidingImportNames_main1'); // alias not used in typeof var b2 = a2; diff --git a/tests/cases/compiler/emitCommentsOnlyFile.ts b/tests/cases/compiler/emitCommentsOnlyFile.ts index 9ded82be8e9..bcdf34c57b8 100644 --- a/tests/cases/compiler/emitCommentsOnlyFile.ts +++ b/tests/cases/compiler/emitCommentsOnlyFile.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false /** * @name Foo diff --git a/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts b/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts new file mode 100644 index 00000000000..985a5f638b8 --- /dev/null +++ b/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts @@ -0,0 +1,8 @@ +// @removeComments: true +/*! + + multi line + comment +*/ + +var x = 10; \ No newline at end of file diff --git a/tests/cases/compiler/emitPostComments.ts b/tests/cases/compiler/emitPostComments.ts index b76f8dcb2bb..767bf033295 100644 --- a/tests/cases/compiler/emitPostComments.ts +++ b/tests/cases/compiler/emitPostComments.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false var y = 10; /** diff --git a/tests/cases/compiler/emitPreComments.ts b/tests/cases/compiler/emitPreComments.ts index e43c4baaa3b..2d98231e000 100644 --- a/tests/cases/compiler/emitPreComments.ts +++ b/tests/cases/compiler/emitPreComments.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false // This is pre comment var y = 10; diff --git a/tests/cases/compiler/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.ts b/tests/cases/compiler/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.ts new file mode 100644 index 00000000000..56f7814104d --- /dev/null +++ b/tests/cases/compiler/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.ts @@ -0,0 +1,13 @@ +// @removeComments: false + +// @Filename: file0.ts +var x = 10 + +// @Filename: file1.ts +/// +declare var OData: any; + +/// +interface F { } + + diff --git a/tests/cases/compiler/emptyModuleName.ts b/tests/cases/compiler/emptyModuleName.ts new file mode 100644 index 00000000000..d82ff2ba608 --- /dev/null +++ b/tests/cases/compiler/emptyModuleName.ts @@ -0,0 +1,4 @@ +// @module: commonjs +import * as A from ""; +class B extends A { +} \ No newline at end of file diff --git a/tests/cases/compiler/enumFromExternalModule.ts b/tests/cases/compiler/enumFromExternalModule.ts index 3047dd52db3..2e943caf413 100644 --- a/tests/cases/compiler/enumFromExternalModule.ts +++ b/tests/cases/compiler/enumFromExternalModule.ts @@ -1,9 +1,9 @@ -//@module: commonjs +// @module: commonjs // @Filename: enumFromExternalModule_0.ts export enum Mode { Open } // @Filename: enumFromExternalModule_1.ts /// -import f = require('enumFromExternalModule_0'); +import f = require('./enumFromExternalModule_0'); var x = f.Mode.Open; diff --git a/tests/cases/compiler/errorWithTruncatedType.ts b/tests/cases/compiler/errorWithTruncatedType.ts index 307ff642ed9..c615ff928e4 100644 --- a/tests/cases/compiler/errorWithTruncatedType.ts +++ b/tests/cases/compiler/errorWithTruncatedType.ts @@ -1,4 +1,4 @@ -// @errortruncation: true +// @noErrorTruncation: false var x: { propertyWithAnExceedinglyLongName1: string; diff --git a/tests/cases/compiler/errorsOnImportedSymbol.ts b/tests/cases/compiler/errorsOnImportedSymbol.ts index 17f3e5fb92c..b3da9da162e 100644 --- a/tests/cases/compiler/errorsOnImportedSymbol.ts +++ b/tests/cases/compiler/errorsOnImportedSymbol.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @target: ES5 // @Filename: errorsOnImportedSymbol_0.ts @@ -9,7 +9,7 @@ interface Sammy { export = Sammy; // @Filename: errorsOnImportedSymbol_1.ts -import Sammy = require("errorsOnImportedSymbol_0"); +import Sammy = require("./errorsOnImportedSymbol_0"); var x = new Sammy.Sammy(); var y = Sammy.Sammy(); - + diff --git a/tests/cases/compiler/es6ExportAllInEs5.ts b/tests/cases/compiler/es6ExportAllInEs5.ts index ed754e5cacb..3ee95e1a217 100644 --- a/tests/cases/compiler/es6ExportAllInEs5.ts +++ b/tests/cases/compiler/es6ExportAllInEs5.ts @@ -15,4 +15,4 @@ export module uninstantiated { } // @filename: client.ts -export * from "server"; \ No newline at end of file +export * from "./server"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts b/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts index 6361c013367..24dbc77e98f 100644 --- a/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts +++ b/tests/cases/compiler/es6ExportClauseWithoutModuleSpecifierInEs5.ts @@ -15,8 +15,8 @@ export module uninstantiated { } // @filename: client.ts -export { c } from "server"; -export { c as c2 } from "server"; -export { i, m as instantiatedModule } from "server"; -export { uninstantiated } from "server"; -export { x } from "server"; \ No newline at end of file +export { c } from "./server"; +export { c as c2 } from "./server"; +export { i, m as instantiatedModule } from "./server"; +export { uninstantiated } from "./server"; +export { x } from "./server"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingDts.ts b/tests/cases/compiler/es6ImportDefaultBindingDts.ts index 8b8a9787fdd..b4b82768691 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingDts.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingDts.ts @@ -7,6 +7,6 @@ class c { } export default c; // @filename: client.ts -import defaultBinding from "server"; +import defaultBinding from "./server"; export var x = new defaultBinding(); -import defaultBinding2 from "server"; // elide this import since defaultBinding2 is not used +import defaultBinding2 from "./server"; // elide this import since defaultBinding2 is not used diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts index 9a6e1a8ebf5..cb84036af5e 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts @@ -9,15 +9,15 @@ export var m = a; export default {}; // @filename: es6ImportDefaultBindingFollowedWithNamedImport_1.ts -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = a; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = b; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = x; var x1: number = y; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = z; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; var x1: number = m; diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts index d5c9a6a395d..fc13b26e737 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts @@ -7,15 +7,15 @@ var a = 10; export default a; // @filename: es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding1; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding2; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding3; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding4; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding5; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; var x: number = defaultBinding6; diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.ts index 23ec8767d94..ca2b0561433 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.ts @@ -7,15 +7,15 @@ var a = 10; export default a; // @filename: client.ts -export import defaultBinding1, { } from "server"; +export import defaultBinding1, { } from "./server"; export var x1: number = defaultBinding1; -export import defaultBinding2, { a } from "server"; +export import defaultBinding2, { a } from "./server"; export var x1: number = defaultBinding2; -export import defaultBinding3, { a as b } from "server"; +export import defaultBinding3, { a as b } from "./server"; export var x1: number = defaultBinding3; -export import defaultBinding4, { x, a as y } from "server"; +export import defaultBinding4, { x, a as y } from "./server"; export var x1: number = defaultBinding4; -export import defaultBinding5, { x as z, } from "server"; +export import defaultBinding5, { x as z, } from "./server"; export var x1: number = defaultBinding5; -export import defaultBinding6, { m, } from "server"; +export import defaultBinding6, { m, } from "./server"; export var x1: number = defaultBinding6; diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.ts index a84dab94033..87782d66aff 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.ts @@ -10,15 +10,15 @@ export class a12 { } export class x11 { } // @filename: client.ts -import defaultBinding1, { } from "server"; -import defaultBinding2, { a } from "server"; +import defaultBinding1, { } from "./server"; +import defaultBinding2, { a } from "./server"; export var x1 = new a(); -import defaultBinding3, { a11 as b } from "server"; +import defaultBinding3, { a11 as b } from "./server"; export var x2 = new b(); -import defaultBinding4, { x, a12 as y } from "server"; +import defaultBinding4, { x, a12 as y } from "./server"; export var x4 = new x(); export var x5 = new y(); -import defaultBinding5, { x11 as z, } from "server"; +import defaultBinding5, { x11 as z, } from "./server"; export var x3 = new z(); -import defaultBinding6, { m, } from "server"; +import defaultBinding6, { m, } from "./server"; export var x6 = new m(); diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.ts index 7940f211ec7..64e771bebd1 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.ts @@ -7,15 +7,15 @@ class a { } export default a; // @filename: client.ts -import defaultBinding1, { } from "server"; +import defaultBinding1, { } from "./server"; export var x1 = new defaultBinding1(); -import defaultBinding2, { a } from "server"; +import defaultBinding2, { a } from "./server"; export var x2 = new defaultBinding2(); -import defaultBinding3, { a as b } from "server"; +import defaultBinding3, { a as b } from "./server"; export var x3 = new defaultBinding3(); -import defaultBinding4, { x, a as y } from "server"; +import defaultBinding4, { x, a as y } from "./server"; export var x4 = new defaultBinding4(); -import defaultBinding5, { x as z, } from "server"; +import defaultBinding5, { x as z, } from "./server"; export var x5 = new defaultBinding5(); -import defaultBinding6, { m, } from "server"; +import defaultBinding6, { m, } from "./server"; export var x6 = new defaultBinding6(); \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts index 6e42898d1bc..9a7902d66a0 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts @@ -8,15 +8,15 @@ export var x = a; export var m = a; // @filename: es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts -import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; -import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = a; -import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = b; -import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = x; var x1: number = y; -import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = z; -import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; var x1: number = m; diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.ts index 6195b279f72..133abf147cb 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.ts @@ -7,5 +7,5 @@ var a = 10; export default a; // @filename: es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; var x: number = defaultBinding; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.ts index 732f7ef7ba0..c9bb1a6dd10 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.ts @@ -5,5 +5,5 @@ export class a { } // @filename: client.ts -import defaultBinding, * as nameSpaceBinding from "server"; +import defaultBinding, * as nameSpaceBinding from "./server"; export var x = new nameSpaceBinding.a(); \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts index c58ba286e0a..cdc1590ec8f 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts @@ -6,5 +6,5 @@ export var a = 10; // @filename: es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts -import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; +import defaultBinding, * as nameSpaceBinding from "./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; var x: number = nameSpaceBinding.a; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.ts index cafcace08a0..768386f67f6 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.ts @@ -5,5 +5,5 @@ export var a = 10; // @filename: client.ts -export import defaultBinding, * as nameSpaceBinding from "server"; +export import defaultBinding, * as nameSpaceBinding from "./server"; export var x: number = nameSpaceBinding.a; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts index e0877bd74c1..261c1b6079c 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts @@ -7,4 +7,4 @@ var a = 10; export = a; // @filename: es6ImportDefaultBindingInEs5_1.ts -import defaultBinding from "es6ImportDefaultBindingInEs5_0"; \ No newline at end of file +import defaultBinding from "./es6ImportDefaultBindingInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingMergeErrors.ts b/tests/cases/compiler/es6ImportDefaultBindingMergeErrors.ts index 1d87fde5784..3d637abd798 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingMergeErrors.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingMergeErrors.ts @@ -6,11 +6,11 @@ var a = 10; export default a; // @filename: es6ImportDefaultBindingMergeErrors_1.ts -import defaultBinding from "es6ImportDefaultBindingMergeErrors_0"; +import defaultBinding from "./es6ImportDefaultBindingMergeErrors_0"; interface defaultBinding { // This is ok } var x = defaultBinding; -import defaultBinding2 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error +import defaultBinding2 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error var defaultBinding2 = "hello world"; -import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // Should be error -import defaultBinding3 from "es6ImportDefaultBindingMergeErrors_0"; // SHould be error +import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error +import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // SHould be error diff --git a/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts b/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts index 5ab1c743721..74b2abfa83c 100644 --- a/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts +++ b/tests/cases/compiler/es6ImportDefaultBindingNoDefaultProperty.ts @@ -4,4 +4,4 @@ export var a = 10; // @filename: es6ImportDefaultBindingNoDefaultProperty_1.ts -import defaultBinding from "es6ImportDefaultBindingNoDefaultProperty_0"; +import defaultBinding from "./es6ImportDefaultBindingNoDefaultProperty_0"; diff --git a/tests/cases/compiler/es6ImportNameSpaceImport.ts b/tests/cases/compiler/es6ImportNameSpaceImport.ts index 0c831d323d1..87fc59fdbaa 100644 --- a/tests/cases/compiler/es6ImportNameSpaceImport.ts +++ b/tests/cases/compiler/es6ImportNameSpaceImport.ts @@ -6,6 +6,6 @@ export var a = 10; // @filename: es6ImportNameSpaceImport_1.ts -import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; var x = nameSpaceBinding.a; -import * as nameSpaceBinding2 from "es6ImportNameSpaceImport_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this diff --git a/tests/cases/compiler/es6ImportNameSpaceImportDts.ts b/tests/cases/compiler/es6ImportNameSpaceImportDts.ts index 95b85e53edc..77e65123e78 100644 --- a/tests/cases/compiler/es6ImportNameSpaceImportDts.ts +++ b/tests/cases/compiler/es6ImportNameSpaceImportDts.ts @@ -5,6 +5,6 @@ export class c { }; // @filename: client.ts -import * as nameSpaceBinding from "server"; +import * as nameSpaceBinding from "./server"; export var x = new nameSpaceBinding.c(); -import * as nameSpaceBinding2 from "server"; // unreferenced \ No newline at end of file +import * as nameSpaceBinding2 from "./server"; // unreferenced \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts b/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts index 8104fe8b3c0..7900e5b5a2b 100644 --- a/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts +++ b/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts @@ -6,6 +6,6 @@ export var a = 10; // @filename: es6ImportNameSpaceImportInEs5_1.ts -import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportInEs5_0"; var x = nameSpaceBinding.a; -import * as nameSpaceBinding2 from "es6ImportNameSpaceImportInEs5_0"; // elide this +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImportInEs5_0"; // elide this diff --git a/tests/cases/compiler/es6ImportNameSpaceImportMergeErrors.ts b/tests/cases/compiler/es6ImportNameSpaceImportMergeErrors.ts index d4b69e8bcf4..cdedbe3fe9b 100644 --- a/tests/cases/compiler/es6ImportNameSpaceImportMergeErrors.ts +++ b/tests/cases/compiler/es6ImportNameSpaceImportMergeErrors.ts @@ -5,11 +5,11 @@ export var a = 10; // @filename: es6ImportNameSpaceImportMergeErrors_1.ts -import * as nameSpaceBinding from "es6ImportNameSpaceImportMergeErrors_0"; +import * as nameSpaceBinding from "./es6ImportNameSpaceImportMergeErrors_0"; interface nameSpaceBinding { } // this should be ok -import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error -import * as nameSpaceBinding1 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding1 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error -import * as nameSpaceBinding3 from "es6ImportNameSpaceImportMergeErrors_0"; // should be error +import * as nameSpaceBinding3 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error var nameSpaceBinding3 = 10; diff --git a/tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports.ts b/tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports.ts index 7d3bdcec94c..fe471dbc6c7 100644 --- a/tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports.ts +++ b/tests/cases/compiler/es6ImportNameSpaceImportNoNamedExports.ts @@ -6,4 +6,4 @@ var a = 10; export = a; // @filename: es6ImportNameSpaceImportNoNamedExports_1.ts -import * as nameSpaceBinding from "es6ImportNameSpaceImportNoNamedExports_0"; // error \ No newline at end of file +import * as nameSpaceBinding from "./es6ImportNameSpaceImportNoNamedExports_0"; // error \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImport.ts b/tests/cases/compiler/es6ImportNamedImport.ts index 0a12e10169b..d71b27eeede 100644 --- a/tests/cases/compiler/es6ImportNamedImport.ts +++ b/tests/cases/compiler/es6ImportNamedImport.ts @@ -13,30 +13,30 @@ export var z2 = 10; export var aaaa = 10; // @filename: es6ImportNamedImport_1.ts -import { } from "es6ImportNamedImport_0"; -import { a } from "es6ImportNamedImport_0"; +import { } from "./es6ImportNamedImport_0"; +import { a } from "./es6ImportNamedImport_0"; var xxxx = a; -import { a as b } from "es6ImportNamedImport_0"; +import { a as b } from "./es6ImportNamedImport_0"; var xxxx = b; -import { x, a as y } from "es6ImportNamedImport_0"; +import { x, a as y } from "./es6ImportNamedImport_0"; var xxxx = x; var xxxx = y; -import { x as z, } from "es6ImportNamedImport_0"; +import { x as z, } from "./es6ImportNamedImport_0"; var xxxx = z; -import { m, } from "es6ImportNamedImport_0"; +import { m, } from "./es6ImportNamedImport_0"; var xxxx = m; -import { a1, x1 } from "es6ImportNamedImport_0"; +import { a1, x1 } from "./es6ImportNamedImport_0"; var xxxx = a1; var xxxx = x1; -import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; var xxxx = a11; var xxxx = x11; -import { z1 } from "es6ImportNamedImport_0"; +import { z1 } from "./es6ImportNamedImport_0"; var z111 = z1; -import { z2 as z3 } from "es6ImportNamedImport_0"; +import { z2 as z3 } from "./es6ImportNamedImport_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided -import { aaaa } from "es6ImportNamedImport_0"; +import { aaaa } from "./es6ImportNamedImport_0"; // These are elided -import { aaaa as bbbb } from "es6ImportNamedImport_0"; +import { aaaa as bbbb } from "./es6ImportNamedImport_0"; diff --git a/tests/cases/compiler/es6ImportNamedImportDts.ts b/tests/cases/compiler/es6ImportNamedImportDts.ts index d83672f3754..b98a20ecfa1 100644 --- a/tests/cases/compiler/es6ImportNamedImportDts.ts +++ b/tests/cases/compiler/es6ImportNamedImportDts.ts @@ -18,29 +18,29 @@ export class aaaa { } export class aaaa1 { } // @filename: client.ts -import { } from "server"; -import { a } from "server"; +import { } from "./server"; +import { a } from "./server"; export var xxxx = new a(); -import { a11 as b } from "server"; +import { a11 as b } from "./server"; export var xxxx1 = new b(); -import { x, a12 as y } from "server"; +import { x, a12 as y } from "./server"; export var xxxx2 = new x(); export var xxxx3 = new y(); -import { x11 as z, } from "server"; +import { x11 as z, } from "./server"; export var xxxx4 = new z(); -import { m, } from "server"; +import { m, } from "./server"; export var xxxx5 = new m(); -import { a1, x1 } from "server"; +import { a1, x1 } from "./server"; export var xxxx6 = new a1(); export var xxxx7 = new x1(); -import { a111 as a11, x111 as x11 } from "server"; +import { a111 as a11, x111 as x11 } from "./server"; export var xxxx8 = new a11(); export var xxxx9 = new x11(); -import { z1 } from "server"; +import { z1 } from "./server"; export var z111 = new z1(); -import { z2 as z3 } from "server"; +import { z2 as z3 } from "./server"; export var z2 = new z3(); // z2 shouldn't give redeclare error // not referenced -import { aaaa } from "server"; -import { aaaa1 as bbbb } from "server"; +import { aaaa } from "./server"; +import { aaaa1 as bbbb } from "./server"; diff --git a/tests/cases/compiler/es6ImportNamedImportInEs5.ts b/tests/cases/compiler/es6ImportNamedImportInEs5.ts index e12a8d032d3..428ad235329 100644 --- a/tests/cases/compiler/es6ImportNamedImportInEs5.ts +++ b/tests/cases/compiler/es6ImportNamedImportInEs5.ts @@ -13,30 +13,30 @@ export var z2 = 10; export var aaaa = 10; // @filename: es6ImportNamedImportInEs5_1.ts -import { } from "es6ImportNamedImportInEs5_0"; -import { a } from "es6ImportNamedImportInEs5_0"; +import { } from "./es6ImportNamedImportInEs5_0"; +import { a } from "./es6ImportNamedImportInEs5_0"; var xxxx = a; -import { a as b } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "./es6ImportNamedImportInEs5_0"; var xxxx = b; -import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "./es6ImportNamedImportInEs5_0"; var xxxx = x; var xxxx = y; -import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "./es6ImportNamedImportInEs5_0"; var xxxx = z; -import { m, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "./es6ImportNamedImportInEs5_0"; var xxxx = m; -import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "./es6ImportNamedImportInEs5_0"; var xxxx = a1; var xxxx = x1; -import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImportInEs5_0"; var xxxx = a11; var xxxx = x11; -import { z1 } from "es6ImportNamedImportInEs5_0"; +import { z1 } from "./es6ImportNamedImportInEs5_0"; var z111 = z1; -import { z2 as z3 } from "es6ImportNamedImportInEs5_0"; +import { z2 as z3 } from "./es6ImportNamedImportInEs5_0"; var z2 = z3; // z2 shouldn't give redeclare error // These are elided -import { aaaa } from "es6ImportNamedImportInEs5_0"; +import { aaaa } from "./es6ImportNamedImportInEs5_0"; // These are elided -import { aaaa as bbbb } from "es6ImportNamedImportInEs5_0"; +import { aaaa as bbbb } from "./es6ImportNamedImportInEs5_0"; diff --git a/tests/cases/compiler/es6ImportNamedImportInExportAssignment.ts b/tests/cases/compiler/es6ImportNamedImportInExportAssignment.ts index 7a4519c68bb..e3f64e1e747 100644 --- a/tests/cases/compiler/es6ImportNamedImportInExportAssignment.ts +++ b/tests/cases/compiler/es6ImportNamedImportInExportAssignment.ts @@ -6,5 +6,5 @@ export var a = 10; // @filename: es6ImportNamedImportInExportAssignment_1.ts -import { a } from "es6ImportNamedImportInExportAssignment_0"; +import { a } from "./es6ImportNamedImportInExportAssignment_0"; export = a; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts b/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts index 16d11d4e19f..381a21f58ea 100644 --- a/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts +++ b/tests/cases/compiler/es6ImportNamedImportInIndirectExportAssignment.ts @@ -8,6 +8,6 @@ export module a { } // @filename: es6ImportNamedImportInIndirectExportAssignment_1.ts -import { a } from "es6ImportNamedImportInIndirectExportAssignment_0"; +import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; import x = a; export = x; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportMergeErrors.ts b/tests/cases/compiler/es6ImportNamedImportMergeErrors.ts index 54e30be1e23..60f13d51355 100644 --- a/tests/cases/compiler/es6ImportNamedImportMergeErrors.ts +++ b/tests/cases/compiler/es6ImportNamedImportMergeErrors.ts @@ -7,13 +7,13 @@ export var z = a; export var z1 = a; // @filename: es6ImportNamedImportMergeErrors_1.ts -import { a } from "es6ImportNamedImportMergeErrors_0"; +import { a } from "./es6ImportNamedImportMergeErrors_0"; interface a { } // shouldnt be error -import { x as x1 } from "es6ImportNamedImportMergeErrors_0"; +import { x as x1 } from "./es6ImportNamedImportMergeErrors_0"; interface x1 { } // shouldnt be error -import { x } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { x } from "./es6ImportNamedImportMergeErrors_0"; // should be error var x = 10; -import { x as x44 } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { x as x44 } from "./es6ImportNamedImportMergeErrors_0"; // should be error var x44 = 10; -import { z } from "es6ImportNamedImportMergeErrors_0"; // should be error -import { z1 as z } from "es6ImportNamedImportMergeErrors_0"; // should be error +import { z } from "./es6ImportNamedImportMergeErrors_0"; // should be error +import { z1 as z } from "./es6ImportNamedImportMergeErrors_0"; // should be error diff --git a/tests/cases/compiler/es6ImportNamedImportNoExportMember.ts b/tests/cases/compiler/es6ImportNamedImportNoExportMember.ts index bd507308d8d..48f8036a753 100644 --- a/tests/cases/compiler/es6ImportNamedImportNoExportMember.ts +++ b/tests/cases/compiler/es6ImportNamedImportNoExportMember.ts @@ -5,5 +5,5 @@ export var a = 10; export var x = a; // @filename: es6ImportNamedImport_1.ts -import { a1 } from "es6ImportNamedImportNoExportMember_0"; -import { x1 as x } from "es6ImportNamedImportNoExportMember_0"; \ No newline at end of file +import { a1 } from "./es6ImportNamedImportNoExportMember_0"; +import { x1 as x } from "./es6ImportNamedImportNoExportMember_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportNoNamedExports.ts b/tests/cases/compiler/es6ImportNamedImportNoNamedExports.ts index 9dd243ff36d..9e46253cc9c 100644 --- a/tests/cases/compiler/es6ImportNamedImportNoNamedExports.ts +++ b/tests/cases/compiler/es6ImportNamedImportNoNamedExports.ts @@ -6,5 +6,5 @@ var a = 10; export = a; // @filename: es6ImportNamedImportNoNamedExports_1.ts -import { a } from "es6ImportNamedImportNoNamedExports_0"; -import { a as x } from "es6ImportNamedImportNoNamedExports_0"; \ No newline at end of file +import { a } from "./es6ImportNamedImportNoNamedExports_0"; +import { a as x } from "./es6ImportNamedImportNoNamedExports_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportWithExport.ts b/tests/cases/compiler/es6ImportNamedImportWithExport.ts index f25a3779b99..9643a82b9b9 100644 --- a/tests/cases/compiler/es6ImportNamedImportWithExport.ts +++ b/tests/cases/compiler/es6ImportNamedImportWithExport.ts @@ -12,29 +12,29 @@ export var z2 = 10; export var aaaa = 10; // @filename: client.ts -export import { } from "server"; -export import { a } from "server"; +export import { } from "./server"; +export import { a } from "./server"; export var xxxx = a; -export import { a as b } from "server"; +export import { a as b } from "./server"; export var xxxx = b; -export import { x, a as y } from "server"; +export import { x, a as y } from "./server"; export var xxxx = x; export var xxxx = y; -export import { x as z, } from "server"; +export import { x as z, } from "./server"; export var xxxx = z; -export import { m, } from "server"; +export import { m, } from "./server"; export var xxxx = m; -export import { a1, x1 } from "server"; +export import { a1, x1 } from "./server"; export var xxxx = a1; export var xxxx = x1; -export import { a1 as a11, x1 as x11 } from "server"; +export import { a1 as a11, x1 as x11 } from "./server"; export var xxxx = a11; export var xxxx = x11; -export import { z1 } from "server"; +export import { z1 } from "./server"; export var z111 = z1; -export import { z2 as z3 } from "server"; +export import { z2 as z3 } from "./server"; export var z2 = z3; // z2 shouldn't give redeclare error // Non referenced imports -export import { aaaa } from "server"; -export import { aaaa as bbbb } from "server"; +export import { aaaa } from "./server"; +export import { aaaa as bbbb } from "./server"; diff --git a/tests/cases/compiler/es6ImportNamedImportWithTypesAndValues.ts b/tests/cases/compiler/es6ImportNamedImportWithTypesAndValues.ts index 08294e57232..4b5a2f17ab0 100644 --- a/tests/cases/compiler/es6ImportNamedImportWithTypesAndValues.ts +++ b/tests/cases/compiler/es6ImportNamedImportWithTypesAndValues.ts @@ -16,6 +16,6 @@ export class C2 implements I2 { } // @filename: client.ts -import { C, I, C2 } from "server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file +import { C, I, C2 } from "./server"; // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file export type cValInterface = I; export var cVal = new C(); \ No newline at end of file diff --git a/tests/cases/compiler/exportAssignClassAndModule.ts b/tests/cases/compiler/exportAssignClassAndModule.ts index 1124234ae8d..0ac65454b00 100644 --- a/tests/cases/compiler/exportAssignClassAndModule.ts +++ b/tests/cases/compiler/exportAssignClassAndModule.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: exportAssignClassAndModule_0.ts class Foo { x: Foo.Bar; @@ -11,7 +11,7 @@ export = Foo; // @Filename: exportAssignClassAndModule_1.ts /// -import Foo = require('exportAssignClassAndModule_0'); +import Foo = require('./exportAssignClassAndModule_0'); var z: Foo.Bar; var zz: Foo; diff --git a/tests/cases/compiler/exportAssignmentEnum.ts b/tests/cases/compiler/exportAssignmentEnum.ts index debaab1e5e8..dff61fdb5df 100644 --- a/tests/cases/compiler/exportAssignmentEnum.ts +++ b/tests/cases/compiler/exportAssignmentEnum.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: exportAssignmentEnum_A.ts enum E { A, @@ -9,7 +9,7 @@ enum E { export = E; // @Filename: exportAssignmentEnum_B.ts -import EnumE = require("exportAssignmentEnum_A"); +import EnumE = require("./exportAssignmentEnum_A"); var a = EnumE.A; var b = EnumE.B; diff --git a/tests/cases/compiler/exportAssignmentOfDeclaredExternalModule.ts b/tests/cases/compiler/exportAssignmentOfDeclaredExternalModule.ts index 63c1f01eb28..fd6b55c9c08 100644 --- a/tests/cases/compiler/exportAssignmentOfDeclaredExternalModule.ts +++ b/tests/cases/compiler/exportAssignmentOfDeclaredExternalModule.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: exportAssignmentOfDeclaredExternalModule_0.ts interface Sammy { new (): any; // a constructor signature @@ -8,7 +8,7 @@ export = Sammy; // @Filename: exportAssignmentOfDeclaredExternalModule_1.ts /// -import Sammy = require('exportAssignmentOfDeclaredExternalModule_0'); +import Sammy = require('./exportAssignmentOfDeclaredExternalModule_0'); var x = new Sammy(); // error to use as constructor as there is not constructor symbol var y = Sammy(); // error to use interface name as call target var z: Sammy; // no error - z is of type interface Sammy from module 'M' diff --git a/tests/cases/compiler/exportAssignmentVariable.ts b/tests/cases/compiler/exportAssignmentVariable.ts index b1ba2452884..9bb53a7c89d 100644 --- a/tests/cases/compiler/exportAssignmentVariable.ts +++ b/tests/cases/compiler/exportAssignmentVariable.ts @@ -1,10 +1,10 @@ -//@module: commonjs +// @module: commonjs // @Filename: exportAssignmentVariable_A.ts var x = 0; export = x; // @Filename: exportAssignmentVariable_B.ts -import y = require("exportAssignmentVariable_A"); +import y = require("./exportAssignmentVariable_A"); var n: number = y; \ No newline at end of file diff --git a/tests/cases/compiler/exportEqualMemberMissing.ts b/tests/cases/compiler/exportEqualMemberMissing.ts index 6f916b65260..89b328f0536 100644 --- a/tests/cases/compiler/exportEqualMemberMissing.ts +++ b/tests/cases/compiler/exportEqualMemberMissing.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: exportEqualMemberMissing_0.ts module server { export interface connectModule { @@ -16,5 +16,5 @@ export = server; // @Filename: exportEqualMemberMissing_1.ts /// -import connect = require('exportEqualMemberMissing_0'); +import connect = require('./exportEqualMemberMissing_0'); connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. diff --git a/tests/cases/compiler/exportStarFromEmptyModule.ts b/tests/cases/compiler/exportStarFromEmptyModule.ts index 163576f1c08..8e4ea8a7b21 100644 --- a/tests/cases/compiler/exportStarFromEmptyModule.ts +++ b/tests/cases/compiler/exportStarFromEmptyModule.ts @@ -11,15 +11,15 @@ export class A { // empty // @filename: exportStarFromEmptyModule_module3.ts -export * from "exportStarFromEmptyModule_module2"; -export * from "exportStarFromEmptyModule_module1"; +export * from "./exportStarFromEmptyModule_module2"; +export * from "./exportStarFromEmptyModule_module1"; export class A { static q; } // @filename: exportStarFromEmptyModule_module4.ts -import * as X from "exportStarFromEmptyModule_module3"; +import * as X from "./exportStarFromEmptyModule_module3"; var s: X.A; X.A.q; X.A.r; // Error \ No newline at end of file diff --git a/tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer.ts b/tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer.ts index 9cd73deb90d..4e5a67665d9 100644 --- a/tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer.ts +++ b/tests/cases/compiler/extendingClassFromAliasAndUsageInIndexer.ts @@ -1,25 +1,25 @@ -//@module: commonjs +// @module: commonjs // @Filename: extendingClassFromAliasAndUsageInIndexer_backbone.ts export class Model { public someData: string; } // @Filename: extendingClassFromAliasAndUsageInIndexer_moduleA.ts -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { // interesting stuff here } // @Filename: extendingClassFromAliasAndUsageInIndexer_moduleB.ts -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); export class VisualizationModel extends Backbone.Model { // different interesting stuff here } // @Filename: extendingClassFromAliasAndUsageInIndexer_main.ts -import Backbone = require("extendingClassFromAliasAndUsageInIndexer_backbone"); -import moduleA = require("extendingClassFromAliasAndUsageInIndexer_moduleA"); -import moduleB = require("extendingClassFromAliasAndUsageInIndexer_moduleB"); +import Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); +import moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); +import moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); interface IHasVisualizationModel { VisualizationModel: typeof Backbone.Model; } diff --git a/tests/cases/compiler/externalModuleExportingGenericClass.ts b/tests/cases/compiler/externalModuleExportingGenericClass.ts index 882dd1c5603..b20afb56013 100644 --- a/tests/cases/compiler/externalModuleExportingGenericClass.ts +++ b/tests/cases/compiler/externalModuleExportingGenericClass.ts @@ -8,7 +8,7 @@ export = C; // @Filename: externalModuleExportingGenericClass_file1.ts -import a = require('externalModuleExportingGenericClass_file0'); +import a = require('./externalModuleExportingGenericClass_file0'); var v: a; // this should report error var v2: any = (new a()).foo; var v3: number = (new a()).foo; diff --git a/tests/cases/compiler/externalModuleImmutableBindings.ts b/tests/cases/compiler/externalModuleImmutableBindings.ts index 2321961f6f8..33e1b9894e1 100644 --- a/tests/cases/compiler/externalModuleImmutableBindings.ts +++ b/tests/cases/compiler/externalModuleImmutableBindings.ts @@ -5,7 +5,7 @@ export var x = 1; // @Filename: f2.ts // all mutations below are illegal and should be fixed -import * as stuff from 'f1'; +import * as stuff from './f1'; var n = 'baz'; diff --git a/tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.ts b/tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.ts index 79cf425bdda..55922da6ca8 100644 --- a/tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.ts +++ b/tests/cases/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: externalModuleRefernceResolutionOrderInImportDeclaration_file1.ts export function foo() { }; @@ -10,7 +10,7 @@ declare module "externalModuleRefernceResolutionOrderInImportDeclaration_file1" // @Filename: externalModuleRefernceResolutionOrderInImportDeclaration_file3.ts /// -import file1 = require('externalModuleRefernceResolutionOrderInImportDeclaration_file1'); +import file1 = require('./externalModuleRefernceResolutionOrderInImportDeclaration_file1'); file1.foo(); file1.bar(); diff --git a/tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts b/tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts index 4283e3d32a9..875e3205407 100644 --- a/tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts +++ b/tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts @@ -1,4 +1,3 @@ -// @module: unspecified // Not on line 0 because we want to verify the error is placed in the appropriate location. export module M { diff --git a/tests/cases/compiler/importAsBaseClass.ts b/tests/cases/compiler/importAsBaseClass.ts index b533453773c..4077ca952b9 100644 --- a/tests/cases/compiler/importAsBaseClass.ts +++ b/tests/cases/compiler/importAsBaseClass.ts @@ -1,9 +1,9 @@ -//@module: commonjs +// @module: commonjs // @Filename: importAsBaseClass_0.ts export class Greeter { greet() { return 'greet' } } // @Filename: importAsBaseClass_1.ts -import Greeter = require("importAsBaseClass_0"); +import Greeter = require("./importAsBaseClass_0"); class Hello extends Greeter { } diff --git a/tests/cases/compiler/importDecl.ts b/tests/cases/compiler/importDecl.ts index c28b332eb43..e7c3a0789ce 100644 --- a/tests/cases/compiler/importDecl.ts +++ b/tests/cases/compiler/importDecl.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @declaration: true // @Filename: importDecl_require.ts export class d { @@ -29,7 +29,7 @@ export var x: d; export function foo(): d { return null; } // @Filename: importDecl_require4.ts -import m4 = require("importDecl_require"); +import m4 = require("./importDecl_require"); export function foo2(): m4.d { return null; } // @Filename: importDecl_1.ts @@ -38,7 +38,7 @@ export function foo2(): m4.d { return null; } /// /// /// -import m4 = require("importDecl_require"); // Emit used +import m4 = require("./importDecl_require"); // Emit used export var x4 = m4.x; export var d4 = m4.d; export var f4 = m4.foo(); @@ -54,16 +54,16 @@ export module m1 { } //Emit global only usage -import glo_m4 = require("importDecl_require1"); +import glo_m4 = require("./importDecl_require1"); export var useGlo_m4_d4 = glo_m4.d; export var useGlo_m4_f4 = glo_m4.foo(); //Emit even when used just in function type -import fncOnly_m4 = require("importDecl_require2"); +import fncOnly_m4 = require("./importDecl_require2"); export var useFncOnly_m4_f4 = fncOnly_m4.foo(); // only used privately no need to emit -import private_m4 = require("importDecl_require3"); +import private_m4 = require("./importDecl_require3"); export module usePrivate_m4_m1 { var x3 = private_m4.x; var d3 = private_m4.d; @@ -71,11 +71,11 @@ export module usePrivate_m4_m1 { } // Do not emit unused import -import m5 = require("importDecl_require4"); +import m5 = require("./importDecl_require4"); export var d = m5.foo2(); // Do not emit multiple used import statements -import multiImport_m4 = require("importDecl_require"); // Emit used +import multiImport_m4 = require("./importDecl_require"); // Emit used export var useMultiImport_m4_x4 = multiImport_m4.x; export var useMultiImport_m4_d4 = multiImport_m4.d; export var useMultiImport_m4_f4 = multiImport_m4.foo(); diff --git a/tests/cases/compiler/importDeclarationUsedAsTypeQuery.ts b/tests/cases/compiler/importDeclarationUsedAsTypeQuery.ts index aea205dd447..5fc77ca1a8e 100644 --- a/tests/cases/compiler/importDeclarationUsedAsTypeQuery.ts +++ b/tests/cases/compiler/importDeclarationUsedAsTypeQuery.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @declaration: true // @Filename: importDeclarationUsedAsTypeQuery_require.ts export class B { @@ -7,5 +7,5 @@ export class B { // @Filename: importDeclarationUsedAsTypeQuery_1.ts /// -import a = require('importDeclarationUsedAsTypeQuery_require'); +import a = require('./importDeclarationUsedAsTypeQuery_require'); export var x: typeof a; diff --git a/tests/cases/compiler/importUsedInExtendsList1.ts b/tests/cases/compiler/importUsedInExtendsList1.ts index f76ccc874c9..f5e3b77f1e3 100644 --- a/tests/cases/compiler/importUsedInExtendsList1.ts +++ b/tests/cases/compiler/importUsedInExtendsList1.ts @@ -1,10 +1,10 @@ -//@module: commonjs +// @module: commonjs // @Filename: importUsedInExtendsList1_require.ts export class Super { foo: string; } // @Filename: importUsedInExtendsList1_1.ts /// -import foo = require('importUsedInExtendsList1_require'); +import foo = require('./importUsedInExtendsList1_require'); class Sub extends foo.Super { } var s: Sub; var r: string = s.foo; diff --git a/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx b/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx new file mode 100644 index 00000000000..dc32ef7a0ca --- /dev/null +++ b/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx @@ -0,0 +1,4 @@ +//@jsx: preserve + +declare var React: any; + \ No newline at end of file diff --git a/tests/cases/compiler/keywordInJsxIdentifier.tsx b/tests/cases/compiler/keywordInJsxIdentifier.tsx new file mode 100644 index 00000000000..ce858edae5d --- /dev/null +++ b/tests/cases/compiler/keywordInJsxIdentifier.tsx @@ -0,0 +1,7 @@ +//@jsx: react + +declare var React: any; +; +; +; +; diff --git a/tests/cases/compiler/lambdaASIEmit.ts b/tests/cases/compiler/lambdaASIEmit.ts index 44ee992ff47..c803b87411d 100644 --- a/tests/cases/compiler/lambdaASIEmit.ts +++ b/tests/cases/compiler/lambdaASIEmit.ts @@ -1,4 +1,4 @@ -// @comments: true +// @removeComments: false function Foo(x: any) { diff --git a/tests/cases/compiler/localAliasExportAssignment.ts b/tests/cases/compiler/localAliasExportAssignment.ts index 8e6df40403b..9fe29ba91d1 100644 --- a/tests/cases/compiler/localAliasExportAssignment.ts +++ b/tests/cases/compiler/localAliasExportAssignment.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: localAliasExportAssignment_0.ts var server: { (): any; @@ -8,7 +8,7 @@ export = server; // @Filename: localAliasExportAssignment_1.ts /// -import connect = require('localAliasExportAssignment_0'); +import connect = require('./localAliasExportAssignment_0'); connect(); diff --git a/tests/cases/compiler/moduleInTypePosition1.ts b/tests/cases/compiler/moduleInTypePosition1.ts index 170afc1f876..51481a5c0ea 100644 --- a/tests/cases/compiler/moduleInTypePosition1.ts +++ b/tests/cases/compiler/moduleInTypePosition1.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: moduleInTypePosition1_0.ts export class Promise { foo: string; @@ -6,5 +6,5 @@ export class Promise { // @Filename: moduleInTypePosition1_1.ts /// -import WinJS = require('moduleInTypePosition1_0'); +import WinJS = require('./moduleInTypePosition1_0'); var x = (w1: WinJS) => { }; diff --git a/tests/cases/compiler/multiImportExport.ts b/tests/cases/compiler/multiImportExport.ts index 939a6e1061e..fe253e282ad 100644 --- a/tests/cases/compiler/multiImportExport.ts +++ b/tests/cases/compiler/multiImportExport.ts @@ -5,10 +5,10 @@ import Drawing = require('./Drawing'); var addr = new Drawing.Math.Adder(); // @Filename: Drawing.ts -export import Math = require('Math/Math') +export import Math = require('./Math/Math') // @Filename: Math/Math.ts -import Adder = require('Math/Adder'); +import Adder = require('./Adder'); var Math = { Adder:Adder diff --git a/tests/cases/compiler/nodeResolution4.ts b/tests/cases/compiler/nodeResolution4.ts new file mode 100644 index 00000000000..247546c3f0c --- /dev/null +++ b/tests/cases/compiler/nodeResolution4.ts @@ -0,0 +1,12 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: ref.ts +var x = 1; + +// @filename: a.ts +/// +export var y; + +// @filename: b.ts +import y = require("./a"); \ No newline at end of file diff --git a/tests/cases/compiler/nodeResolution5.ts b/tests/cases/compiler/nodeResolution5.ts new file mode 100644 index 00000000000..313dabd7899 --- /dev/null +++ b/tests/cases/compiler/nodeResolution5.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a.d.ts +declare module "a" { + var x: number; +} + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution6.ts b/tests/cases/compiler/nodeResolution6.ts new file mode 100644 index 00000000000..3f6dc81c847 --- /dev/null +++ b/tests/cases/compiler/nodeResolution6.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/ref.ts +var x = 1; + +// @filename: node_modules/a.d.ts +/// +export declare var y; + + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution7.ts b/tests/cases/compiler/nodeResolution7.ts new file mode 100644 index 00000000000..b4283edb76a --- /dev/null +++ b/tests/cases/compiler/nodeResolution7.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a/index.d.ts +declare module "a" { + var x: number; +} + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution8.ts b/tests/cases/compiler/nodeResolution8.ts new file mode 100644 index 00000000000..0a6e528f20a --- /dev/null +++ b/tests/cases/compiler/nodeResolution8.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a/ref.ts +var x = 1; + +// @filename: node_modules/a/index.d.ts +/// +export declare var y; + + +// @filename: b.ts +import y = require("a"); \ No newline at end of file diff --git a/tests/cases/compiler/out-flag.ts b/tests/cases/compiler/out-flag.ts index 45a8d92805c..07cd55224a5 100644 --- a/tests/cases/compiler/out-flag.ts +++ b/tests/cases/compiler/out-flag.ts @@ -3,7 +3,7 @@ // @declaration: true // @module: commonjs //// @out: bin\ -// @comments: true +// @removeComments: false // my class comments class MyClass diff --git a/tests/cases/compiler/pinnedComments1.ts b/tests/cases/compiler/pinnedComments1.ts index 474769e9b20..1bf99943c5b 100644 --- a/tests/cases/compiler/pinnedComments1.ts +++ b/tests/cases/compiler/pinnedComments1.ts @@ -1,6 +1,10 @@ -// @comments: false +// @removeComments: true +/*!========= + Keep this pinned comment + ========= +*/ /* unpinned comment */ -/*! pinned comment */ +/*! pinned comment that need to be removed */ class C { } \ No newline at end of file diff --git a/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts b/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts index 1150cf963bf..70369c47895 100644 --- a/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts +++ b/tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts @@ -36,7 +36,7 @@ export module SpecializedWidget { // @Filename:privacyCannotNameAccessorDeclFile_exporter.ts /// -import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } // @Filename:privacyCannotNameAccessorDeclFile_consumer.ts -import exporter = require("privacyCannotNameAccessorDeclFile_exporter"); +import exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); export class publicClassWithWithPrivateGetAccessorTypes { static get myPublicStaticMethod() { // Error return exporter.createExportedWidget1(); diff --git a/tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts b/tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts index e49d31946c6..1135e3c86f4 100644 --- a/tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts +++ b/tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts @@ -36,7 +36,7 @@ export module SpecializedWidget { // @Filename:privacyCannotNameVarTypeDeclFile_exporter.ts /// -import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets"); +import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } // @Filename:privacyCannotNameVarTypeDeclFile_consumer.ts -import exporter = require("privacyCannotNameVarTypeDeclFile_exporter"); +import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); export class publicClassWithWithPrivatePropertyTypes { static myPublicStaticProperty = exporter.createExportedWidget1(); // Error private static myPrivateStaticProperty = exporter.createExportedWidget1(); diff --git a/tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass.ts b/tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass.ts index b412622ad40..a214104fafb 100644 --- a/tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass.ts +++ b/tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass.ts @@ -1,5 +1,5 @@ -//@module: commonjs -//@declaration: true +// @module: commonjs +// @declaration: true // @Filename: privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts export = Foo; class Foo { @@ -7,7 +7,7 @@ class Foo { } // @Filename: privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts -import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); +import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); export = Bar; interface Bar { foo: Foo; diff --git a/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts b/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts index f24ed8ea32b..dd5eaf82bdf 100644 --- a/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts +++ b/tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts @@ -36,7 +36,7 @@ export module SpecializedWidget { // @Filename:privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts /// -import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } // @Filename:privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts -import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter"); +import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error } diff --git a/tests/cases/compiler/privacyFunctionCannotNameReturnTypeDeclFile.ts b/tests/cases/compiler/privacyFunctionCannotNameReturnTypeDeclFile.ts index 2eff22327b5..cb1993286a4 100644 --- a/tests/cases/compiler/privacyFunctionCannotNameReturnTypeDeclFile.ts +++ b/tests/cases/compiler/privacyFunctionCannotNameReturnTypeDeclFile.ts @@ -36,7 +36,7 @@ export module SpecializedWidget { // @Filename:privacyFunctionReturnTypeDeclFile_exporter.ts /// -import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets"); +import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); import Widgets1 = require("GlobalWidgets"); export function createExportedWidget1() { return Widgets.createWidget1(); @@ -52,7 +52,7 @@ export function createExportedWidget4() { } // @Filename:privacyFunctionReturnTypeDeclFile_consumer.ts -import exporter = require("privacyFunctionReturnTypeDeclFile_exporter"); +import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); export class publicClassWithWithPrivateParmeterTypes { static myPublicStaticMethod() { // Error return exporter.createExportedWidget1(); diff --git a/tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport.ts b/tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport.ts index 16c6e19fb59..1ea30d1f3c4 100644 --- a/tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport.ts +++ b/tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport.ts @@ -1,5 +1,5 @@ -//@module: commonjs -//@declaration: true +// @module: commonjs +// @declaration: true // @Filename: privacyTopLevelAmbientExternalModuleImportWithExport_require.ts // Public elements export class c_public { @@ -32,8 +32,8 @@ declare module 'm2' { /// /// // Privacy errors - importing private elements -export import im_public_mi_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require"); -export import im_public_mu_private = require("privacyTopLevelAmbientExternalModuleImportWithExport_require1"); +export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require"); +export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1"); export import im_public_mi_public = require("m"); export import im_public_mu_public = require("m2"); diff --git a/tests/cases/compiler/requireOfAnEmptyFile1.ts b/tests/cases/compiler/requireOfAnEmptyFile1.ts index 365817f1339..98d5003ad67 100644 --- a/tests/cases/compiler/requireOfAnEmptyFile1.ts +++ b/tests/cases/compiler/requireOfAnEmptyFile1.ts @@ -1,7 +1,7 @@ -//@module: commonjs +// @module: commonjs //requireOfAnEmptyFile1 // @Filename: requireOfAnEmptyFile1_a.ts -import fs = require('requireOfAnEmptyFile1_b'); +import fs = require('./requireOfAnEmptyFile1_b'); // @Filename: requireOfAnEmptyFile1_b.ts diff --git a/tests/cases/compiler/reuseInnerModuleMember.ts b/tests/cases/compiler/reuseInnerModuleMember.ts index ebffcad6060..e2f9900e73f 100644 --- a/tests/cases/compiler/reuseInnerModuleMember.ts +++ b/tests/cases/compiler/reuseInnerModuleMember.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: reuseInnerModuleMember_0.ts export module M { } @@ -8,7 +8,7 @@ declare module bar { interface alpha { } } -import f = require('reuseInnerModuleMember_0'); +import f = require('./reuseInnerModuleMember_0'); module bar { var x: alpha; } diff --git a/tests/cases/compiler/sourceMap-FileWithComments.ts b/tests/cases/compiler/sourceMap-FileWithComments.ts index a3e5930d7c1..5dcf602c3de 100644 --- a/tests/cases/compiler/sourceMap-FileWithComments.ts +++ b/tests/cases/compiler/sourceMap-FileWithComments.ts @@ -1,5 +1,5 @@ // @sourcemap: true -// @comments: true +// @removeComments: false // Interface interface IPoint { diff --git a/tests/cases/compiler/staticInstanceResolution3.ts b/tests/cases/compiler/staticInstanceResolution3.ts index ae8cefc8102..bc4586b2adf 100644 --- a/tests/cases/compiler/staticInstanceResolution3.ts +++ b/tests/cases/compiler/staticInstanceResolution3.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: staticInstanceResolution3_0.ts export class Promise { static timeout(delay: number): Promise { @@ -8,5 +8,5 @@ export class Promise { // @Filename: staticInstanceResolution3_1.ts /// -import WinJS = require('staticInstanceResolution3_0'); +import WinJS = require('./staticInstanceResolution3_0'); WinJS.Promise.timeout(10); \ No newline at end of file diff --git a/tests/cases/compiler/systemModule17.ts b/tests/cases/compiler/systemModule17.ts new file mode 100644 index 00000000000..f6b6d6ea2f2 --- /dev/null +++ b/tests/cases/compiler/systemModule17.ts @@ -0,0 +1,41 @@ +// @module: system + +// @filename: f1.ts + +export class A {} +export interface I {} + +// @filename: f2.ts + +var x = 1; +interface I { } + +namespace N { + export var x = 1; + export interface I { } +} + +import IX = N.x; +import II = N.I; +import { A, A as EA, I as EI } from "f1"; + +export {x}; +export {x as x1}; + +export {I}; +export {I as I1}; + +export {A}; +export {A as A1}; + +export {EA}; +export {EA as EA1}; + +export {EI }; +export {EI as EI1}; + +export {IX}; +export {IX as IX1}; + +export {II}; +export {II as II1}; \ No newline at end of file diff --git a/tests/cases/compiler/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.ts b/tests/cases/compiler/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.ts index 28a9e821131..70be28f74eb 100644 --- a/tests/cases/compiler/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.ts +++ b/tests/cases/compiler/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @declaration: true // @Filename: file1.ts export function foo() { @@ -7,5 +7,5 @@ var classes = undefined; } // @Filename: file2.ts -import f = require('file1'); +import f = require('./file1'); f.foo(); diff --git a/tests/cases/compiler/typeofAmbientExternalModules.ts b/tests/cases/compiler/typeofAmbientExternalModules.ts index df3283bfb45..b6b8237dac6 100644 --- a/tests/cases/compiler/typeofAmbientExternalModules.ts +++ b/tests/cases/compiler/typeofAmbientExternalModules.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: typeofAmbientExternalModules_0.ts export class C { foo: string; } @@ -9,8 +9,8 @@ export = D; // @Filename: typeofAmbientExternalModules_2.ts /// /// -import ext = require('typeofAmbientExternalModules_0'); -import exp = require('typeofAmbientExternalModules_1'); +import ext = require('./typeofAmbientExternalModules_0'); +import exp = require('./typeofAmbientExternalModules_1'); var y1: typeof ext = ext; y1 = exp; diff --git a/tests/cases/compiler/typeofExternalModules.ts b/tests/cases/compiler/typeofExternalModules.ts index fe3dfad5d86..32475215e24 100644 --- a/tests/cases/compiler/typeofExternalModules.ts +++ b/tests/cases/compiler/typeofExternalModules.ts @@ -1,4 +1,4 @@ -//@module: commonjs +// @module: commonjs // @Filename: typeofExternalModules_external.ts export class C { } @@ -7,8 +7,8 @@ class D { } export = D; // @Filename: typeofExternalModules_core.ts -import ext = require('typeofExternalModules_external'); -import exp = require('typeofExternalModules_exportAssign'); +import ext = require('./typeofExternalModules_external'); +import exp = require('./typeofExternalModules_exportAssign'); var y1: typeof ext = ext; y1 = exp; diff --git a/tests/cases/compiler/unusedImportDeclaration.ts b/tests/cases/compiler/unusedImportDeclaration.ts index 263b355f69c..71fe5aae5a3 100644 --- a/tests/cases/compiler/unusedImportDeclaration.ts +++ b/tests/cases/compiler/unusedImportDeclaration.ts @@ -1,5 +1,5 @@ -//@module: commonjs -//@declaration: true +// @module: commonjs +// @declaration: true // @Filename: unusedImportDeclaration_testerB.ts class TesterB { me: string; @@ -7,7 +7,7 @@ class TesterB { export = TesterB; // @Filename: unusedImportDeclaration_testerA.ts -import B = require("unusedImportDeclaration_testerB"); +import B = require("./unusedImportDeclaration_testerB"); var thingy: B = { me: "A" }; diff --git a/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts b/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts index ff9610a2f65..ee22e3a4172 100644 --- a/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts +++ b/tests/cases/compiler/visibilityOfCrossModuleTypeUsage.ts @@ -1,9 +1,9 @@ -//@module: commonjs +// @module: commonjs //visibilityOfCrossModuleTypeUsage // @Filename: visibilityOfCrossModuleTypeUsage_commands.ts -import fs = require('visibilityOfCrossModuleTypeUsage_fs'); -import server = require('visibilityOfCrossModuleTypeUsage_server'); +import fs = require('./visibilityOfCrossModuleTypeUsage_fs'); +import server = require('./visibilityOfCrossModuleTypeUsage_server'); export interface IConfiguration { workspace: server.IWorkspace; @@ -19,7 +19,7 @@ export interface IWorkspace { } // @Filename: visibilityOfCrossModuleTypeUsage_fs.ts -import commands = require('visibilityOfCrossModuleTypeUsage_commands'); +import commands = require('./visibilityOfCrossModuleTypeUsage_commands'); function run(configuration: commands.IConfiguration) { var absoluteWorkspacePath = configuration.workspace.toAbsolutePath(configuration.server); } \ No newline at end of file diff --git a/tests/cases/compiler/voidAsNonAmbiguousReturnType.ts b/tests/cases/compiler/voidAsNonAmbiguousReturnType.ts index d20f9941fbf..c00ef99e1aa 100644 --- a/tests/cases/compiler/voidAsNonAmbiguousReturnType.ts +++ b/tests/cases/compiler/voidAsNonAmbiguousReturnType.ts @@ -1,11 +1,11 @@ -//@module: commonjs +// @module: commonjs // @Filename: voidAsNonAmbiguousReturnType_0.ts export function mkdirSync(path: string, mode?: number): void; export function mkdirSync(path: string, mode?: string): void {} // @Filename: voidAsNonAmbiguousReturnType_1.ts /// -import fs = require("voidAsNonAmbiguousReturnType_0"); +import fs = require("./voidAsNonAmbiguousReturnType_0"); function main() { fs.mkdirSync('test'); // should not error - return types are the same diff --git a/tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts b/tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts index 2202a482f8b..69b7462cd03 100644 --- a/tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts +++ b/tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts @@ -2,8 +2,8 @@ function f0() { var [] = [1, "hello"]; var [x] = [1, "hello"]; var [x, y] = [1, "hello"]; - var [x, y, z] = [1, "hello"]; // Error - var [,, z] = [0, 1, 2]; + var [x, y, z] = [1, "hello"]; + var [,, x] = [0, 1, 2]; var x: number; var y: string; } @@ -19,14 +19,14 @@ function f1() { } function f2() { - var { } = { x: 5, y: "hello" }; - var { x } = { x: 5, y: "hello" }; - var { y } = { x: 5, y: "hello" }; + var { } = { x: 5, y: "hello" }; // Error, no x and y in target + var { x } = { x: 5, y: "hello" }; // Error, no y in target + var { y } = { x: 5, y: "hello" }; // Error, no x in target var { x, y } = { x: 5, y: "hello" }; var x: number; var y: string; - var { x: a } = { x: 5, y: "hello" }; - var { y: b } = { x: 5, y: "hello" }; + var { x: a } = { x: 5, y: "hello" }; // Error, no y in target + var { y: b } = { x: 5, y: "hello" }; // Error, no x in target var { x: a, y: b } = { x: 5, y: "hello" }; var a: number; var b: string; diff --git a/tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts b/tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts new file mode 100644 index 00000000000..17de6dd2858 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts @@ -0,0 +1,65 @@ +// (arg: { x: any, y: any }) => void +function f1({ x, y }) { } +f1({ x: 1, y: 1 }); + +// (arg: { x: any, y?: number }) => void +function f2({ x, y = 0 }) { } +f2({ x: 1 }); +f2({ x: 1, y: 1 }); + +// (arg: { x?: number, y?: number }) => void +function f3({ x = 0, y = 0 }) { } +f3({}); +f3({ x: 1 }); +f3({ y: 1 }); +f3({ x: 1, y: 1 }); + +// (arg?: { x: number, y: number }) => void +function f4({ x, y } = { x: 0, y: 0 }) { } +f4(); +f4({ x: 1, y: 1 }); + +// (arg?: { x: number, y?: number }) => void +function f5({ x, y = 0 } = { x: 0 }) { } +f5(); +f5({ x: 1 }); +f5({ x: 1, y: 1 }); + +// (arg?: { x?: number, y?: number }) => void +function f6({ x = 0, y = 0 } = {}) { } +f6(); +f6({}); +f6({ x: 1 }); +f6({ y: 1 }); +f6({ x: 1, y: 1 }); + +// (arg?: { a: { x?: number, y?: number } }) => void +function f7({ a: { x = 0, y = 0 } } = { a: {} }) { } +f7(); +f7({ a: {} }); +f7({ a: { x: 1 } }); +f7({ a: { y: 1 } }); +f7({ a: { x: 1, y: 1 } }); + +// (arg: [any, any]) => void +function g1([x, y]) { } +g1([1, 1]); + +// (arg: [number, number]) => void +function g2([x = 0, y = 0]) { } +g2([1, 1]); + +// (arg?: [number, number]) => void +function g3([x, y] = [0, 0]) { } +g3(); +g3([1, 1]); + +// (arg?: [number, number]) => void +function g4([x, y = 0] = [0]) { } +g4(); +g4([1, 1]); + +// (arg?: [number, number]) => void +function g5([x = 0, y = 0] = []) { } +g5(); +g5([1, 1]); diff --git a/tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts b/tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts new file mode 100644 index 00000000000..ef91b8249da --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts @@ -0,0 +1,33 @@ +// Missing properties +function f1() { + var { x, y } = {}; + var { x = 1, y } = {}; + var { x, y = 1 } = {}; + var { x = 1, y = 1 } = {}; +} + +// Missing properties +function f2() { + var x: number, y: number; + ({ x, y } = {}); + ({ x: x = 1, y } = {}); + ({ x, y: y = 1 } = {}); + ({ x: x = 1, y: y = 1 } = {}); +} + +// Excess properties +function f3() { + var { } = { x: 0, y: 0 }; + var { x } = { x: 0, y: 0 }; + var { y } = { x: 0, y: 0 }; + var { x, y } = { x: 0, y: 0 }; +} + +// Excess properties +function f4() { + var x: number, y: number; + ({ } = { x: 0, y: 0 }); + ({ x } = { x: 0, y: 0 }); + ({ y } = { x: 0, y: 0 }); + ({ x, y } = { x: 0, y: 0 }); +} diff --git a/tests/cases/conformance/es6/modules/multipleDefaultExports01.ts b/tests/cases/conformance/es6/modules/multipleDefaultExports01.ts index 84172248e93..e6a467820b4 100644 --- a/tests/cases/conformance/es6/modules/multipleDefaultExports01.ts +++ b/tests/cases/conformance/es6/modules/multipleDefaultExports01.ts @@ -14,6 +14,6 @@ var x = 10; export default x; // @filename: m2.ts -import Entity from "m1" +import Entity from "./m1" Entity(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/modules/multipleDefaultExports02.ts b/tests/cases/conformance/es6/modules/multipleDefaultExports02.ts index 1e9c8dabc13..d642b72b6f3 100644 --- a/tests/cases/conformance/es6/modules/multipleDefaultExports02.ts +++ b/tests/cases/conformance/es6/modules/multipleDefaultExports02.ts @@ -11,6 +11,6 @@ export default function bar() { } // @filename: m2.ts -import Entity from "m1" +import Entity from "./m1" Entity(); \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/topLevelFileModule.ts b/tests/cases/conformance/externalModules/topLevelFileModule.ts index 7f694f6f98d..e6680889d26 100644 --- a/tests/cases/conformance/externalModules/topLevelFileModule.ts +++ b/tests/cases/conformance/externalModules/topLevelFileModule.ts @@ -6,6 +6,6 @@ export var x: number; export declare var y: number; // @Filename: foo_1.ts -import foo = require("vs/foo_0"); -import fum = require("vs/fum"); +import foo = require("./vs/foo_0"); +import fum = require("./vs/fum"); var z = foo.x + fum.y; diff --git a/tests/cases/conformance/externalModules/topLevelModuleDeclarationAndFile.ts b/tests/cases/conformance/externalModules/topLevelModuleDeclarationAndFile.ts index db0e2ce742c..456527acfae 100644 --- a/tests/cases/conformance/externalModules/topLevelModuleDeclarationAndFile.ts +++ b/tests/cases/conformance/externalModules/topLevelModuleDeclarationAndFile.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @Filename: vs/foo_0.ts +// @Filename: vs/foo_0/index.ts export var x: number = 42; // @Filename: foo_1.ts diff --git a/tests/cases/fourslash/formatClassExpression.ts b/tests/cases/fourslash/formatClassExpression.ts new file mode 100644 index 00000000000..0a00203e77f --- /dev/null +++ b/tests/cases/fourslash/formatClassExpression.ts @@ -0,0 +1,23 @@ +/// + +////class Thing extends ( +//// class/*classOpenBrace*/ +//// { +/////*classIndent*/ +//// protected doThing() {/*methodAutoformat*/ +/////*methodIndent*/ +//// } +//// } +////) { +////} + +format.document(); + +goTo.marker("classOpenBrace"); +verify.currentLineContentIs(" class {"); +goTo.marker("classIndent"); +verify.indentationIs(8); +goTo.marker("methodAutoformat"); +verify.currentLineContentIs(" protected doThing() {"); +goTo.marker("methodIndent"); +verify.indentationIs(12); \ No newline at end of file diff --git a/tests/cases/fourslash/formatComments.ts b/tests/cases/fourslash/formatComments.ts new file mode 100644 index 00000000000..083ba6c078d --- /dev/null +++ b/tests/cases/fourslash/formatComments.ts @@ -0,0 +1,24 @@ +/// + +////_.chain() +////// wow/*callChain1*/ +//// .then() +////// waa/*callChain2*/ +//// .then(); +////wow( +//// 3, +////// uaa/*argument1*/ +//// 4 +////// wua/*argument2*/ +////); + +format.document(); + +goTo.marker("callChain1"); +verify.currentLineContentIs(" // wow"); +goTo.marker("callChain2"); +verify.currentLineContentIs(" // waa"); +goTo.marker("argument1"); +verify.currentLineContentIs(" // uaa"); +goTo.marker("argument2"); +verify.currentLineContentIs(" // wua"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatTypeOperation.ts b/tests/cases/fourslash/formatTypeOperation.ts new file mode 100644 index 00000000000..956508f7290 --- /dev/null +++ b/tests/cases/fourslash/formatTypeOperation.ts @@ -0,0 +1,26 @@ +/// + +////type Union = number | {}/*formatBarOperator*/ +/////*indent*/ +////|string/*autoformat*/ +////type Intersection = Foo & Bar;/*formatAmpersandOperator*/ +////type Complexed = +//// Foo& +//// Bar|/*unionTypeNoIndent*/ +//// Baz;/*intersectionTypeNoIndent*/ + +format.document(); + +goTo.marker("formatBarOperator"); +verify.currentLineContentIs("type Union = number | {}"); +goTo.marker("indent"); +verify.indentationIs(4); +goTo.marker("autoformat"); +verify.currentLineContentIs(" | string"); +goTo.marker("formatAmpersandOperator"); +verify.currentLineContentIs("type Intersection = Foo & Bar;"); + +goTo.marker("unionTypeNoIndent"); +verify.currentLineContentIs(" Bar |"); +goTo.marker("intersectionTypeNoIndent"); +verify.currentLineContentIs(" Baz;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatTypeUnion.ts b/tests/cases/fourslash/formatTypeUnion.ts deleted file mode 100644 index 267ba656612..00000000000 --- a/tests/cases/fourslash/formatTypeUnion.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -////type Union = number | {}/*formatOperator*/ -/////*indent*/ -////|string/*autoformat*/ - -format.document(); - -goTo.marker("formatOperator"); -verify.currentLineContentIs("type Union = number | {}"); -goTo.marker("indent"); -verify.indentationIs(4); -goTo.marker("autoformat"); -verify.currentLineContentIs(" | string"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingJsxElements.ts b/tests/cases/fourslash/formattingJsxElements.ts index d0c77804ed5..fd4ccc504a4 100644 --- a/tests/cases/fourslash/formattingJsxElements.ts +++ b/tests/cases/fourslash/formattingJsxElements.ts @@ -1,7 +1,7 @@ /// //@Filename: file.tsx -////function () { +////function foo0() { //// return ( ////
////Hello, World!/*autoformat*/ @@ -10,10 +10,76 @@ //// ) ////} //// +////function foo1() { +//// return ( +////
+////Hello, World!/*autoformat1*/ +/////*indent1*/ +////
+//// ) +////} +//// +////function foo2() { +//// return ( +////
/*2*/ +////Hello, World!/*autoformat2*/ +/////*indent2*/ +////
+//// ) +////} +////function foo3() { +//// return ( +//// /*4*/ +//// Hello, World!/*autoformat3*/ +//// /*indent3*/ +//// +//// ) +////} +////function foo4() { +//// return ( +//// /*6*/ +//// ) +////} format.document(); goTo.marker("autoformat"); verify.currentLineContentIs(' Hello, World!'); goTo.marker("indent"); -verify.indentationIs(12); \ No newline at end of file +verify.indentationIs(12); + +goTo.marker("autoformat1"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent1"); +verify.indentationIs(12); + +goTo.marker("1"); +verify.currentLineContentIs(' class1= {'); +goTo.marker("2"); +verify.currentLineContentIs(' }>'); + +goTo.marker("autoformat2"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent2"); +verify.indentationIs(12); + +goTo.marker("3"); +verify.currentLineContentIs(' class2= {'); +goTo.marker("4"); +verify.currentLineContentIs(' }>'); + +goTo.marker("autoformat3"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent3"); +verify.indentationIs(12); + +goTo.marker("5"); +verify.currentLineContentIs(' class3= {'); +goTo.marker("6"); +verify.currentLineContentIs(' }/>'); diff --git a/tests/cases/fourslash/indentationInJsx1.ts b/tests/cases/fourslash/indentationInJsx1.ts new file mode 100644 index 00000000000..5343c7a7c10 --- /dev/null +++ b/tests/cases/fourslash/indentationInJsx1.ts @@ -0,0 +1,17 @@ +/// + +//@Filename: file.tsx +////(function () { +//// return ( +////
+////
+////
+//// /*indent2*/ +////
+//// ) +////}) + + +format.document(); +goTo.marker("indent2"); +verify.indentationIs(12); \ No newline at end of file diff --git a/tests/cases/fourslash/indentationInJsx2.ts b/tests/cases/fourslash/indentationInJsx2.ts new file mode 100644 index 00000000000..f23a14f68cc --- /dev/null +++ b/tests/cases/fourslash/indentationInJsx2.ts @@ -0,0 +1,7 @@ +/// + +//@Filename: file.tsx +////
/*1*/ +goTo.marker("1"); +edit.insert("\n"); +verify.indentationIs(0); diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 0917e72f1ce..ed9f0b0a986 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -40,8 +40,9 @@ module ts { let containingFile = { name: containingFileName } let moduleFile = { name: moduleFileNameNoExt + ext } let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); + let failedLookupLocations: string[] = []; let dir = getDirectoryPath(containingFileName); for (let e of supportedExtensions) { @@ -78,7 +79,8 @@ module ts { let packageJson = { name: packageJsonFileName, content: JSON.stringify({ "typings": fieldRef }) }; let moduleFile = { name: moduleFileName }; let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); // expect three failed lookup location - attempt to load module as file with all supported extensions assert.equal(resolution.failedLookupLocations.length, 3); } @@ -95,7 +97,8 @@ module ts { let packageJson = {name: "/a/b/foo/package.json", content: JSON.stringify({main: "/c/d"})}; let indexFile = { name: "/a/b/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("./foo", containingFile.name, createModuleResolutionHost(containingFile, packageJson, indexFile)); - assert.equal(resolution.resolvedFileName, indexFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, indexFile.name); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); assert.deepEqual(resolution.failedLookupLocations, [ "/a/b/foo.ts", "/a/b/foo.tsx", @@ -111,7 +114,7 @@ module ts { let containingFile = { name: "/a/b/c/d/e.ts" }; let moduleFile = { name: "/a/b/node_modules/foo.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, undefined); + assert.equal(resolution.resolvedModule, undefined); assert.deepEqual(resolution.failedLookupLocations, [ "/a/b/c/d/node_modules/foo.d.ts", "/a/b/c/d/node_modules/foo/package.json", @@ -135,14 +138,16 @@ module ts { let containingFile = { name: "/a/b/c/d/e.ts" }; let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); }); it("load module as directory", () => { let containingFile = { name: "/a/node_modules/b/c/node_modules/d/e.ts" }; let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); assert.deepEqual(resolution.failedLookupLocations, [ "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", @@ -158,64 +163,4 @@ module ts { ]); }); }); - - describe("BaseUrl mode", () => { - - it ("load module as relative url", () => { - function test(containingFileName: string, moduleFileName: string, moduleName: string): void { - let containingFile = {name: containingFileName }; - let moduleFile = { name: moduleFileName }; - let resolution = baseUrlModuleNameResolver(moduleName, containingFile.name, "", createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - let expectedFailedLookupLocations: string[] = []; - - let moduleNameHasExt = forEach(supportedExtensions, e => fileExtensionIs(moduleName, e)); - if (!moduleNameHasExt) { - let dir = getDirectoryPath(containingFileName); - - // add candidates with extensions that precede extension of the actual module name file in the list of supportd extensions - for (let ext of supportedExtensions) { - - let hasExtension = ext !== ".ts" - ? fileExtensionIs(moduleFileName, ext) - : fileExtensionIs(moduleFileName, ".ts") && !fileExtensionIs(moduleFileName, ".d.ts"); - - if (hasExtension) { - break; - } - else { - expectedFailedLookupLocations.push(normalizePath(combinePaths(dir, moduleName + ext))); - } - } - } - - assert.deepEqual(resolution.failedLookupLocations, expectedFailedLookupLocations) - } - - test("/a/b/c/d.ts", "/foo.ts", "/foo"); - test("/a/b/c/d.ts", "/foo.d.ts", "/foo"); - test("/a/b/c/d.ts", "/foo.tsx", "/foo"); - - test("/a/b/c/d.ts", "/a/b/c/foo.ts", "./foo"); - test("/a/b/c/d.ts", "/a/b/c/foo.d.ts", "./foo"); - test("/a/b/c/d.ts", "/a/b/c/foo.tsx", "./foo"); - - test("/a/b/c/d.ts", "/a/b/foo.ts", "../foo"); - test("/a/b/c/d.ts", "/a/b/foo.d.ts", "../foo"); - test("/a/b/c/d.ts", "/a/b/foo.tsx", "../foo"); - }); - - it ("load module using base url", () => { - function test(containingFileName: string, moduleFileName: string, moduleName: string, baseUrl: string): void { - let containingFile = { name: containingFileName }; - let moduleFile = { name: moduleFileName }; - let resolution = baseUrlModuleNameResolver(moduleName, containingFileName, baseUrl, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - } - - test("/a/base/c/d.ts", "/a/base/c/d/e.ts", "c/d/e", "/a/base"); - test("/a/base/c/d.ts", "/a/base/c/d/e.d.ts", "c/d/e", "/a/base"); - test("/a/base/c/d.ts", "/a/base/c/d/e.tsx", "c/d/e", "/a/base"); - }); - }); } \ No newline at end of file diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 6c043299c8f..5f313eeae2b 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -160,7 +160,7 @@ module ts { return size; } - function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { let file = program.getSourceFile(fileName); assert.isTrue(file !== undefined, `cannot find file ${fileName}`); if (expectedContent === undefined) { @@ -175,7 +175,16 @@ module ts { for (let id in expectedContent) { if (hasProperty(expectedContent, id)) { assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`); - assert.isTrue(expectedContent[id] === file.resolvedModules[id], `expected '${expectedContent[id]}' to be equal to '${file.resolvedModules[id]}'`); + if (expectedContent[id]) { + const expected = expectedContent[id]; + const actual = file.resolvedModules[id]; + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'shouldBeProperExternalModule': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); + } + else { + assert.isTrue(file.resolvedModules[id] === undefined); + } } } } @@ -184,7 +193,11 @@ module ts { describe("Reuse program structure", () => { let target = ScriptTarget.Latest; let files = [ - { name: "a.ts", text: SourceText.New(`/// `, "", `var x = 1`) }, + { name: "a.ts", text: SourceText.New( + ` +/// +/// +`, "",`var x = 1`) }, { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, ] @@ -195,6 +208,9 @@ module ts { files[0].text = files[0].text.updateProgram("var x = 100"); }); assert.isTrue(program_1.structureIsReused); + let program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + let program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + assert.equal(program1Diagnostics.length, program2Diagnostics.length); }); it("fails if change affects tripleslash references", () => { @@ -230,7 +246,7 @@ module ts { var options: CompilerOptions = { target }; var program_1 = newProgram(files, ["a.ts"], options); - checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "a.ts", { "b": { resolvedFileName: "b.ts" } }); checkResolvedModulesCache(program_1, "b.ts", undefined); var program_2 = updateProgram(program_1, ["a.ts"], options, files => { @@ -239,7 +255,7 @@ module ts { assert.isTrue(program_1.structureIsReused); // content of resolution cache should not change - checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "a.ts", { "b": { resolvedFileName: "b.ts" } }); checkResolvedModulesCache(program_1, "b.ts", undefined); // imports has changed - program is not reused @@ -256,7 +272,7 @@ module ts { files[0].text = files[0].text.updateImportsAndExports(newImports); }); assert.isTrue(!program_3.structureIsReused); - checkResolvedModulesCache(program_4, "a.ts", { "b": "b.ts", "c": undefined }); + checkResolvedModulesCache(program_4, "a.ts", { "b": { resolvedFileName: "b.ts" }, "c": undefined }); }); }) } \ No newline at end of file diff --git a/tests/cases/unittests/transpile.ts b/tests/cases/unittests/transpile.ts index 0b87910d26e..9336c323bb4 100644 --- a/tests/cases/unittests/transpile.ts +++ b/tests/cases/unittests/transpile.ts @@ -64,8 +64,8 @@ module ts { let transpileModuleResultWithSourceMap = transpileModule(input, transpileOptions); assert.isTrue(transpileModuleResultWithSourceMap.sourceMapText !== undefined); - let expectedSourceMapFileName = removeFileExtension(transpileOptions.fileName) + ".js.map"; - let expectedSourceMappingUrlLine = `//# sourceMappingURL=${expectedSourceMapFileName}`; + let expectedSourceMapFileName = removeFileExtension(getBaseFileName(normalizeSlashes(transpileOptions.fileName))) + ".js.map"; + let expectedSourceMappingUrlLine = `//# sourceMappingURL=${expectedSourceMapFileName}`; if (testSettings.expectedOutput !== undefined) { assert.equal(transpileModuleResultWithSourceMap.outputText, testSettings.expectedOutput + expectedSourceMappingUrlLine); @@ -270,5 +270,9 @@ var x = 0;`, expectedOutput: output }); }); + + it("Supports backslashes in file name", () => { + test("var x", { expectedOutput: "var x;\r\n", options: { fileName: "a\\b.ts" }}); + }); }); }