diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68d88854849..3a712b5619a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,11 +36,13 @@ Your pull request should: The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib) -To build the library files, run +Library files in `built/local/` are updated by running ```Shell -jake lib +jake ``` +The files in `lib/` are used to bootstrap compilation and usually do not need to be updated. + #### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator diff --git a/Jakefile.js b/Jakefile.js index a3f1d31f268..58677e19a75 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -113,7 +113,8 @@ var scriptSources = [ "tslint/nextLineRule.ts", "tslint/noNullRule.ts", "tslint/preferConstRule.ts", - "tslint/typeOperatorSpacingRule.ts" + "tslint/typeOperatorSpacingRule.ts", + "tslint/noInOperatorRule.ts" ].map(function (f) { return path.join(scriptsDirectory, f); }); @@ -876,7 +877,8 @@ var tslintRules = ([ "noNullRule", "preferConstRule", "booleanTriviaRule", - "typeOperatorSpacingRule" + "typeOperatorSpacingRule", + "noInOperatorRule" ]); var tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); @@ -927,13 +929,17 @@ var lintTargets = compilerSources desc("Runs tslint on the compiler sources"); task("lint", ["build-rules"], function() { var lintOptions = getLinterOptions(); + var failed = 0; for (var i in lintTargets) { var result = lintFile(lintOptions, lintTargets[i]); if (result.failureCount > 0) { console.log(result.output); - fail('Linter errors.', result.failureCount); + failed += result.failureCount; } } + if (failed > 0) { + fail('Linter errors.', failed); + } }); /** diff --git a/doc/TypeScript Language Specification (Change Markup).docx b/doc/TypeScript Language Specification (Change Markup).docx index 893f2e7ed22..24e7d1b623a 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).docx and b/doc/TypeScript Language Specification (Change Markup).docx differ diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 4aaa3bf92fe..4eb94908b57 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/spec.md b/doc/spec.md index fe2147be477..a7947b19926 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -1323,7 +1323,7 @@ x = "hello"; // Ok x = 42; // Ok x = test; // Error, boolean not assignable x = test ? 5 : "five"; // Ok -x = test ? 0 : false; // Error, number | boolean not asssignable +x = test ? 0 : false; // Error, number | boolean not assignable ``` it is possible to assign 'x' a value of type `string`, `number`, or the union type `string | number`, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either `string` or `number`: diff --git a/lib/README.md b/lib/README.md index b2837989505..583ddf91156 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1,4 +1,4 @@ # Read this! These files are not meant to be edited by hand. -If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. \ No newline at end of file +If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory. diff --git a/scripts/tslint/noInOperatorRule.ts b/scripts/tslint/noInOperatorRule.ts new file mode 100644 index 00000000000..527e8c1b895 --- /dev/null +++ b/scripts/tslint/noInOperatorRule.ts @@ -0,0 +1,20 @@ +import * as Lint from "tslint/lib/lint"; +import * as ts from "typescript"; + + +export class Rule extends Lint.Rules.AbstractRule { + public static FAILURE_STRING = "Don't use the 'in' keyword - use 'hasProperty' to check for key presence instead"; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + return this.applyWithWalker(new InWalker(sourceFile, this.getOptions())); + } +} + +class InWalker extends Lint.RuleWalker { + visitNode(node: ts.Node) { + super.visitNode(node); + if (node.kind === ts.SyntaxKind.InKeyword && node.parent && node.parent.kind === ts.SyntaxKind.BinaryExpression) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + } +} diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e737cd58bd5..30d4818592b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -51,6 +51,7 @@ namespace ts { const emitResolver = createResolver(); const undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); + undefinedSymbol.declarations = []; const argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); const checker: TypeChecker = { @@ -234,6 +235,10 @@ namespace ts { ResolvedReturnType } + const builtinGlobals: SymbolTable = { + [undefinedSymbol.name]: undefinedSymbol + }; + initializeTypeChecker(); return checker; @@ -360,6 +365,24 @@ namespace ts { } } + function addToSymbolTable(target: SymbolTable, source: SymbolTable, message: DiagnosticMessage) { + for (const id in source) { + if (hasProperty(source, id)) { + if (hasProperty(target, id)) { + // Error on redeclarations + forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + } + else { + target[id] = source[id]; + } + } + } + + function addDeclarationDiagnostic(id: string, message: DiagnosticMessage) { + return (declaration: Declaration) => diagnostics.add(createDiagnosticForNode(declaration, message, id)); + } + } + function getSymbolLinks(symbol: Symbol): SymbolLinks { if (symbol.flags & SymbolFlags.Transient) return symbol; const id = getSymbolId(symbol); @@ -379,6 +402,14 @@ namespace ts { return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(node); } + /** Is this type one of the apparent types created from the primitive types. */ + function isPrimitiveApparentType(type: Type): boolean { + return type === globalStringType || + type === globalNumberType || + type === globalBooleanType || + type === globalESSymbolType; + } + function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol { if (meaning && hasProperty(symbols, name)) { const symbol = symbols[name]; @@ -1095,39 +1126,81 @@ namespace ts { return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function extendExportSymbols(target: SymbolTable, source: SymbolTable) { + interface ExportCollisionTracker { + specifierText: string; + exportsWithDuplicate: ExportDeclaration[]; + } + + /** + * Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument + * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables + */ + function extendExportSymbols(target: SymbolTable, source: SymbolTable, lookupTable?: Map, exportNode?: ExportDeclaration) { for (const id in source) { if (id !== "default" && !hasProperty(target, id)) { target[id] = source[id]; + if (lookupTable && exportNode) { + lookupTable[id] = { + specifierText: getTextOfNode(exportNode.moduleSpecifier) + } as ExportCollisionTracker; + } + } + else if (lookupTable && exportNode && id !== "default" && hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { + if (!lookupTable[id].exportsWithDuplicate) { + lookupTable[id].exportsWithDuplicate = [exportNode]; + } + else { + lookupTable[id].exportsWithDuplicate.push(exportNode); + } } } } function getExportsForModule(moduleSymbol: Symbol): SymbolTable { - let result: SymbolTable; const visitedSymbols: Symbol[] = []; - visit(moduleSymbol); - return result || moduleSymbol.exports; + return visit(moduleSymbol) || moduleSymbol.exports; // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example, // module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error. - function visit(symbol: Symbol) { - if (symbol && symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) { - visitedSymbols.push(symbol); - if (symbol !== moduleSymbol) { - if (!result) { - result = cloneSymbolTable(moduleSymbol.exports); - } - extendExportSymbols(result, symbol.exports); - } - // All export * declarations are collected in an __export symbol by the binder - const exportStars = symbol.exports["__export"]; - if (exportStars) { - for (const node of exportStars.declarations) { - visit(resolveExternalModuleName(node, (node).moduleSpecifier)); - } - } + function visit(symbol: Symbol): SymbolTable { + if (!(symbol && symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol))) { + return; } + visitedSymbols.push(symbol); + const symbols = cloneSymbolTable(symbol.exports); + // All export * declarations are collected in an __export symbol by the binder + const exportStars = symbol.exports["__export"]; + if (exportStars) { + const nestedSymbols: SymbolTable = {}; + const lookupTable: Map = {}; + for (const node of exportStars.declarations) { + const resolvedModule = resolveExternalModuleName(node, (node as ExportDeclaration).moduleSpecifier); + const exportedSymbols = visit(resolvedModule); + extendExportSymbols( + nestedSymbols, + exportedSymbols, + lookupTable, + node as ExportDeclaration + ); + } + for (const id in lookupTable) { + const { exportsWithDuplicate } = lookupTable[id]; + // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || hasProperty(symbols, id)) { + continue; + } + for (const node of exportsWithDuplicate) { + diagnostics.add(createDiagnosticForNode( + node, + Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, + lookupTable[id].specifierText, + id + )); + } + } + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; } } @@ -1521,9 +1594,9 @@ namespace ts { return result; } - function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { + function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string { const writer = getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); const result = writer.string(); releaseStringWriter(writer); @@ -1875,7 +1948,7 @@ namespace ts { if (flags & TypeFormatFlags.InElementType) { writePunctuation(writer, SyntaxKind.OpenParenToken); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack); + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack); if (flags & TypeFormatFlags.InElementType) { writePunctuation(writer, SyntaxKind.CloseParenToken); } @@ -1887,7 +1960,7 @@ namespace ts { } writeKeyword(writer, SyntaxKind.NewKeyword); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack); if (flags & TypeFormatFlags.InElementType) { writePunctuation(writer, SyntaxKind.CloseParenToken); } @@ -1901,15 +1974,12 @@ namespace ts { writer.writeLine(); writer.increaseIndent(); for (const signature of resolved.callSignatures) { - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } for (const signature of resolved.constructSignatures) { - writeKeyword(writer, SyntaxKind.NewKeyword); - writeSpace(writer); - - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, SignatureKind.Construct, symbolStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } @@ -1950,7 +2020,7 @@ namespace ts { if (p.flags & SymbolFlags.Optional) { writePunctuation(writer, SyntaxKind.QuestionToken); } - buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } @@ -2070,7 +2140,12 @@ namespace ts { buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } - function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, symbolStack?: Symbol[]) { + if (kind === SignatureKind.Construct) { + writeKeyword(writer, SyntaxKind.NewKeyword); + writeSpace(writer); + } + if (signature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature)) { // Instantiated signature, write type arguments instead // This is achieved by passing in the mapper separately @@ -2938,10 +3013,6 @@ namespace ts { return type.resolvedBaseConstructorType; } - function hasClassBaseType(type: InterfaceType): boolean { - return !!forEach(getBaseTypes(type), t => !!(t.symbol.flags & SymbolFlags.Class)); - } - function getBaseTypes(type: InterfaceType): ObjectType[] { const isClass = type.symbol.flags & SymbolFlags.Class; const isInterface = type.symbol.flags & SymbolFlags.Interface; @@ -3375,11 +3446,11 @@ namespace ts { } function getDefaultConstructSignatures(classType: InterfaceType): Signature[] { - if (!hasClassBaseType(classType)) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; - } const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); + if (baseSignatures.length === 0) { + return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); const typeArgCount = typeArguments ? typeArguments.length : 0; @@ -3597,7 +3668,7 @@ namespace ts { return type; } - // Return properties of an object type or an empty array for other types + /** Return properties of an object type or an empty array for other types */ function getPropertiesOfObjectType(type: Type): Symbol[] { if (type.flags & TypeFlags.ObjectType) { return resolveStructuredTypeMembers(type).properties; @@ -3605,8 +3676,8 @@ namespace ts { return emptyArray; } - // If the given type is an object type and that type has a property by the given name, - // return the symbol for that property.Otherwise return undefined. + /** If the given type is an object type and that type has a property by the given name, + * return the symbol for that property. Otherwise return undefined. */ function getPropertyOfObjectType(type: Type, name: string): Symbol { if (type.flags & TypeFlags.ObjectType) { const resolved = resolveStructuredTypeMembers(type); @@ -5073,9 +5144,6 @@ namespace ts { } return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); } - if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) { - return typeParameterIdenticalTo(source, target); - } if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union || source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { if (result = eachTypeRelatedToSomeType(source, target)) { @@ -5206,17 +5274,6 @@ namespace ts { return result; } - function typeParameterIdenticalTo(source: TypeParameter, target: TypeParameter): Ternary { - // covers case when both type parameters does not have constraint (both equal to noConstraintType) - if (source.constraint === target.constraint) { - return Ternary.True; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return Ternary.False; - } - return isIdenticalTo(source.constraint, target.constraint); - } - // Determine if two object types are related by structure. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are @@ -5442,20 +5499,26 @@ namespace ts { outer: for (const t of targetSignatures) { if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) { - let localErrors = reportErrors; - const checkedAbstractAssignability = false; + // Only elaborate errors from the first failure + let shouldElaborateErrors = reportErrors; for (const s of sourceSignatures) { if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) { - const related = signatureRelatedTo(s, t, localErrors); + const related = signatureRelatedTo(s, t, shouldElaborateErrors); if (related) { result &= related; errorInfo = saveErrorInfo; continue outer; } - // Only report errors from the first failure - localErrors = false; + shouldElaborateErrors = false; } } + // don't elaborate the primitive apparent types (like Number) + // because the actual primitives will have already been reported. + if (shouldElaborateErrors && !isPrimitiveApparentType(source)) { + reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, + typeToString(source), + signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind)); + } return Ternary.False; } } @@ -5765,26 +5828,19 @@ namespace ts { if (!(isMatchingSignature(source, target, partialMatch))) { return Ternary.False; } - let result = Ternary.True; - if (source.typeParameters && target.typeParameters) { - if (source.typeParameters.length !== target.typeParameters.length) { - return Ternary.False; - } - for (let i = 0, len = source.typeParameters.length; i < len; ++i) { - const related = compareTypes(source.typeParameters[i], target.typeParameters[i]); - if (!related) { - return Ternary.False; - } - result &= related; - } - } - else if (source.typeParameters || target.typeParameters) { + // Check that the two signatures have the same number of type parameters. We might consider + // also checking that any type parameter constraints match, but that would require instantiating + // the constraints with a common set of type arguments to get relatable entities in places where + // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, + // particularly as we're comparing erased versions of the signatures below. + if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { return Ternary.False; } // Spec 1.0 Section 3.8.3 & 3.8.4: // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); + let result = Ternary.True; const targetLen = target.parameters.length; for (let i = 0; i < targetLen; i++) { const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); @@ -6092,14 +6148,25 @@ namespace ts { function inferFromTypes(source: Type, target: Type) { if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union || source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { - // Source and target are both unions or both intersections. To improve the quality of - // inferences we first reduce the types by removing constituents that are identically - // matched by a constituent in the other type. For example, when inferring from - // 'string | string[]' to 'string | T', we reduce the types to 'string[]' and 'T'. - const reducedSource = reduceUnionOrIntersectionType(source, target); - const reducedTarget = reduceUnionOrIntersectionType(target, source); - source = reducedSource; - target = reducedTarget; + // Source and target are both unions or both intersections. First, find each + // target constituent type that has an identically matching source constituent + // type, and for each such target constituent type infer from the type to itself. + // When inferring from a type to itself we effectively find all type parameter + // occurrences within that type and infer themselves as their type arguments. + let matchingTypes: Type[]; + for (const t of (target).types) { + if (typeIdenticalToSomeType(t, (source).types)) { + (matchingTypes || (matchingTypes = [])).push(t); + inferFromTypes(t, t); + } + } + // Next, to improve the quality of inferences, reduce the source and target types by + // removing the identically matched constituents. For example, when inferring from + // 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'. + if (matchingTypes) { + source = removeTypesFromUnionOrIntersection(source, matchingTypes); + target = removeTypesFromUnionOrIntersection(target, matchingTypes); + } } if (target.flags & TypeFlags.TypeParameter) { // If target is a type parameter, make an inference, unless the source type contains @@ -6183,9 +6250,12 @@ namespace ts { } else { source = getApparentType(source); - if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) || - (target.flags & TypeFlags.Anonymous) && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) { - // If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members + if (source.flags & TypeFlags.ObjectType && ( + target.flags & TypeFlags.Reference && (target).typeArguments || + target.flags & TypeFlags.Tuple || + target.flags & TypeFlags.Anonymous && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class))) { + // If source is an object type, and target is a type reference with type arguments, a tuple type, + // the type of a method, or a type literal, infer from members if (isInProcess(source, target)) { return; } @@ -6258,9 +6328,9 @@ namespace ts { } } - function typeIdenticalToSomeType(source: Type, target: UnionOrIntersectionType): boolean { - for (const t of target.types) { - if (isTypeIdenticalTo(source, t)) { + function typeIdenticalToSomeType(type: Type, types: Type[]): boolean { + for (const t of types) { + if (isTypeIdenticalTo(t, type)) { return true; } } @@ -6268,29 +6338,17 @@ namespace ts { } /** - * Return the reduced form of the source type. This type is computed by by removing all source - * constituents that have an identical match in the target type. + * Return a new union or intersection type computed by removing a given set of types + * from a given union or intersection type. */ - function reduceUnionOrIntersectionType(source: UnionOrIntersectionType, target: UnionOrIntersectionType) { - let sourceTypes = source.types; - let sourceIndex = 0; - let modified = false; - while (sourceIndex < sourceTypes.length) { - if (typeIdenticalToSomeType(sourceTypes[sourceIndex], target)) { - if (!modified) { - sourceTypes = sourceTypes.slice(0); - modified = true; - } - sourceTypes.splice(sourceIndex, 1); - } - else { - sourceIndex++; + function removeTypesFromUnionOrIntersection(type: UnionOrIntersectionType, typesToRemove: Type[]) { + const reducedTypes: Type[] = []; + for (const t of type.types) { + if (!typeIdenticalToSomeType(t, typesToRemove)) { + reducedTypes.push(t); } } - if (modified) { - return source.flags & TypeFlags.Union ? getUnionType(sourceTypes, /*noSubtypeReduction*/ true) : getIntersectionType(sourceTypes); - } - return source; + return type.flags & TypeFlags.Union ? getUnionType(reducedTypes, /*noSubtypeReduction*/ true) : getIntersectionType(reducedTypes); } function getInferenceCandidates(context: InferenceContext, index: number): Type[] { @@ -14134,8 +14192,29 @@ namespace ts { const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } + // Checks for export * conflicts + const exports = getExportsOfModule(moduleSymbol); + for (const id in exports) { + if (id === "__export") { + continue; + } + const { declarations, flags } = exports[id]; + // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. (TS Exceptions: namespaces, function overloads, enums, and interfaces) + if (!(flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) && declarations.length > 1) { + const exportedDeclarations: Declaration[] = filter(declarations, isNotOverload); + if (exportedDeclarations.length > 1) { + for (const declaration of exportedDeclarations) { + diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Cannot_redeclare_exported_variable_0, id)); + } + } + } + } links.exportsChecked = true; } + + function isNotOverload(declaration: Declaration): boolean { + return declaration.kind !== SyntaxKind.FunctionDeclaration || !!(declaration as FunctionDeclaration).body; + } } function checkTypePredicate(node: TypePredicateNode) { @@ -15270,10 +15349,12 @@ namespace ts { } }); + // Setup global builtins + addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); + getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; - globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1); @@ -15411,6 +15492,11 @@ namespace ts { let flags = 0; for (const modifier of node.modifiers) { switch (modifier.kind) { + case SyntaxKind.ConstKeyword: + if (node.kind !== SyntaxKind.EnumDeclaration && node.parent.kind === SyntaxKind.ClassDeclaration) { + return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); + } + break; case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: @@ -15967,13 +16053,27 @@ namespace ts { if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { const variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { + const declarations = variableList.declarations; + + // declarations.length can be zero if there is an error in variable declaration in for-of or for-in + // See http://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements for details + // For example: + // var let = 10; + // for (let of [1,2,3]) {} // this is invalid ES6 syntax + // for (let in [1,2,3]) {} // this is invalid ES6 syntax + // We will then want to skip on grammar checking on variableList declaration + if (!declarations.length) { + return false; + } + + if (declarations.length > 1) { const diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - const firstDeclaration = variableList.declarations[0]; + const firstDeclaration = declarations[0]; + if (firstDeclaration.initializer) { const diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer @@ -16172,7 +16272,7 @@ namespace ts { } } - const checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node)); + const checkLetConstNames = (isLet(node) || isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". @@ -16186,7 +16286,7 @@ namespace ts { function checkGrammarNameInLetOrConstDeclarations(name: Identifier | BindingPattern): boolean { if (name.kind === SyntaxKind.Identifier) { - if ((name).text === "let") { + if ((name).originalKeywordKind === SyntaxKind.LetKeyword) { return grammarErrorOnNode(name, Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c607bace4ef..c8b429d3c53 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -791,7 +791,10 @@ "category": "Error", "code": 1247 }, - + "A class member cannot have the '{0}' keyword.": { + "category": "Error", + "code": 1248 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", "code": 1300 @@ -844,6 +847,10 @@ "category": "Error", "code": 2307 }, + "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.": { + "category": "Error", + "code": 2308 + }, "An export assignment cannot be used in a module with other exported elements.": { "category": "Error", "code": 2309 @@ -900,6 +907,10 @@ "category": "Error", "code": 2322 }, + "Cannot redeclare exported variable '{0}'.": { + "category": "Error", + "code": 2323 + }, "Property '{0}' is missing in type '{1}'.": { "category": "Error", "code": 2324 @@ -1180,6 +1191,10 @@ "category": "Error", "code": 2396 }, + "Declaration name conflicts with built-in global identifier '{0}'.": { + "category": "Error", + "code": 2397 + }, "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { "category": "Error", "code": 2399 @@ -1732,6 +1747,10 @@ "category": "Error", "code": 2657 }, + "Type '{0}' provides no match for the signature '{1}'": { + "category": "Error", + "code": 2658 + }, "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 4e14564a1fc..4d14e38df92 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1453,6 +1453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: case SyntaxKind.IfStatement: + case SyntaxKind.JsxClosingElement: case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.JsxOpeningElement: case SyntaxKind.JsxSpreadAttribute: @@ -3628,12 +3629,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // only allow export default at a source file level if (modulekind === ModuleKind.CommonJS || modulekind === ModuleKind.AMD || modulekind === ModuleKind.UMD) { if (!isEs6Module) { - if (languageVersion === ScriptTarget.ES5) { + if (languageVersion !== ScriptTarget.ES3) { // default value of configurable, enumerable, writable are `false`. write("Object.defineProperty(exports, \"__esModule\", { value: true });"); writeLine(); } - else if (languageVersion === ScriptTarget.ES3) { + else { write("exports.__esModule = true;"); writeLine(); } @@ -4530,7 +4531,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } const isAsync = isAsyncFunctionLike(node); - if (isAsync && languageVersion === ScriptTarget.ES6) { + if (isAsync) { emitAsyncFunctionBodyForES6(node); } else { @@ -5171,35 +5172,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (!(node.flags & NodeFlags.Export)) { return; } - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (node.flags & NodeFlags.Default) { - // if this is a top level default export of decorated class, write the export after the declaration. - writeLine(); - if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) { - write("export default "); - emitDeclarationName(node); - write(";"); - } - else if (modulekind === ModuleKind.System) { - write(`${exportFunctionForFile}("default", `); - emitDeclarationName(node); - write(");"); - } - else if (modulekind !== ModuleKind.ES6) { - write(`exports.default = `); - emitDeclarationName(node); - write(";"); - } + if (modulekind !== ModuleKind.ES6) { + emitExportMemberAssignment(node as ClassDeclaration); } - else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); + else { + // If this is an exported class, but not on the top level (i.e. on an internal + // module), export it + if (node.flags & NodeFlags.Default) { + // if this is a top level default export of decorated class, write the export after the declaration. + if (thisNodeIsDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + else if (node.parent.kind !== SyntaxKind.SourceFile) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } } } @@ -5800,9 +5796,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (!shouldHoistDeclarationInSystemJsModule(node)) { // do not emit var if variable was already hoisted - if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) { + + const isES6ExportedEnum = isES6ExportedDeclaration(node); + if (!(node.flags & NodeFlags.Export) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.EnumDeclaration))) { emitStart(node); - if (isES6ExportedDeclaration(node)) { + if (isES6ExportedEnum) { write("export "); } write("var "); @@ -5899,6 +5897,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return languageVersion === ScriptTarget.ES6 && !!(resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalModuleMergesWithClass); } + function isFirstDeclarationOfKind(node: Declaration, declarations: Declaration[], kind: SyntaxKind) { + return !forEach(declarations, declaration => declaration.kind === kind && declaration.pos < node.pos); + } + function emitModuleDeclaration(node: ModuleDeclaration) { // Emit only if this module is non-ambient. const shouldEmit = shouldEmitModuleDeclaration(node); @@ -5910,15 +5912,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi const emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + const isES6ExportedNamespace = isES6ExportedDeclaration(node); + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.ModuleDeclaration)) { + emitStart(node); + if (isES6ExportedNamespace) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); } emitStart(node); @@ -7819,6 +7824,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi const shebang = getShebang(currentText); if (shebang) { write(shebang); + writeLine(); } } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3a3350f2166..e4262458d30 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1134,6 +1134,14 @@ namespace ts { return token === t && tryParse(nextTokenCanFollowModifier); } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } + function nextTokenCanFollowModifier() { if (token === SyntaxKind.ConstKeyword) { // 'const' is only a modifier if followed by 'enum'. @@ -1154,11 +1162,7 @@ namespace ts { return canFollowModifier(); } - nextToken(); - if (scanner.hasPrecedingLineBreak()) { - return false; - } - return canFollowModifier(); + return nextTokenIsOnSameLineAndCanFollowModifier(); } function parseAnyContextualModifier(): boolean { @@ -4923,15 +4927,31 @@ namespace ts { return decorators; } - function parseModifiers(): ModifiersArray { + /* + * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member. + * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect + * and turns it into a standalone declaration), then it is better to parse it and report an error later. + * + * In such situations, 'permitInvalidConstAsModifier' should be set to true. + */ + function parseModifiers(permitInvalidConstAsModifier?: boolean): ModifiersArray { let flags = 0; let modifiers: ModifiersArray; while (true) { const modifierStart = scanner.getStartPos(); const modifierKind = token; - if (!parseAnyContextualModifier()) { - break; + if (token === SyntaxKind.ConstKeyword && permitInvalidConstAsModifier) { + // We need to ensure that any subsequent modifiers appear on the same line + // so that when 'const' is a standalone declaration, we don't issue an error. + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + break; + } + } + else { + if (!parseAnyContextualModifier()) { + break; + } } if (!modifiers) { @@ -4976,7 +4996,7 @@ namespace ts { const fullStart = getNodePos(); const decorators = parseDecorators(); - const modifiers = parseModifiers(); + const modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true); const accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { @@ -5310,16 +5330,17 @@ namespace ts { } function parseModuleSpecifier(): Expression { - // We allow arbitrary expressions here, even though the grammar only allows string - // literals. We check to ensure that it is only a string literal later in the grammar - // walker. - const result = parseExpression(); - // Ensure the string being required is in our 'identifier' table. This will ensure - // that features like 'find refs' will look inside this file when search for its name. - if (result.kind === SyntaxKind.StringLiteral) { + if (token === SyntaxKind.StringLiteral) { + const result = parseLiteralNode(); internIdentifier((result).text); + return result; + } + else { + // We allow arbitrary expressions here, even though the grammar only allows string + // literals. We check to ensure that it is only a string literal later in the grammar + // check pass. + return parseExpression(); } - return result; } function parseNamespaceImport(): NamespaceImport { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6139dda0013..96afd69ea4d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -99,7 +99,7 @@ namespace ts { jsonContent = { typings: undefined }; } - if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { const result = loadNodeModuleFromFile(extensions, normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; @@ -661,19 +661,17 @@ namespace ts { } function getSemanticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] { - // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a - // JavaScript file. - if (isSourceFileJavaScript(sourceFile)) { - return getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken); - } - return runWithCancellationToken(() => { const typeChecker = getDiagnosticsProducingTypeChecker(); Debug.assert(!!sourceFile.bindDiagnostics); const bindDiagnostics = sourceFile.bindDiagnostics; - const checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report the normal typescript semantic errors. + // Instead, we just report errors for using TypeScript-only constructs from within a + // JavaScript file. + const checkDiagnostics = isSourceFileJavaScript(sourceFile) ? + getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : + typeChecker.getDiagnostics(sourceFile, cancellationToken); const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); @@ -1079,6 +1077,8 @@ namespace ts { const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { + // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files, + // this check is ok. Otherwise this would be never true for javascript file if (!isExternalModule(importedFile)) { const 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)); diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index fc8e90ac38f..11a7646bd09 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -49,6 +49,21 @@ namespace ts { constructor(o: any); } + declare var ChakraHost: { + args: string[]; + currentDirectory: string; + executingFile: string; + echo(s: string): void; + quit(exitCode?: number): void; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + createDirectory(path: string): void; + resolvePath(path: string): string; + readFile(path: string): string; + writeFile(path: string, contents: string): void; + readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + }; + export var sys: System = (function () { function getWScriptSystem(): System { @@ -208,6 +223,7 @@ namespace ts { } }; } + function getNodeSystem(): System { const _fs = require("fs"); const _path = require("path"); @@ -494,6 +510,37 @@ namespace ts { } }; } + + function getChakraSystem(): System { + + return { + newLine: "\r\n", + args: ChakraHost.args, + useCaseSensitiveFileNames: false, + write: ChakraHost.echo, + readFile(path: string, encoding?: string) { + // encoding is automatically handled by the implementation in ChakraHost + return ChakraHost.readFile(path); + }, + writeFile(path: string, data: string, writeByteOrderMark?: boolean) { + // If a BOM is required, emit one + if (writeByteOrderMark) { + data = "\uFEFF" + data; + } + + ChakraHost.writeFile(path, data); + }, + resolvePath: ChakraHost.resolvePath, + fileExists: ChakraHost.fileExists, + directoryExists: ChakraHost.directoryExists, + createDirectory: ChakraHost.createDirectory, + getExecutingFilePath: () => ChakraHost.executingFile, + getCurrentDirectory: () => ChakraHost.currentDirectory, + readDirectory: ChakraHost.readDirectory, + exit: ChakraHost.quit, + }; + } + if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } @@ -502,8 +549,13 @@ namespace ts { // process.browser check excludes webpack and browserify return getNodeSystem(); } + else if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } else { return undefined; // Unsupported host } })(); } + + diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3d16f70d049..4b84c27be99 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1785,7 +1785,7 @@ namespace ts { export interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; - buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 60118604c50..95bf4ff7fa3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1889,8 +1889,10 @@ namespace ts { * Resolves a local path to a path which is absolute to the base of the emit */ export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string { - const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f)); - const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false); + const getCanonicalFileName = (f: string) => host.getCanonicalFileName(f); + const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + const filePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + const relativePath = getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); return removeFileExtension(relativePath); } @@ -2398,7 +2400,7 @@ namespace ts { * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph * as the fallback implementation does not check for circular references by default. */ - export const stringify: (value: any) => string = JSON && JSON.stringify + export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify ? JSON.stringify : stringifyFallback; diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index e2b26747516..531dbf9e5ea 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -1224,7 +1224,7 @@ declare namespace Reflect { function isExtensible(target: any): boolean; function ownKeys(target: any): Array; function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; } @@ -1272,7 +1272,16 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: Iterable>): Promise; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: Iterable>): Promise; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index de1d1b19cf2..bc02f6d6f32 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -461,6 +461,7 @@ namespace ts.formatting { case SyntaxKind.ParenthesizedType: case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.AwaitExpression: + case SyntaxKind.NamedImports: return true; } return false; diff --git a/src/services/services.ts b/src/services/services.ts index 4e0a0265b91..a9dda549ead 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3751,7 +3751,8 @@ namespace ts { // Ignore omitted expressions for missing members if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment && - m.kind !== SyntaxKind.BindingElement) { + m.kind !== SyntaxKind.BindingElement && + m.kind !== SyntaxKind.MethodDeclaration) { continue; } diff --git a/tests/baselines/reference/ClassDeclaration26.errors.txt b/tests/baselines/reference/ClassDeclaration26.errors.txt new file mode 100644 index 00000000000..5e2d570b801 --- /dev/null +++ b/tests/baselines/reference/ClassDeclaration26.errors.txt @@ -0,0 +1,23 @@ +tests/cases/compiler/ClassDeclaration26.ts(2,22): error TS1005: ';' expected. +tests/cases/compiler/ClassDeclaration26.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/ClassDeclaration26.ts(4,20): error TS1005: '=' expected. +tests/cases/compiler/ClassDeclaration26.ts(4,23): error TS1005: '=>' expected. +tests/cases/compiler/ClassDeclaration26.ts(5,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/compiler/ClassDeclaration26.ts (5 errors) ==== + class C { + public const var export foo = 10; + ~~~~~~ +!!! error TS1005: ';' expected. + + var constructor() { } + ~~~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: '=>' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration26.js b/tests/baselines/reference/ClassDeclaration26.js new file mode 100644 index 00000000000..b0879502119 --- /dev/null +++ b/tests/baselines/reference/ClassDeclaration26.js @@ -0,0 +1,15 @@ +//// [ClassDeclaration26.ts] +class C { + public const var export foo = 10; + + var constructor() { } +} + +//// [ClassDeclaration26.js] +var C = (function () { + function C() { + this.foo = 10; + } + return C; +})(); +var constructor = function () { }; diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt new file mode 100644 index 00000000000..d07f07e2096 --- /dev/null +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts(2,3): error TS1248: A class member cannot have the 'const' keyword. + + +==== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts (1 errors) ==== + class AtomicNumbers { + static const H = 1; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1248: A class member cannot have the 'const' keyword. + } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js new file mode 100644 index 00000000000..b8c4dbdf433 --- /dev/null +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js @@ -0,0 +1,12 @@ +//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts] +class AtomicNumbers { + static const H = 1; +} + +//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js] +var AtomicNumbers = (function () { + function AtomicNumbers() { + } + AtomicNumbers.H = 1; + return AtomicNumbers; +})(); diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js new file mode 100644 index 00000000000..bd1f1e0c674 --- /dev/null +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js @@ -0,0 +1,13 @@ +//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts] +class C { + const + x = 10; +} + +//// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js] +var C = (function () { + function C() { + this.x = 10; + } + return C; +})(); diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols new file mode 100644 index 00000000000..ce0ab000017 --- /dev/null +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts === +class C { +>C : Symbol(C, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 0)) + + const +>const : Symbol(const, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 9)) + + x = 10; +>x : Symbol(x, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 1, 9)) +} diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.types b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.types new file mode 100644 index 00000000000..47139729995 --- /dev/null +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts === +class C { +>C : C + + const +>const : any + + x = 10; +>x : number +>10 : number +} diff --git a/tests/baselines/reference/anonymousDefaultExportsAmd.js b/tests/baselines/reference/anonymousDefaultExportsAmd.js index 67931fd6cc8..bb5cd587a83 100644 --- a/tests/baselines/reference/anonymousDefaultExportsAmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsAmd.js @@ -11,11 +11,13 @@ define(["require", "exports"], function (require, exports) { "use strict"; class default_1 { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); //// [b.js] define(["require", "exports"], function (require, exports) { "use strict"; function default_1() { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); diff --git a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js index 513b75c27bd..754ffdb7c9b 100644 --- a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js +++ b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js @@ -10,8 +10,10 @@ export default function() {} "use strict"; class default_1 { } +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; //// [b.js] "use strict"; function default_1() { } +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; diff --git a/tests/baselines/reference/anonymousDefaultExportsUmd.js b/tests/baselines/reference/anonymousDefaultExportsUmd.js index bdaf8dc6aa8..203b234dfa0 100644 --- a/tests/baselines/reference/anonymousDefaultExportsUmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsUmd.js @@ -18,6 +18,7 @@ export default function() {} "use strict"; class default_1 { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); //// [b.js] @@ -31,5 +32,6 @@ export default function() {} })(function (require, exports) { "use strict"; function default_1() { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt index 9c0c0d6a8fd..8e285d414e5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt @@ -1,11 +1,19 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(28,1): error TS2322: Type 'S2' is not assignable to type 'T'. + Type 'S2' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(29,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(30,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. + Type '(x: string) => number' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(31,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. + Type '(x: string) => string' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(32,1): error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'. + Type 'S2' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(33,1): error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(34,1): error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => number' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(35,1): error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => string' provides no match for the signature 'new (x: number): void' ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts (8 errors) ==== @@ -39,25 +47,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme t = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type 'T'. +!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void' t = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. +!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void' t = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. +!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void' a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void' a = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void' a = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void' \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt index 5e8fc6dd3a4..eacf758d935 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt @@ -9,9 +9,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(35,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. @@ -19,9 +21,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(39,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. + Type '(x: string) => void' provides no match for the signature 'new (x: number): void' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'. @@ -79,11 +83,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'S2' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' t = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. @@ -97,11 +103,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' a = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index 804e31600e1..6cd40f6c8c1 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -11,12 +11,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. + Type '(a: any) => any' provides no match for the signature 'new (a: number): number' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. + Type '(a: any) => any' provides no match for the signature 'new (a: T): T' tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. @@ -116,6 +118,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' b16 = a16; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. @@ -128,6 +131,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' b17 = a17; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. diff --git a/tests/baselines/reference/assignmentCompatability24.errors.txt b/tests/baselines/reference/assignmentCompatability24.errors.txt index 0f4a535d413..e49f0803b04 100644 --- a/tests/baselines/reference/assignmentCompatability24.errors.txt +++ b/tests/baselines/reference/assignmentCompatability24.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' ==== tests/cases/compiler/assignmentCompatability24.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'inte } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability33.errors.txt b/tests/baselines/reference/assignmentCompatability33.errors.txt index e2352625280..386b3c5e292 100644 --- a/tests/baselines/reference/assignmentCompatability33.errors.txt +++ b/tests/baselines/reference/assignmentCompatability33.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' ==== tests/cases/compiler/assignmentCompatability33.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'inte } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability34.errors.txt b/tests/baselines/reference/assignmentCompatability34.errors.txt index 2dd9cba6470..fa91456b286 100644 --- a/tests/baselines/reference/assignmentCompatability34.errors.txt +++ b/tests/baselines/reference/assignmentCompatability34.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber' ==== tests/cases/compiler/assignmentCompatability34.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'inte } __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber' \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability37.errors.txt b/tests/baselines/reference/assignmentCompatability37.errors.txt index 452b72fe8ff..194e216f1ee 100644 --- a/tests/baselines/reference/assignmentCompatability37.errors.txt +++ b/tests/baselines/reference/assignmentCompatability37.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. + Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any' ==== tests/cases/compiler/assignmentCompatability37.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'inte } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any' \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability38.errors.txt b/tests/baselines/reference/assignmentCompatability38.errors.txt index 5f7918374c1..c15e5e31230 100644 --- a/tests/baselines/reference/assignmentCompatability38.errors.txt +++ b/tests/baselines/reference/assignmentCompatability38.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. + Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any' ==== tests/cases/compiler/assignmentCompatability38.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'inte } __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any' \ No newline at end of file diff --git a/tests/baselines/reference/callConstructAssignment.errors.txt b/tests/baselines/reference/callConstructAssignment.errors.txt index 42949cf585d..fc36e472151 100644 --- a/tests/baselines/reference/callConstructAssignment.errors.txt +++ b/tests/baselines/reference/callConstructAssignment.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/callConstructAssignment.ts(7,1): error TS2322: Type 'new () => any' is not assignable to type '() => void'. + Type 'new () => any' provides no match for the signature '(): void' tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => void' is not assignable to type 'new () => any'. + Type '() => void' provides no match for the signature 'new (): any' ==== tests/cases/compiler/callConstructAssignment.ts (2 errors) ==== @@ -12,6 +14,8 @@ tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => foo = bar; // error ~~~ !!! error TS2322: Type 'new () => any' is not assignable to type '() => void'. +!!! error TS2322: Type 'new () => any' provides no match for the signature '(): void' bar = foo; // error ~~~ -!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'. \ No newline at end of file +!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'. +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' \ No newline at end of file diff --git a/tests/baselines/reference/commonSourceDir6.js b/tests/baselines/reference/commonSourceDir6.js index 6fe0b4a1b8f..88f5828a500 100644 --- a/tests/baselines/reference/commonSourceDir6.js +++ b/tests/baselines/reference/commonSourceDir6.js @@ -16,17 +16,17 @@ export var pi = Math.PI; export var y = x * i; //// [concat.js] -define("tests/cases/compiler/baz", ["require", "exports", "tests/cases/compiler/a/bar", "tests/cases/compiler/a/foo"], function (require, exports, bar_1, foo_1) { +define("baz", ["require", "exports", "a/bar", "a/foo"], function (require, exports, bar_1, foo_1) { "use strict"; exports.pi = Math.PI; exports.y = bar_1.x * foo_1.i; }); -define("tests/cases/compiler/a/foo", ["require", "exports", "tests/cases/compiler/baz"], function (require, exports, baz_1) { +define("a/foo", ["require", "exports", "baz"], function (require, exports, baz_1) { "use strict"; exports.i = Math.sqrt(-1); exports.z = baz_1.pi * baz_1.pi; }); -define("tests/cases/compiler/a/bar", ["require", "exports", "tests/cases/compiler/a/foo"], function (require, exports, foo_2) { +define("a/bar", ["require", "exports", "a/foo"], function (require, exports, foo_2) { "use strict"; exports.x = foo_2.z + foo_2.z; }); diff --git a/tests/baselines/reference/constructorAsType.errors.txt b/tests/baselines/reference/constructorAsType.errors.txt index b0d30295cde..7865a5ecac5 100644 --- a/tests/baselines/reference/constructorAsType.errors.txt +++ b/tests/baselines/reference/constructorAsType.errors.txt @@ -1,10 +1,12 @@ tests/cases/compiler/constructorAsType.ts(1,5): error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. + Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }' ==== tests/cases/compiler/constructorAsType.ts (1 errors) ==== var Person:new () => {name: string;} = function () {return {name:"joe"};}; ~~~~~~ !!! error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. +!!! error TS2322: Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }' var Person2:{new() : {name:string;};}; diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js index 05323aa247d..dbbe72ba52c 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.js @@ -28,6 +28,7 @@ define(["require", "exports"], function (require, exports) { Foo = __decorate([ decorator ], Foo); + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; }); //// [b.js] @@ -45,5 +46,6 @@ define(["require", "exports"], function (require, exports) { default_1 = __decorate([ decorator ], default_1); + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js index 32e053789ce..ab518d73cb9 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.js @@ -27,6 +27,7 @@ let Foo = class { Foo = __decorate([ decorator ], Foo); +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; //// [b.js] "use strict"; @@ -42,4 +43,5 @@ let default_1 = class { default_1 = __decorate([ decorator ], default_1); +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js index d65bc33575b..f8cb770f1d2 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js @@ -35,6 +35,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, Foo = __decorate([ decorator ], Foo); + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; }); //// [b.js] @@ -59,5 +60,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, default_1 = __decorate([ decorator ], default_1); + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; }); diff --git a/tests/baselines/reference/defaultExportsGetExportedAmd.js b/tests/baselines/reference/defaultExportsGetExportedAmd.js index fd9927250cb..fc0385254c0 100644 --- a/tests/baselines/reference/defaultExportsGetExportedAmd.js +++ b/tests/baselines/reference/defaultExportsGetExportedAmd.js @@ -12,11 +12,13 @@ define(["require", "exports"], function (require, exports) { "use strict"; class Foo { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; }); //// [b.js] define(["require", "exports"], function (require, exports) { "use strict"; function foo() { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = foo; }); diff --git a/tests/baselines/reference/defaultExportsGetExportedCommonjs.js b/tests/baselines/reference/defaultExportsGetExportedCommonjs.js index 8b97cff5d38..1290404099d 100644 --- a/tests/baselines/reference/defaultExportsGetExportedCommonjs.js +++ b/tests/baselines/reference/defaultExportsGetExportedCommonjs.js @@ -11,8 +11,10 @@ export default function foo() {} "use strict"; class Foo { } +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; //// [b.js] "use strict"; function foo() { } +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = foo; diff --git a/tests/baselines/reference/defaultExportsGetExportedUmd.js b/tests/baselines/reference/defaultExportsGetExportedUmd.js index 2d442e42061..754c5b00ac8 100644 --- a/tests/baselines/reference/defaultExportsGetExportedUmd.js +++ b/tests/baselines/reference/defaultExportsGetExportedUmd.js @@ -19,6 +19,7 @@ export default function foo() {} "use strict"; class Foo { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Foo; }); //// [b.js] @@ -32,5 +33,6 @@ export default function foo() {} })(function (require, exports) { "use strict"; function foo() { } + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = foo; }); diff --git a/tests/baselines/reference/enumExportMergingES6.js b/tests/baselines/reference/enumExportMergingES6.js new file mode 100644 index 00000000000..7a5ea5f2718 --- /dev/null +++ b/tests/baselines/reference/enumExportMergingES6.js @@ -0,0 +1,23 @@ +//// [enumExportMergingES6.ts] +export enum Animals { + Cat = 1 +} +export enum Animals { + Dog = 2 +} +export enum Animals { + CatDog = Cat | Dog +} + + +//// [enumExportMergingES6.js] +export var Animals; +(function (Animals) { + Animals[Animals["Cat"] = 1] = "Cat"; +})(Animals || (Animals = {})); +(function (Animals) { + Animals[Animals["Dog"] = 2] = "Dog"; +})(Animals || (Animals = {})); +(function (Animals) { + Animals[Animals["CatDog"] = 3] = "CatDog"; +})(Animals || (Animals = {})); diff --git a/tests/baselines/reference/enumExportMergingES6.symbols b/tests/baselines/reference/enumExportMergingES6.symbols new file mode 100644 index 00000000000..66fc31c5e18 --- /dev/null +++ b/tests/baselines/reference/enumExportMergingES6.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/enums/enumExportMergingES6.ts === +export enum Animals { +>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1)) + + Cat = 1 +>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21)) +} +export enum Animals { +>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1)) + + Dog = 2 +>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21)) +} +export enum Animals { +>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1)) + + CatDog = Cat | Dog +>CatDog : Symbol(Animals.CatDog, Decl(enumExportMergingES6.ts, 6, 21)) +>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21)) +>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21)) +} + diff --git a/tests/baselines/reference/enumExportMergingES6.types b/tests/baselines/reference/enumExportMergingES6.types new file mode 100644 index 00000000000..da2fc22cb8a --- /dev/null +++ b/tests/baselines/reference/enumExportMergingES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/enums/enumExportMergingES6.ts === +export enum Animals { +>Animals : Animals + + Cat = 1 +>Cat : Animals +>1 : number +} +export enum Animals { +>Animals : Animals + + Dog = 2 +>Dog : Animals +>2 : number +} +export enum Animals { +>Animals : Animals + + CatDog = Cat | Dog +>CatDog : Animals +>Cat | Dog : number +>Cat : Animals +>Dog : Animals +} + diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js index 51fc7bf6897..d7dfe29208d 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js @@ -27,6 +27,7 @@ var x1: number = m; exports.a = 10; exports.x = exports.a; exports.m = exports.a; +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = {}; //// [es6ImportDefaultBindingFollowedWithNamedImport_1.js] "use strict"; diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt index 76c424a74d4..97c66a17960 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt @@ -1,15 +1,21 @@ tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(2,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(3,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(3,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. +tests/cases/compiler/client.ts(4,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(5,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(5,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. +tests/cases/compiler/client.ts(6,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(7,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(7,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'. tests/cases/compiler/client.ts(7,37): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'. +tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(9,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'. +tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'. +tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'x1'. ==== tests/cases/compiler/server.ts (0 errors) ==== @@ -17,23 +23,29 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil var a = 10; export default a; -==== tests/cases/compiler/client.ts (12 errors) ==== +==== tests/cases/compiler/client.ts (18 errors) ==== export import defaultBinding1, { } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = defaultBinding1; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. 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; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. 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; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding4, { x, a as y } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. @@ -42,16 +54,22 @@ 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; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. 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; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding6, { m, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ !!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'. export var x1: number = defaultBinding6; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportWithExport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportWithExport.errors.txt index 83f91787b87..859fe59b47f 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportWithExport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportWithExport.errors.txt @@ -1,9 +1,15 @@ tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(2,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(3,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(4,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(5,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(6,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(7,12): error TS2323: Cannot redeclare exported variable 'x1'. +tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'x1'. ==== tests/cases/compiler/server.ts (0 errors) ==== @@ -13,7 +19,7 @@ tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot export var m = a; export default {}; -==== tests/cases/compiler/client.ts (6 errors) ==== +==== tests/cases/compiler/client.ts (12 errors) ==== export import defaultBinding1, { } from "server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. @@ -21,21 +27,33 @@ tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = a; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding3, { a as b } from "server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = b; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding4, { x, a as y } from "server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = x; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export var x1: number = y; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding5, { x as z, } from "server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = z; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. export import defaultBinding6, { m, } from "server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var x1: number = m; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'x1'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt b/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt index a5a4301683e..3b2d6b0cbd0 100644 --- a/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportWithExport.errors.txt @@ -1,11 +1,21 @@ tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(2,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(3,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(4,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(5,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(6,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(7,12): error TS2323: Cannot redeclare exported variable 'xxxx'. +tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(13,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(14,12): error TS2323: Cannot redeclare exported variable 'xxxx'. +tests/cases/compiler/client.ts(15,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(16,1): error TS1191: An import declaration cannot have modifiers. +tests/cases/compiler/client.ts(17,12): error TS2323: Cannot redeclare exported variable 'xxxx'. +tests/cases/compiler/client.ts(18,12): error TS2323: Cannot redeclare exported variable 'xxxx'. tests/cases/compiler/client.ts(19,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(21,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(25,1): error TS1191: An import declaration cannot have modifiers. @@ -23,7 +33,7 @@ tests/cases/compiler/client.ts(26,1): error TS1191: An import declaration cannot export var z2 = 10; export var aaaa = 10; -==== tests/cases/compiler/client.ts (12 errors) ==== +==== tests/cases/compiler/client.ts (22 errors) ==== export import { } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. @@ -31,33 +41,53 @@ tests/cases/compiler/client.ts(26,1): error TS1191: An import declaration cannot ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { a as b } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = b; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { x, a as y } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = x; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export var xxxx = y; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { x as z, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = z; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { m, } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = m; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { a1, x1 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a1; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export var xxxx = x1; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { a1 as a11, x1 as x11 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. export var xxxx = a11; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export var xxxx = x11; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'xxxx'. export import { z1 } from "./server"; ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. diff --git a/tests/baselines/reference/es6ModuleInternalNamedImports2.js b/tests/baselines/reference/es6ModuleInternalNamedImports2.js index 9dee8153e56..98226a1e52b 100644 --- a/tests/baselines/reference/es6ModuleInternalNamedImports2.js +++ b/tests/baselines/reference/es6ModuleInternalNamedImports2.js @@ -58,7 +58,6 @@ export var M; // alias M.M_A = M_M; })(M || (M = {})); -export var M; (function (M) { // Reexports export { M_V as v }; diff --git a/tests/baselines/reference/exportStar-amd.errors.txt b/tests/baselines/reference/exportStar-amd.errors.txt index adab0516103..edd5c0d51bd 100644 --- a/tests/baselines/reference/exportStar-amd.errors.txt +++ b/tests/baselines/reference/exportStar-amd.errors.txt @@ -1,4 +1,6 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/cases/conformance/es6/modules/t4"' has no default export. +tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity. +tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity. ==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ==== @@ -16,10 +18,14 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/c var z = "z"; export { x, y, z }; -==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ==== +==== tests/cases/conformance/es6/modules/t4.ts (2 errors) ==== export * from "./t1"; export * from "./t2"; export * from "./t3"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity. ==== tests/cases/conformance/es6/modules/main.ts (1 errors) ==== import hello, { x, y, z, foo } from "./t4"; diff --git a/tests/baselines/reference/exportStar.errors.txt b/tests/baselines/reference/exportStar.errors.txt index adab0516103..edd5c0d51bd 100644 --- a/tests/baselines/reference/exportStar.errors.txt +++ b/tests/baselines/reference/exportStar.errors.txt @@ -1,4 +1,6 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/cases/conformance/es6/modules/t4"' has no default export. +tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity. +tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity. ==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ==== @@ -16,10 +18,14 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/c var z = "z"; export { x, y, z }; -==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ==== +==== tests/cases/conformance/es6/modules/t4.ts (2 errors) ==== export * from "./t1"; export * from "./t2"; export * from "./t3"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity. ==== tests/cases/conformance/es6/modules/main.ts (1 errors) ==== import hello, { x, y, z, foo } from "./t4"; diff --git a/tests/baselines/reference/exportsAndImports4-es6.js b/tests/baselines/reference/exportsAndImports4-es6.js index 3d3278b4462..39c6583e935 100644 --- a/tests/baselines/reference/exportsAndImports4-es6.js +++ b/tests/baselines/reference/exportsAndImports4-es6.js @@ -41,6 +41,7 @@ export { a, b, c, d, e1, e2, f1, f2 }; //// [t1.js] "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); exports.default = "hello"; //// [t3.js] "use strict"; diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js new file mode 100644 index 00000000000..c440872a566 --- /dev/null +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -0,0 +1,27 @@ +//// [extendConstructSignatureInInterface.ts] +interface C { + new(x: number): C; +} + +var CStatic: C; +class E extends CStatic { +} + +var e: E = new E(1); + + +//// [extendConstructSignatureInInterface.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 CStatic; +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +})(CStatic); +var e = new E(1); diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.symbols b/tests/baselines/reference/extendConstructSignatureInInterface.symbols new file mode 100644 index 00000000000..df966bc9fcc --- /dev/null +++ b/tests/baselines/reference/extendConstructSignatureInInterface.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/extendConstructSignatureInInterface.ts === +interface C { +>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0)) + + new(x: number): C; +>x : Symbol(x, Decl(extendConstructSignatureInInterface.ts, 1, 8)) +>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0)) +} + +var CStatic: C; +>CStatic : Symbol(CStatic, Decl(extendConstructSignatureInInterface.ts, 4, 3)) +>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0)) + +class E extends CStatic { +>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15)) +>CStatic : Symbol(CStatic, Decl(extendConstructSignatureInInterface.ts, 4, 3)) +} + +var e: E = new E(1); +>e : Symbol(e, Decl(extendConstructSignatureInInterface.ts, 8, 3)) +>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15)) +>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15)) + diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.types b/tests/baselines/reference/extendConstructSignatureInInterface.types new file mode 100644 index 00000000000..363107b2e54 --- /dev/null +++ b/tests/baselines/reference/extendConstructSignatureInInterface.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/extendConstructSignatureInInterface.ts === +interface C { +>C : C + + new(x: number): C; +>x : number +>C : C +} + +var CStatic: C; +>CStatic : C +>C : C + +class E extends CStatic { +>E : E +>CStatic : C +} + +var e: E = new E(1); +>e : E +>E : E +>new E(1) : E +>E : typeof E +>1 : number + diff --git a/tests/baselines/reference/filesEmittingIntoSameOutputWithOutOption.js b/tests/baselines/reference/filesEmittingIntoSameOutputWithOutOption.js index 164fd091c16..d8513e6731c 100644 --- a/tests/baselines/reference/filesEmittingIntoSameOutputWithOutOption.js +++ b/tests/baselines/reference/filesEmittingIntoSameOutputWithOutOption.js @@ -10,7 +10,7 @@ function foo() { //// [a.js] -define("tests/cases/compiler/a", ["require", "exports"], function (require, exports) { +define("a", ["require", "exports"], function (require, exports) { "use strict"; var c = (function () { function c() { diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 871368da9fe..4f78636d08c 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -3,15 +3,21 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. + Type 'Function' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'string[]' is not assignable to type 'string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. + Type 'typeof C' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. + Type 'new (x: string) => string' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. + Type 'typeof C2' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. + Type 'new (x: T) => T' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. + Type 'F2' provides no match for the signature '(x: string): string' tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. Type '() => void' is not assignable to type '(x: string) => string'. @@ -51,6 +57,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r = foo2(new Function()); ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'Function' provides no match for the signature '(x: string): string' var r2 = foo2((x: string[]) => x); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. @@ -59,9 +66,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r6 = foo2(C); ~ !!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'typeof C' provides no match for the signature '(x: string): string' var r7 = foo2(b); ~ !!! error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'new (x: string) => string' provides no match for the signature '(x: string): string' var r8 = foo2((x: U) => x); // no error expected var r11 = foo2((x: U, y: V) => x); ~~~~~~~~~~~~~~~~~~~~~~~ @@ -69,15 +78,18 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r13 = foo2(C2); ~~ !!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'typeof C2' provides no match for the signature '(x: string): string' var r14 = foo2(b2); ~~ !!! error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'new (x: T) => T' provides no match for the signature '(x: string): string' interface F2 extends Function { foo: string; } var f2: F2; var r16 = foo2(f2); ~~ !!! error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'F2' provides no match for the signature '(x: string): string' function fff(x: T, y: U) { ~~~~~~~~~~~ diff --git a/tests/baselines/reference/generatorTypeCheck31.errors.txt b/tests/baselines/reference/generatorTypeCheck31.errors.txt index a0336b464a4..3f54edacb2a 100644 --- a/tests/baselines/reference/generatorTypeCheck31.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck31.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'. + Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>' ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts (1 errors) ==== @@ -10,4 +11,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): erro } () ~~~~~~~~ !!! error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'. +!!! error TS2322: Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>' } \ No newline at end of file diff --git a/tests/baselines/reference/genericSignatureIdentity.js b/tests/baselines/reference/genericSignatureIdentity.js new file mode 100644 index 00000000000..9a51a61edbd --- /dev/null +++ b/tests/baselines/reference/genericSignatureIdentity.js @@ -0,0 +1,32 @@ +//// [genericSignatureIdentity.ts] +// This test is here to remind us of our current limits of type identity checking. +// Ideally all of the below declarations would be considered different (and thus errors) +// but they aren't because we erase type parameters to type any and don't check that +// constraints are identical. + +var x: { + (x: T): T; +}; + +var x: { + (x: T): T; +}; + +var x: { + (x: T): T; +}; + +var x: { + (x: any): any; +}; + + +//// [genericSignatureIdentity.js] +// This test is here to remind us of our current limits of type identity checking. +// Ideally all of the below declarations would be considered different (and thus errors) +// but they aren't because we erase type parameters to type any and don't check that +// constraints are identical. +var x; +var x; +var x; +var x; diff --git a/tests/baselines/reference/genericSignatureIdentity.symbols b/tests/baselines/reference/genericSignatureIdentity.symbols new file mode 100644 index 00000000000..afd12ec266a --- /dev/null +++ b/tests/baselines/reference/genericSignatureIdentity.symbols @@ -0,0 +1,49 @@ +=== tests/cases/compiler/genericSignatureIdentity.ts === +// This test is here to remind us of our current limits of type identity checking. +// Ideally all of the below declarations would be considered different (and thus errors) +// but they aren't because we erase type parameters to type any and don't check that +// constraints are identical. + +var x: { +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3)) + + (x: T): T; +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 6, 21)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) + +}; + +var x: { +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3)) + + (x: T): T; +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5)) +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 10, 23)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5)) + +}; + +var x: { +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3)) + + (x: T): T; +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5)) +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 14, 8)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5)) +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5)) + +}; + +var x: { +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3)) + + (x: any): any; +>T : Symbol(T, Decl(genericSignatureIdentity.ts, 18, 5)) +>x : Symbol(x, Decl(genericSignatureIdentity.ts, 18, 8)) + +}; + diff --git a/tests/baselines/reference/genericSignatureIdentity.types b/tests/baselines/reference/genericSignatureIdentity.types new file mode 100644 index 00000000000..9385718a361 --- /dev/null +++ b/tests/baselines/reference/genericSignatureIdentity.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/genericSignatureIdentity.ts === +// This test is here to remind us of our current limits of type identity checking. +// Ideally all of the below declarations would be considered different (and thus errors) +// but they aren't because we erase type parameters to type any and don't check that +// constraints are identical. + +var x: { +>x : (x: T) => T + + (x: T): T; +>T : T +>Date : Date +>x : T +>T : T +>T : T + +}; + +var x: { +>x : (x: T) => T + + (x: T): T; +>T : T +>x : T +>T : T +>T : T + +}; + +var x: { +>x : (x: T) => T + + (x: T): T; +>T : T +>x : T +>T : T +>T : T + +}; + +var x: { +>x : (x: T) => T + + (x: any): any; +>T : T +>x : any + +}; + diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index e48d1b1dc73..3d805a65822 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -14,17 +14,24 @@ tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'. tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. + Type '{}' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'. + Type 'Object' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'. + Type 'Base' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'. tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. + Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'. + Type 'Object' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'. + Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'. + Type '() => void' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'. @@ -50,9 +57,12 @@ tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'. tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. + Type '{}' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'. + Type 'Object' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'. + Type 'Base' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'. Type 'void' is not assignable to type 'number'. tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. @@ -60,9 +70,13 @@ tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'. tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. + Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. + Type 'Object' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. + Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. + Type '() => void' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'. @@ -216,15 +230,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj12: i2 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i2'. +!!! error TS2322: Type '{}' provides no match for the signature '(): any' var obj13: i2 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i2'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): any' var obj14: i2 = new obj11; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. var obj15: i2 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i2'. +!!! error TS2322: Type 'Base' provides no match for the signature '(): any' var obj16: i2 = null; var obj17: i2 = function ():any { return 0; }; //var obj18: i2 = function foo() { }; @@ -246,17 +263,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj23: i3 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i3'. +!!! error TS2322: Type '{}' provides no match for the signature 'new (): any' var obj24: i3 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i3'. +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var obj25: i3 = new obj22; var obj26: i3 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i3'. +!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any' var obj27: i3 = null; var obj28: i3 = function () { }; ~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'i3'. +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' //var obj29: i3 = function foo() { }; var obj30: i3 = anyVar; var obj31: i3 = new anyVar; @@ -338,15 +359,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj56: i6 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i6'. +!!! error TS2322: Type '{}' provides no match for the signature '(): any' var obj57: i6 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i6'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): any' var obj58: i6 = new obj55; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. var obj59: i6 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i6'. +!!! error TS2322: Type 'Base' provides no match for the signature '(): any' var obj60: i6 = null; var obj61: i6 = function () { }; ~~~~~ @@ -371,17 +395,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj67: i7 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i7'. +!!! error TS2322: Type '{}' provides no match for the signature 'new (): any' var obj68: i7 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i7'. +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ !!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any' var obj71: i7 = null; var obj72: i7 = function () { }; ~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'i7'. +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' //var obj73: i7 = function foo() { }; var obj74: i7 = anyVar; var obj75: i7 = new anyVar; diff --git a/tests/baselines/reference/interfaceImplementation1.errors.txt b/tests/baselines/reference/interfaceImplementation1.errors.txt index 45b011c6929..e5e1a212a06 100644 --- a/tests/baselines/reference/interfaceImplementation1.errors.txt +++ b/tests/baselines/reference/interfaceImplementation1.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' incorrectly implements interface 'I2'. Property 'iFn' is private in type 'C1' but not in type 'I2'. tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() => C2' is not assignable to type 'I4'. + Type '() => C2' provides no match for the signature 'new (): I3' ==== tests/cases/compiler/interfaceImplementation1.ts (3 errors) ==== @@ -48,6 +49,7 @@ tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() = var a:I4 = function(){ ~ !!! error TS2322: Type '() => C2' is not assignable to type 'I4'. +!!! error TS2322: Type '() => C2' provides no match for the signature 'new (): I3' return new C2(); } new a(); diff --git a/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.errors.txt b/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.errors.txt new file mode 100644 index 00000000000..c31b03bae4c --- /dev/null +++ b/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,13): error TS1005: '=' expected. +tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,20): error TS1005: ',' expected. +tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(7,1): error TS1005: ';' expected. + + +==== tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts (3 errors) ==== + // This should be an error + // More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + + var let = 10; + for (let of [1,2,3]) {} + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: ',' expected. + + for (let in [1,2,3]) {} + ~~~ +!!! error TS1005: ';' expected. + + + \ No newline at end of file diff --git a/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.js b/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.js new file mode 100644 index 00000000000..729cb246a85 --- /dev/null +++ b/tests/baselines/reference/invalidLetInForOfAndForIn_ES5.js @@ -0,0 +1,18 @@ +//// [invalidLetInForOfAndForIn_ES5.ts] +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + +var let = 10; +for (let of [1,2,3]) {} + +for (let in [1,2,3]) {} + + + + +//// [invalidLetInForOfAndForIn_ES5.js] +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements +var let = 10; +for (let of = [1, 2, 3], { }; ; ) + for ( in [1, 2, 3]) { } diff --git a/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.errors.txt b/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.errors.txt new file mode 100644 index 00000000000..c126e8b7443 --- /dev/null +++ b/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,13): error TS1005: '=' expected. +tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,20): error TS1005: ',' expected. +tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(7,1): error TS1005: ';' expected. + + +==== tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts (3 errors) ==== + // This should be an error + // More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + + var let = 10; + for (let of [1,2,3]) {} + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: ',' expected. + + for (let in [1,2,3]) {} + ~~~ +!!! error TS1005: ';' expected. + + + \ No newline at end of file diff --git a/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.js b/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.js new file mode 100644 index 00000000000..93258d6b225 --- /dev/null +++ b/tests/baselines/reference/invalidLetInForOfAndForIn_ES6.js @@ -0,0 +1,18 @@ +//// [invalidLetInForOfAndForIn_ES6.ts] +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + +var let = 10; +for (let of [1,2,3]) {} + +for (let in [1,2,3]) {} + + + + +//// [invalidLetInForOfAndForIn_ES6.js] +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements +var let = 10; +for (let of = [1, 2, 3], { }; ; ) + for ( in [1, 2, 3]) { } diff --git a/tests/baselines/reference/jsFileCompilationBindDuplicateIdentifier.errors.txt b/tests/baselines/reference/jsFileCompilationBindDuplicateIdentifier.errors.txt new file mode 100644 index 00000000000..2816eaee8b4 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDuplicateIdentifier.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/a.js(1,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/a.js(2,7): error TS2300: Duplicate identifier 'a'. + + +==== tests/cases/compiler/a.js (2 errors) ==== + var a = 10; + ~ +!!! error TS2300: Duplicate identifier 'a'. + class a { + ~ +!!! error TS2300: Duplicate identifier 'a'. + } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindErrors.errors.txt new file mode 100644 index 00000000000..eeae7053333 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindErrors.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/a.js(1,5): error TS2451: Cannot redeclare block-scoped variable 'C'. +tests/cases/compiler/a.js(2,5): error TS2451: Cannot redeclare block-scoped variable 'C'. +tests/cases/compiler/a.js(6,5): error TS7027: Unreachable code detected. +tests/cases/compiler/a.js(11,9): error TS1100: Invalid use of 'arguments' in strict mode. + + +==== tests/cases/compiler/a.js (4 errors) ==== + let C = "sss"; + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'C'. + let C = 0; // Error: Cannot redeclare block-scoped variable 'C'. + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'C'. + + function f() { + return; + return; // Error: Unreachable code detected. + ~~~~~~ +!!! error TS7027: Unreachable code detected. + } + + function b() { + "use strict"; + var arguments = 0; // Error: Invalid use of 'arguments' in strict mode. + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. + } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindErrors.symbols b/tests/baselines/reference/jsFileCompilationBindErrors.symbols deleted file mode 100644 index 6ad06da1df6..00000000000 --- a/tests/baselines/reference/jsFileCompilationBindErrors.symbols +++ /dev/null @@ -1,21 +0,0 @@ -=== tests/cases/compiler/a.js === -let C = "sss"; ->C : Symbol(C, Decl(a.js, 0, 3)) - -let C = 0; // Error: Cannot redeclare block-scoped variable 'C'. ->C : Symbol(C, Decl(a.js, 1, 3)) - -function f() { ->f : Symbol(f, Decl(a.js, 1, 10)) - - return; - return; // Error: Unreachable code detected. -} - -function b() { ->b : Symbol(b, Decl(a.js, 6, 1)) - - "use strict"; - var arguments = 0; // Error: Invalid use of 'arguments' in strict mode. ->arguments : Symbol(arguments, Decl(a.js, 10, 7)) -} diff --git a/tests/baselines/reference/jsFileCompilationBindErrors.types b/tests/baselines/reference/jsFileCompilationBindErrors.types deleted file mode 100644 index 113bcd08bc9..00000000000 --- a/tests/baselines/reference/jsFileCompilationBindErrors.types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/compiler/a.js === -let C = "sss"; ->C : string ->"sss" : string - -let C = 0; // Error: Cannot redeclare block-scoped variable 'C'. ->C : number ->0 : number - -function f() { ->f : () => void - - return; - return; // Error: Unreachable code detected. -} - -function b() { ->b : () => void - - "use strict"; ->"use strict" : string - - var arguments = 0; // Error: Invalid use of 'arguments' in strict mode. ->arguments : number ->0 : number -} diff --git a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt new file mode 100644 index 00000000000..733f66922ab --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports. +tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports. +tests/cases/compiler/a.js(3,1): error TS8003: 'export=' can only be used in a .ts file. +tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. + + +==== tests/cases/compiler/a.js (4 errors) ==== + export default class a { + ~ +!!! error TS2528: A module cannot have multiple default exports. + } + export default var a = 10; + ~~~~~~~~~~~~~~ +!!! error TS2528: A module cannot have multiple default exports. + ~~~~~~~~~~~~~~ +!!! error TS8003: 'export=' can only be used in a .ts file. + ~~~ +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindReachabilityErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindReachabilityErrors.errors.txt new file mode 100644 index 00000000000..a883e66e607 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindReachabilityErrors.errors.txt @@ -0,0 +1,31 @@ +tests/cases/compiler/a.js(3,9): error TS7029: Fallthrough case in switch. +tests/cases/compiler/a.js(16,5): error TS7027: Unreachable code detected. +tests/cases/compiler/a.js(19,1): error TS7028: Unused label. + + +==== tests/cases/compiler/a.js (3 errors) ==== + function foo(a, b) { + switch (a) { + case 10: + ~~~~ +!!! error TS7029: Fallthrough case in switch. + if (b) { + return b; + } + case 20: + return a; + } + } + + function bar() { + return x; + function bar2() { + } + var x = 10; // error + ~~~ +!!! error TS7027: Unreachable code detected. + } + + label1: var x2 = 10; + ~~~~~~ +!!! error TS7028: Unused label. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt new file mode 100644 index 00000000000..65dffb5a08e --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt @@ -0,0 +1,81 @@ +tests/cases/compiler/a.js(3,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. +tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode. +tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode. +tests/cases/compiler/a.js(15,1): error TS1101: 'with' statements are not allowed in strict mode. +tests/cases/compiler/b.js(3,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. +tests/cases/compiler/b.js(6,13): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/c.js(1,12): error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode. +tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode. +tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in strict mode. +tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. + + +==== tests/cases/compiler/a.js (8 errors) ==== + "use strict"; + var a = { + a: "hello", // error + ~ +!!! error TS2300: Duplicate identifier 'a'. + b: 10, + a: 10 // error + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode. + ~ +!!! error TS2300: Duplicate identifier 'a'. + }; + var let = 10; // error + ~~~ +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode + delete a; // error + ~ +!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + try { + } catch (eval) { // error + ~~~~ +!!! error TS1100: Invalid use of 'eval' in strict mode. + } + function arguments() { // error + ~~~~~~~~~ +!!! error TS1100: Invalid use of 'arguments' in strict mode. + } + + with (a) { + ~~~~ +!!! error TS1101: 'with' statements are not allowed in strict mode. + b = 10; + } + +==== tests/cases/compiler/b.js (2 errors) ==== + // this is not in strict mode but class definitions are always in strict mode + class c { + a(eval) { //error + ~~~~ +!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. + } + method() { + var let = 10; // error + ~~~ +!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. + } + } + +==== tests/cases/compiler/c.js (2 errors) ==== + export var let = 10; // external modules are automatically in strict mode + ~~~ +!!! error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode. + var eval = function () { + ~~~~ +!!! error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode. + }; + +==== tests/cases/compiler/d.js (2 errors) ==== + "use strict"; + var x = 009; // error + ~~ +!!! error TS1121: Octal literals are not allowed in strict mode. + ~ +!!! error TS1005: ',' expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index f537941c55c..3be5f99823a 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,9 +1,12 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. +tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -==== tests/cases/compiler/a.js (1 errors) ==== +==== tests/cases/compiler/a.js (2 errors) ==== export = b; ~~~~~~~~~~~ +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. + ~~~~~~~~~~~ !!! error TS8003: 'export=' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt b/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt new file mode 100644 index 00000000000..58111c777f1 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt @@ -0,0 +1,19 @@ +tests/cases/compiler/moduleA/a.js(2,17): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/b.ts' is not a module. Please contact the package author to update the package definition. + + +==== tests/cases/compiler/moduleA/a.js (1 errors) ==== + + import {a} from "b"; + ~~~ +!!! error TS2656: Exported external package typings file 'b.ts' is not a module. Please contact the package author to update the package definition. + a++; + import {c} from "c"; + c++; + +==== tests/cases/compiler/node_modules/b.ts (0 errors) ==== + var a = 10; + +==== tests/cases/compiler/node_modules/c.js (0 errors) ==== + exports.a = 10; + c = 10; + \ No newline at end of file diff --git a/tests/baselines/reference/letAsIdentifier2.js b/tests/baselines/reference/letAsIdentifier2.js new file mode 100644 index 00000000000..62c8461bfc8 --- /dev/null +++ b/tests/baselines/reference/letAsIdentifier2.js @@ -0,0 +1,6 @@ +//// [letAsIdentifier2.ts] + +function let() {} + +//// [letAsIdentifier2.js] +function let() { } diff --git a/tests/baselines/reference/letAsIdentifier2.symbols b/tests/baselines/reference/letAsIdentifier2.symbols new file mode 100644 index 00000000000..211aae05316 --- /dev/null +++ b/tests/baselines/reference/letAsIdentifier2.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/letAsIdentifier2.ts === + +function let() {} +>let : Symbol(let, Decl(letAsIdentifier2.ts, 0, 0)) + diff --git a/tests/baselines/reference/letAsIdentifier2.types b/tests/baselines/reference/letAsIdentifier2.types new file mode 100644 index 00000000000..dc1416fdae9 --- /dev/null +++ b/tests/baselines/reference/letAsIdentifier2.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/letAsIdentifier2.ts === + +function let() {} +>let : () => void + diff --git a/tests/baselines/reference/letInConstDeclarations_ES5.errors.txt b/tests/baselines/reference/letInConstDeclarations_ES5.errors.txt new file mode 100644 index 00000000000..8b694c35dbb --- /dev/null +++ b/tests/baselines/reference/letInConstDeclarations_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/letInConstDeclarations_ES5.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInConstDeclarations_ES5.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInConstDeclarations_ES5.ts (2 errors) ==== + + // All use of let in const declaration should be an error + const x = 50, let = 5; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + const x = 10, let = 20; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/letInConstDeclarations_ES5.js b/tests/baselines/reference/letInConstDeclarations_ES5.js new file mode 100644 index 00000000000..f76d49765f0 --- /dev/null +++ b/tests/baselines/reference/letInConstDeclarations_ES5.js @@ -0,0 +1,15 @@ +//// [letInConstDeclarations_ES5.ts] + +// All use of let in const declaration should be an error +const x = 50, let = 5; + +{ + const x = 10, let = 20; +} + +//// [letInConstDeclarations_ES5.js] +// All use of let in const declaration should be an error +var x = 50, let = 5; +{ + var x_1 = 10, let_1 = 20; +} diff --git a/tests/baselines/reference/letInConstDeclarations_ES6.errors.txt b/tests/baselines/reference/letInConstDeclarations_ES6.errors.txt new file mode 100644 index 00000000000..d29f78be014 --- /dev/null +++ b/tests/baselines/reference/letInConstDeclarations_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/letInConstDeclarations_ES6.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInConstDeclarations_ES6.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInConstDeclarations_ES6.ts (2 errors) ==== + + // All use of let in const declaration should be an error + const x = 50, let = 5; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + const x = 10, let = 20; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/letInConstDeclarations_ES6.js b/tests/baselines/reference/letInConstDeclarations_ES6.js new file mode 100644 index 00000000000..f209ef1dede --- /dev/null +++ b/tests/baselines/reference/letInConstDeclarations_ES6.js @@ -0,0 +1,15 @@ +//// [letInConstDeclarations_ES6.ts] + +// All use of let in const declaration should be an error +const x = 50, let = 5; + +{ + const x = 10, let = 20; +} + +//// [letInConstDeclarations_ES6.js] +// All use of let in const declaration should be an error +const x = 50, let = 5; +{ + const x = 10, let = 20; +} diff --git a/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.errors.txt b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.errors.txt new file mode 100644 index 00000000000..e335a9652f4 --- /dev/null +++ b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(3,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(5,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(7,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(9,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(12,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(14,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(16,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts(18,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts (8 errors) ==== + + // Should be an error + for (let let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (let let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + for (let let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (let let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } + + \ No newline at end of file diff --git a/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.js b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.js new file mode 100644 index 00000000000..4c467176492 --- /dev/null +++ b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES5.js @@ -0,0 +1,43 @@ +//// [letInLetConstDeclOfForOfAndForIn_ES5.ts] + +// Should be an error +for (let let of [1,2,3]) {} + +for (const let of [1,2,3]) {} + +for (let let in [1,2,3]) {} + +for (const let in [1,2,3]) {} + +{ + for (let let of [1,2,3]) {} + + for (const let of [1,2,3]) {} + + for (let let in [1,2,3]) {} + + for (const let in [1,2,3]) {} +} + + + +//// [letInLetConstDeclOfForOfAndForIn_ES5.js] +// Should be an error +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var let = _a[_i]; +} +for (var _b = 0, _c = [1, 2, 3]; _b < _c.length; _b++) { + var let = _c[_b]; +} +for (var let in [1, 2, 3]) { } +for (var let in [1, 2, 3]) { } +{ + for (var _d = 0, _e = [1, 2, 3]; _d < _e.length; _d++) { + var let = _e[_d]; + } + for (var _f = 0, _g = [1, 2, 3]; _f < _g.length; _f++) { + var let = _g[_f]; + } + for (var let in [1, 2, 3]) { } + for (var let in [1, 2, 3]) { } +} diff --git a/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.errors.txt b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.errors.txt new file mode 100644 index 00000000000..1a5af892b74 --- /dev/null +++ b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.errors.txt @@ -0,0 +1,48 @@ +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(3,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(5,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(7,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(9,12): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(12,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(14,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(16,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts(18,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts (8 errors) ==== + + // Should be an error + for (let let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (let let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + for (let let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let of [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (let let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + for (const let in [1,2,3]) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } + + \ No newline at end of file diff --git a/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.js b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.js new file mode 100644 index 00000000000..583dc936871 --- /dev/null +++ b/tests/baselines/reference/letInLetConstDeclOfForOfAndForIn_ES6.js @@ -0,0 +1,35 @@ +//// [letInLetConstDeclOfForOfAndForIn_ES6.ts] + +// Should be an error +for (let let of [1,2,3]) {} + +for (const let of [1,2,3]) {} + +for (let let in [1,2,3]) {} + +for (const let in [1,2,3]) {} + +{ + for (let let of [1,2,3]) {} + + for (const let of [1,2,3]) {} + + for (let let in [1,2,3]) {} + + for (const let in [1,2,3]) {} +} + + + +//// [letInLetConstDeclOfForOfAndForIn_ES6.js] +// Should be an error +for (let let of [1, 2, 3]) { } +for (const let of [1, 2, 3]) { } +for (let let in [1, 2, 3]) { } +for (const let in [1, 2, 3]) { } +{ + for (let let of [1, 2, 3]) { } + for (const let of [1, 2, 3]) { } + for (let let in [1, 2, 3]) { } + for (const let in [1, 2, 3]) { } +} diff --git a/tests/baselines/reference/letInLetDeclarations_ES5.errors.txt b/tests/baselines/reference/letInLetDeclarations_ES5.errors.txt new file mode 100644 index 00000000000..73f824dd7de --- /dev/null +++ b/tests/baselines/reference/letInLetDeclarations_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/letInLetDeclarations_ES5.ts(3,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetDeclarations_ES5.ts(6,17): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInLetDeclarations_ES5.ts (2 errors) ==== + + // All use of let in const declaration should be an error + let x = 50, let = 5; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + let x = 10, let = 20; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/letInLetDeclarations_ES5.js b/tests/baselines/reference/letInLetDeclarations_ES5.js new file mode 100644 index 00000000000..0b7f02150a4 --- /dev/null +++ b/tests/baselines/reference/letInLetDeclarations_ES5.js @@ -0,0 +1,15 @@ +//// [letInLetDeclarations_ES5.ts] + +// All use of let in const declaration should be an error +let x = 50, let = 5; + +{ + let x = 10, let = 20; +} + +//// [letInLetDeclarations_ES5.js] +// All use of let in const declaration should be an error +var x = 50, let = 5; +{ + var x_1 = 10, let_1 = 20; +} diff --git a/tests/baselines/reference/letInLetDeclarations_ES6.errors.txt b/tests/baselines/reference/letInLetDeclarations_ES6.errors.txt new file mode 100644 index 00000000000..0fe1aa882e9 --- /dev/null +++ b/tests/baselines/reference/letInLetDeclarations_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/letInLetDeclarations_ES6.ts(3,13): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetDeclarations_ES6.ts(6,17): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/compiler/letInLetDeclarations_ES6.ts (2 errors) ==== + + // All use of let in const declaration should be an error + let x = 50, let = 5; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + { + let x = 10, let = 20; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/letInLetDeclarations_ES6.js b/tests/baselines/reference/letInLetDeclarations_ES6.js new file mode 100644 index 00000000000..7c4385cd4d9 --- /dev/null +++ b/tests/baselines/reference/letInLetDeclarations_ES6.js @@ -0,0 +1,15 @@ +//// [letInLetDeclarations_ES6.ts] + +// All use of let in const declaration should be an error +let x = 50, let = 5; + +{ + let x = 10, let = 20; +} + +//// [letInLetDeclarations_ES6.js] +// All use of let in const declaration should be an error +let x = 50, let = 5; +{ + let x = 10, let = 20; +} diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt deleted file mode 100644 index fbcee276583..00000000000 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. - - -==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== - { - let let = 1; // should error - ~~~ -!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. - for (let let in []) { } // should error - ~~~ -!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. - } - { - const let = 1; // should error - ~~~ -!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. - } - { - function let() { // should be ok - } - } \ No newline at end of file diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.js b/tests/baselines/reference/letInLetOrConstDeclarations.js deleted file mode 100644 index ee23abc4e4f..00000000000 --- a/tests/baselines/reference/letInLetOrConstDeclarations.js +++ /dev/null @@ -1,25 +0,0 @@ -//// [letInLetOrConstDeclarations.ts] -{ - let let = 1; // should error - for (let let in []) { } // should error -} -{ - const let = 1; // should error -} -{ - function let() { // should be ok - } -} - -//// [letInLetOrConstDeclarations.js] -{ - let let = 1; // should error - for (let let in []) { } // should error -} -{ - const let = 1; // should error -} -{ - function let() { - } -} diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES5.js b/tests/baselines/reference/letInVarDeclOfForIn_ES5.js new file mode 100644 index 00000000000..2cef7610199 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES5.js @@ -0,0 +1,16 @@ +//// [letInVarDeclOfForIn_ES5.ts] + +// should not be an error +for (var let in [1,2,3]) {} + +{ + for (var let in [1,2,3]) {} +} + + +//// [letInVarDeclOfForIn_ES5.js] +// should not be an error +for (var let in [1, 2, 3]) { } +{ + for (var let in [1, 2, 3]) { } +} diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES5.symbols b/tests/baselines/reference/letInVarDeclOfForIn_ES5.symbols new file mode 100644 index 00000000000..cbfd0f58086 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/letInVarDeclOfForIn_ES5.ts === + +// should not be an error +for (var let in [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForIn_ES5.ts, 2, 8), Decl(letInVarDeclOfForIn_ES5.ts, 5, 9)) + +{ + for (var let in [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForIn_ES5.ts, 2, 8), Decl(letInVarDeclOfForIn_ES5.ts, 5, 9)) +} + diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES5.types b/tests/baselines/reference/letInVarDeclOfForIn_ES5.types new file mode 100644 index 00000000000..ac1ca3f27c9 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES5.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/letInVarDeclOfForIn_ES5.ts === + +// should not be an error +for (var let in [1,2,3]) {} +>let : any +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +{ + for (var let in [1,2,3]) {} +>let : any +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number +} + diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES6.js b/tests/baselines/reference/letInVarDeclOfForIn_ES6.js new file mode 100644 index 00000000000..1cf6850f588 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES6.js @@ -0,0 +1,16 @@ +//// [letInVarDeclOfForIn_ES6.ts] + +// should not be an error +for (var let in [1,2,3]) {} + +{ + for (var let in [1,2,3]) {} +} + + +//// [letInVarDeclOfForIn_ES6.js] +// should not be an error +for (var let in [1, 2, 3]) { } +{ + for (var let in [1, 2, 3]) { } +} diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES6.symbols b/tests/baselines/reference/letInVarDeclOfForIn_ES6.symbols new file mode 100644 index 00000000000..3b3e68e3040 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/letInVarDeclOfForIn_ES6.ts === + +// should not be an error +for (var let in [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForIn_ES6.ts, 2, 8), Decl(letInVarDeclOfForIn_ES6.ts, 5, 9)) + +{ + for (var let in [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForIn_ES6.ts, 2, 8), Decl(letInVarDeclOfForIn_ES6.ts, 5, 9)) +} + diff --git a/tests/baselines/reference/letInVarDeclOfForIn_ES6.types b/tests/baselines/reference/letInVarDeclOfForIn_ES6.types new file mode 100644 index 00000000000..3c508bd8e2b --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForIn_ES6.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/letInVarDeclOfForIn_ES6.ts === + +// should not be an error +for (var let in [1,2,3]) {} +>let : any +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +{ + for (var let in [1,2,3]) {} +>let : any +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number +} + diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES5.js b/tests/baselines/reference/letInVarDeclOfForOf_ES5.js new file mode 100644 index 00000000000..cdc374fbea0 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES5.js @@ -0,0 +1,20 @@ +//// [letInVarDeclOfForOf_ES5.ts] + +// should not be an error +for (var let of [1,2,3]) {} + +{ + for (var let of [1,2,3]) {} +} + + +//// [letInVarDeclOfForOf_ES5.js] +// should not be an error +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var let = _a[_i]; +} +{ + for (var _b = 0, _c = [1, 2, 3]; _b < _c.length; _b++) { + var let = _c[_b]; + } +} diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES5.symbols b/tests/baselines/reference/letInVarDeclOfForOf_ES5.symbols new file mode 100644 index 00000000000..f5411cfca2d --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/letInVarDeclOfForOf_ES5.ts === + +// should not be an error +for (var let of [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForOf_ES5.ts, 2, 8), Decl(letInVarDeclOfForOf_ES5.ts, 5, 9)) + +{ + for (var let of [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForOf_ES5.ts, 2, 8), Decl(letInVarDeclOfForOf_ES5.ts, 5, 9)) +} + diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES5.types b/tests/baselines/reference/letInVarDeclOfForOf_ES5.types new file mode 100644 index 00000000000..a1000df8bed --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES5.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/letInVarDeclOfForOf_ES5.ts === + +// should not be an error +for (var let of [1,2,3]) {} +>let : number +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +{ + for (var let of [1,2,3]) {} +>let : number +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number +} + diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES6.js b/tests/baselines/reference/letInVarDeclOfForOf_ES6.js new file mode 100644 index 00000000000..fca365c4b0d --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES6.js @@ -0,0 +1,16 @@ +//// [letInVarDeclOfForOf_ES6.ts] + +// should not be an error +for (var let of [1,2,3]) {} + +{ + for (var let of [1,2,3]) {} +} + + +//// [letInVarDeclOfForOf_ES6.js] +// should not be an error +for (var let of [1, 2, 3]) { } +{ + for (var let of [1, 2, 3]) { } +} diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES6.symbols b/tests/baselines/reference/letInVarDeclOfForOf_ES6.symbols new file mode 100644 index 00000000000..d4c14eff0b0 --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/letInVarDeclOfForOf_ES6.ts === + +// should not be an error +for (var let of [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForOf_ES6.ts, 2, 8), Decl(letInVarDeclOfForOf_ES6.ts, 5, 9)) + +{ + for (var let of [1,2,3]) {} +>let : Symbol(let, Decl(letInVarDeclOfForOf_ES6.ts, 2, 8), Decl(letInVarDeclOfForOf_ES6.ts, 5, 9)) +} + diff --git a/tests/baselines/reference/letInVarDeclOfForOf_ES6.types b/tests/baselines/reference/letInVarDeclOfForOf_ES6.types new file mode 100644 index 00000000000..1515895feda --- /dev/null +++ b/tests/baselines/reference/letInVarDeclOfForOf_ES6.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/letInVarDeclOfForOf_ES6.ts === + +// should not be an error +for (var let of [1,2,3]) {} +>let : number +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number + +{ + for (var let of [1,2,3]) {} +>let : number +>[1,2,3] : number[] +>1 : number +>2 : number +>3 : number +} + diff --git a/tests/baselines/reference/missingSemicolonInModuleSpecifier.js b/tests/baselines/reference/missingSemicolonInModuleSpecifier.js new file mode 100644 index 00000000000..069849ffb83 --- /dev/null +++ b/tests/baselines/reference/missingSemicolonInModuleSpecifier.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/missingSemicolonInModuleSpecifier.ts] //// + +//// [a.ts] + +export const x = 1; + +//// [b.ts] +import {x} from "./a" +(function() { return 1; }()) + +//// [a.js] +"use strict"; +exports.x = 1; +//// [b.js] +"use strict"; +(function () { return 1; }()); diff --git a/tests/baselines/reference/missingSemicolonInModuleSpecifier.symbols b/tests/baselines/reference/missingSemicolonInModuleSpecifier.symbols new file mode 100644 index 00000000000..695779002ac --- /dev/null +++ b/tests/baselines/reference/missingSemicolonInModuleSpecifier.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/a.ts === + +export const x = 1; +>x : Symbol(x, Decl(a.ts, 1, 12)) + +=== tests/cases/compiler/b.ts === +import {x} from "./a" +>x : Symbol(x, Decl(b.ts, 0, 8)) + +(function() { return 1; }()) diff --git a/tests/baselines/reference/missingSemicolonInModuleSpecifier.types b/tests/baselines/reference/missingSemicolonInModuleSpecifier.types new file mode 100644 index 00000000000..b68c68b62e0 --- /dev/null +++ b/tests/baselines/reference/missingSemicolonInModuleSpecifier.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/a.ts === + +export const x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/b.ts === +import {x} from "./a" +>x : number + +(function() { return 1; }()) +>(function() { return 1; }()) : number +>function() { return 1; }() : number +>function() { return 1; } : () => number +>1 : number + diff --git a/tests/baselines/reference/moduleDuplicateIdentifiers.errors.txt b/tests/baselines/reference/moduleDuplicateIdentifiers.errors.txt new file mode 100644 index 00000000000..22bd6641a83 --- /dev/null +++ b/tests/baselines/reference/moduleDuplicateIdentifiers.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/moduleDuplicateIdentifiers.ts(1,12): error TS2323: Cannot redeclare exported variable 'Foo'. +tests/cases/compiler/moduleDuplicateIdentifiers.ts(2,12): error TS2323: Cannot redeclare exported variable 'Foo'. +tests/cases/compiler/moduleDuplicateIdentifiers.ts(20,14): error TS2300: Duplicate identifier 'Kettle'. +tests/cases/compiler/moduleDuplicateIdentifiers.ts(24,14): error TS2300: Duplicate identifier 'Kettle'. + + +==== tests/cases/compiler/moduleDuplicateIdentifiers.ts (4 errors) ==== + export var Foo = 2; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'Foo'. + export var Foo = 42; // Should error + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'Foo'. + + export interface Bar { + _brand1: any; + } + + export interface Bar { // Shouldn't error + _brand2: any; + } + + export namespace FooBar { + export var member1 = 2; + } + + export namespace FooBar { // Shouldn't error + export var member2 = 42; + } + + export class Kettle { + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Kettle'. + member1 = 2; + } + + export class Kettle { // Should error + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Kettle'. + member2 = 42; + } + + export var Pot = 2; + Pot = 42; // Shouldn't error + + export enum Utensils { + Spoon, + Fork, + Knife + } + + export enum Utensils { // Shouldn't error + Spork = 3 + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleDuplicateIdentifiers.js b/tests/baselines/reference/moduleDuplicateIdentifiers.js new file mode 100644 index 00000000000..842d1587911 --- /dev/null +++ b/tests/baselines/reference/moduleDuplicateIdentifiers.js @@ -0,0 +1,80 @@ +//// [moduleDuplicateIdentifiers.ts] +export var Foo = 2; +export var Foo = 42; // Should error + +export interface Bar { + _brand1: any; +} + +export interface Bar { // Shouldn't error + _brand2: any; +} + +export namespace FooBar { + export var member1 = 2; +} + +export namespace FooBar { // Shouldn't error + export var member2 = 42; +} + +export class Kettle { + member1 = 2; +} + +export class Kettle { // Should error + member2 = 42; +} + +export var Pot = 2; +Pot = 42; // Shouldn't error + +export enum Utensils { + Spoon, + Fork, + Knife +} + +export enum Utensils { // Shouldn't error + Spork = 3 +} + + +//// [moduleDuplicateIdentifiers.js] +"use strict"; +exports.Foo = 2; +exports.Foo = 42; // Should error +var FooBar; +(function (FooBar) { + FooBar.member1 = 2; +})(FooBar = exports.FooBar || (exports.FooBar = {})); +var FooBar; +(function (FooBar) { + FooBar.member2 = 42; +})(FooBar = exports.FooBar || (exports.FooBar = {})); +var Kettle = (function () { + function Kettle() { + this.member1 = 2; + } + return Kettle; +})(); +exports.Kettle = Kettle; +var Kettle = (function () { + function Kettle() { + this.member2 = 42; + } + return Kettle; +})(); +exports.Kettle = Kettle; +exports.Pot = 2; +exports.Pot = 42; // Shouldn't error +(function (Utensils) { + Utensils[Utensils["Spoon"] = 0] = "Spoon"; + Utensils[Utensils["Fork"] = 1] = "Fork"; + Utensils[Utensils["Knife"] = 2] = "Knife"; +})(exports.Utensils || (exports.Utensils = {})); +var Utensils = exports.Utensils; +(function (Utensils) { + Utensils[Utensils["Spork"] = 3] = "Spork"; +})(exports.Utensils || (exports.Utensils = {})); +var Utensils = exports.Utensils; diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js new file mode 100644 index 00000000000..4061a32b49f --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/moduleSameValueDuplicateExportedBindings1.ts] //// + +//// [a.ts] +export * from "./b"; +export * from "./c"; + +//// [b.ts] +export * from "./c"; + +//// [c.ts] +export var foo = 42; + +//// [c.js] +"use strict"; +exports.foo = 42; +//// [b.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +__export(require("./c")); +//// [a.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +__export(require("./b")); +__export(require("./c")); diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.symbols b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.symbols new file mode 100644 index 00000000000..2f8bba9b6ab --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/a.ts === +export * from "./b"; +No type information for this code.export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/b.ts === +export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/c.ts === +export var foo = 42; +>foo : Symbol(foo, Decl(c.ts, 0, 10)) + diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.types b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.types new file mode 100644 index 00000000000..57be71c802b --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings1.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/a.ts === +export * from "./b"; +No type information for this code.export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/b.ts === +export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/c.ts === +export var foo = 42; +>foo : number +>42 : number + diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js new file mode 100644 index 00000000000..99a09af149a --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.js @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/moduleSameValueDuplicateExportedBindings2.ts] //// + +//// [a.ts] +export * from "./b"; +export * from "./c"; + +//// [b.ts] +export {Animals} from "./c"; + +//// [c.ts] +export enum Animals { + Cat, + Dog +}; + +//// [c.js] +"use strict"; +(function (Animals) { + Animals[Animals["Cat"] = 0] = "Cat"; + Animals[Animals["Dog"] = 1] = "Dog"; +})(exports.Animals || (exports.Animals = {})); +var Animals = exports.Animals; +; +//// [b.js] +"use strict"; +var c_1 = require("./c"); +exports.Animals = c_1.Animals; +//// [a.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +__export(require("./b")); +__export(require("./c")); diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.symbols b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.symbols new file mode 100644 index 00000000000..390fd1b0bed --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/a.ts === +export * from "./b"; +No type information for this code.export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/b.ts === +export {Animals} from "./c"; +>Animals : Symbol(Animals, Decl(b.ts, 0, 8)) + +=== tests/cases/compiler/c.ts === +export enum Animals { +>Animals : Symbol(Animals, Decl(c.ts, 0, 0)) + + Cat, +>Cat : Symbol(Animals.Cat, Decl(c.ts, 0, 21)) + + Dog +>Dog : Symbol(Animals.Dog, Decl(c.ts, 1, 5)) + +}; diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types new file mode 100644 index 00000000000..600b0d946c6 --- /dev/null +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/a.ts === +export * from "./b"; +No type information for this code.export * from "./c"; +No type information for this code. +No type information for this code.=== tests/cases/compiler/b.ts === +export {Animals} from "./c"; +>Animals : typeof Animals + +=== tests/cases/compiler/c.ts === +export enum Animals { +>Animals : Animals + + Cat, +>Cat : Animals + + Dog +>Dog : Animals + +}; diff --git a/tests/baselines/reference/multipleDefaultExports02.errors.txt b/tests/baselines/reference/multipleDefaultExports02.errors.txt index 235f8f7c3e3..3f27db47c94 100644 --- a/tests/baselines/reference/multipleDefaultExports02.errors.txt +++ b/tests/baselines/reference/multipleDefaultExports02.errors.txt @@ -1,17 +1,23 @@ +tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2393: Duplicate function implementation. -==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ==== +==== tests/cases/conformance/es6/modules/m1.ts (4 errors) ==== export default function foo() { ~~~ +!!! error TS2323: Cannot redeclare exported variable 'default'. + ~~~ !!! error TS2393: Duplicate function implementation. } export default function bar() { ~~~ +!!! error TS2323: Cannot redeclare exported variable 'default'. + ~~~ !!! error TS2393: Duplicate function implementation. } diff --git a/tests/baselines/reference/multipleDefaultExports04.errors.txt b/tests/baselines/reference/multipleDefaultExports04.errors.txt index e67659f6b9f..bf137e3cc17 100644 --- a/tests/baselines/reference/multipleDefaultExports04.errors.txt +++ b/tests/baselines/reference/multipleDefaultExports04.errors.txt @@ -1,15 +1,21 @@ +tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(2,25): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(2,25): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(5,25): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(5,25): error TS2393: Duplicate function implementation. -==== tests/cases/conformance/es6/modules/multipleDefaultExports04.ts (2 errors) ==== +==== tests/cases/conformance/es6/modules/multipleDefaultExports04.ts (4 errors) ==== export default function f() { ~ +!!! error TS2323: Cannot redeclare exported variable 'default'. + ~ !!! error TS2393: Duplicate function implementation. } export default function f() { ~ +!!! error TS2323: Cannot redeclare exported variable 'default'. + ~ !!! error TS2393: Duplicate function implementation. } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 30b40f431a7..e296f2113fb 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. + Type 'Object' provides no match for the signature '(): void' tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. + Type 'Object' provides no match for the signature '(): void' ==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf i = f; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' var a: { (): void @@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf f = a; a = f; ~ -!!! error TS2322: Type 'Object' is not assignable to type '() => void'. \ No newline at end of file +!!! error TS2322: Type 'Object' is not assignable to type '() => void'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 0faba936715..227ccc99603 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. + Type 'Object' provides no match for the signature 'new (): any' tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'. + Type 'Object' provides no match for the signature 'new (): any' ==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb i = f; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var a: { new(): any @@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb f = a; a = f; ~ -!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'. \ No newline at end of file +!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'. +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' \ No newline at end of file diff --git a/tests/baselines/reference/outFilerootDirModuleNamesAmd.js b/tests/baselines/reference/outFilerootDirModuleNamesAmd.js new file mode 100644 index 00000000000..5b99f76a5b9 --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesAmd.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts] //// + +//// [a.ts] +import foo from "./b"; +export default class Foo {} +foo(); + +//// [b.ts] +import Foo from "./a"; +export default function foo() { new Foo(); } + + +//// [output.js] +define("b", ["require", "exports", "a"], function (require, exports, a_1) { + "use strict"; + function foo() { new a_1.default(); } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = foo; +}); +define("a", ["require", "exports", "b"], function (require, exports, b_1) { + "use strict"; + class Foo { + } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Foo; + b_1.default(); +}); diff --git a/tests/baselines/reference/outFilerootDirModuleNamesAmd.symbols b/tests/baselines/reference/outFilerootDirModuleNamesAmd.symbols new file mode 100644 index 00000000000..fea742c20ca --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesAmd.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts === +import foo from "./b"; +>foo : Symbol(foo, Decl(a.ts, 0, 6)) + +export default class Foo {} +>Foo : Symbol(Foo, Decl(a.ts, 0, 22)) + +foo(); +>foo : Symbol(foo, Decl(a.ts, 0, 6)) + +=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts === +import Foo from "./a"; +>Foo : Symbol(Foo, Decl(b.ts, 0, 6)) + +export default function foo() { new Foo(); } +>foo : Symbol(foo, Decl(b.ts, 0, 22)) +>Foo : Symbol(Foo, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/outFilerootDirModuleNamesAmd.types b/tests/baselines/reference/outFilerootDirModuleNamesAmd.types new file mode 100644 index 00000000000..617096fd0dd --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesAmd.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts === +import foo from "./b"; +>foo : () => void + +export default class Foo {} +>Foo : Foo + +foo(); +>foo() : void +>foo : () => void + +=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts === +import Foo from "./a"; +>Foo : typeof Foo + +export default function foo() { new Foo(); } +>foo : () => void +>new Foo() : Foo +>Foo : typeof Foo + diff --git a/tests/baselines/reference/outFilerootDirModuleNamesSystem.js b/tests/baselines/reference/outFilerootDirModuleNamesSystem.js new file mode 100644 index 00000000000..298ad52689f --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesSystem.js @@ -0,0 +1,44 @@ +//// [tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts] //// + +//// [a.ts] +import foo from "./b"; +export default class Foo {} +foo(); + +//// [b.ts] +import Foo from "./a"; +export default function foo() { new Foo(); } + + +//// [output.js] +System.register("b", ["a"], function(exports_1) { + "use strict"; + var a_1; + function foo() { new a_1.default(); } + exports_1("default", foo); + return { + setters:[ + function (a_1_1) { + a_1 = a_1_1; + }], + execute: function() { + } + } +}); +System.register("a", ["b"], function(exports_2) { + "use strict"; + var b_1; + var Foo; + return { + setters:[ + function (b_1_1) { + b_1 = b_1_1; + }], + execute: function() { + class Foo { + } + exports_2("default", Foo); + b_1.default(); + } + } +}); diff --git a/tests/baselines/reference/outFilerootDirModuleNamesSystem.symbols b/tests/baselines/reference/outFilerootDirModuleNamesSystem.symbols new file mode 100644 index 00000000000..535c037f5af --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesSystem.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts === +import foo from "./b"; +>foo : Symbol(foo, Decl(a.ts, 0, 6)) + +export default class Foo {} +>Foo : Symbol(Foo, Decl(a.ts, 0, 22)) + +foo(); +>foo : Symbol(foo, Decl(a.ts, 0, 6)) + +=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts === +import Foo from "./a"; +>Foo : Symbol(Foo, Decl(b.ts, 0, 6)) + +export default function foo() { new Foo(); } +>foo : Symbol(foo, Decl(b.ts, 0, 22)) +>Foo : Symbol(Foo, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/outFilerootDirModuleNamesSystem.types b/tests/baselines/reference/outFilerootDirModuleNamesSystem.types new file mode 100644 index 00000000000..2f0e23c2e81 --- /dev/null +++ b/tests/baselines/reference/outFilerootDirModuleNamesSystem.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts === +import foo from "./b"; +>foo : () => void + +export default class Foo {} +>Foo : Foo + +foo(); +>foo() : void +>foo : () => void + +=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts === +import Foo from "./a"; +>Foo : typeof Foo + +export default function foo() { new Foo(); } +>foo : () => void +>new Foo() : Foo +>Foo : typeof Foo + diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index cfcd1bad9b8..6408511f2ec 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +define("ref/a", ["require", "exports"], function (require, exports) { "use strict"; var A = (function () { function A() { @@ -23,7 +23,7 @@ define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, })(); exports.A = A; }); -define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { "use strict"; var B = (function (_super) { __extends(B, _super); @@ -37,12 +37,12 @@ define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/re //# sourceMappingURL=all.js.map //// [all.d.ts] -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index 0b5988e4d3a..b8fe92f082c 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -13,7 +13,7 @@ sourceFile:tests/cases/compiler/ref/a.ts >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; ->>>define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +>>>define("ref/a", ["require", "exports"], function (require, exports) { >>> "use strict"; >>> var A = (function () { 1 >^^^^ @@ -79,7 +79,7 @@ emittedFile:all.js sourceFile:tests/cases/compiler/b.ts ------------------------------------------------------------------- >>>}); ->>>define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +>>>define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { >>> "use strict"; >>> var B = (function (_super) { 1 >^^^^ diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js b/tests/baselines/reference/outModuleConcatCommonjs.js index c859d6c63ef..0dbaee88004 100644 --- a/tests/baselines/reference/outModuleConcatCommonjs.js +++ b/tests/baselines/reference/outModuleConcatCommonjs.js @@ -20,12 +20,12 @@ var __extends = (this && this.__extends) || function (d, b) { //# sourceMappingURL=all.js.map //// [all.d.ts] -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleConcatES6.js b/tests/baselines/reference/outModuleConcatES6.js index 037d52eb410..45e58d2d773 100644 --- a/tests/baselines/reference/outModuleConcatES6.js +++ b/tests/baselines/reference/outModuleConcatES6.js @@ -15,12 +15,12 @@ export class B extends A { } //# sourceMappingURL=all.js.map //// [all.d.ts] -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index 688221ca5b2..5ac811ea9a0 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -System.register("tests/cases/compiler/ref/a", [], function(exports_1) { +System.register("ref/a", [], function(exports_1) { "use strict"; var A; return { @@ -29,7 +29,7 @@ System.register("tests/cases/compiler/ref/a", [], function(exports_1) { } } }); -System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) { +System.register("b", ["ref/a"], function(exports_2) { "use strict"; var a_1; var B; @@ -53,12 +53,12 @@ System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], functi //# sourceMappingURL=all.js.map //// [all.d.ts] -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 639fe3dcc89..88ff65a88a3 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -13,7 +13,7 @@ sourceFile:tests/cases/compiler/ref/a.ts >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; ->>>System.register("tests/cases/compiler/ref/a", [], function(exports_1) { +>>>System.register("ref/a", [], function(exports_1) { >>> "use strict"; >>> var A; >>> return { @@ -82,7 +82,7 @@ sourceFile:tests/cases/compiler/b.ts >>> } >>> } >>>}); ->>>System.register("tests/cases/compiler/b", ["tests/cases/compiler/ref/a"], function(exports_2) { +>>>System.register("b", ["ref/a"], function(exports_2) { >>> "use strict"; >>> var a_1; >>> var B; diff --git a/tests/baselines/reference/outModuleConcatUmd.js b/tests/baselines/reference/outModuleConcatUmd.js index c4aad41c6ed..6c60a13c892 100644 --- a/tests/baselines/reference/outModuleConcatUmd.js +++ b/tests/baselines/reference/outModuleConcatUmd.js @@ -20,12 +20,12 @@ var __extends = (this && this.__extends) || function (d, b) { //# sourceMappingURL=all.js.map //// [all.d.ts] -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index 88cb9c9ed38..0aabf2b4835 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -42,7 +42,7 @@ var Foo = (function () { } return Foo; })(); -define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +define("ref/a", ["require", "exports"], function (require, exports) { "use strict"; /// var A = (function () { @@ -52,7 +52,7 @@ define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, })(); exports.A = A; }); -define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { "use strict"; var B = (function (_super) { __extends(B, _super); @@ -71,13 +71,13 @@ declare class Foo { member: Bar; } declare var GlobalFoo: Foo; -declare module "tests/cases/compiler/ref/a" { +declare module "ref/a" { export class A { member: typeof GlobalFoo; } } -declare module "tests/cases/compiler/b" { - import { A } from "tests/cases/compiler/ref/a"; +declare module "b" { + import { A } from "ref/a"; export class B extends A { } } diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 1d0724543ca..b80246ed9f7 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -58,7 +58,7 @@ sourceFile:tests/cases/compiler/ref/b.ts 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > @@ -74,7 +74,7 @@ sourceFile:tests/cases/compiler/ref/b.ts emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- ->>>define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) { +>>>define("ref/a", ["require", "exports"], function (require, exports) { >>> "use strict"; >>> /// 1->^^^^ @@ -155,7 +155,7 @@ emittedFile:all.js sourceFile:tests/cases/compiler/b.ts ------------------------------------------------------------------- >>>}); ->>>define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) { +>>>define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { >>> "use strict"; >>> var B = (function (_super) { 1 >^^^^ diff --git a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt index 4870106f474..4b502f145a6 100644 --- a/tests/baselines/reference/overloadOnConstInheritance2.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance2.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. Types of property 'addEventListener' are incompatible. Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. + Type '(x: "bar") => string' provides no match for the signature '(x: string): any' tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -14,6 +15,7 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Speciali !!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'addEventListener' are incompatible. !!! error TS2430: Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'. +!!! error TS2430: Type '(x: "bar") => string' provides no match for the signature '(x: string): any' addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. diff --git a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt index b338f9795d7..6d9f9b00692 100644 --- a/tests/baselines/reference/overloadOnConstInheritance3.errors.txt +++ b/tests/baselines/reference/overloadOnConstInheritance3.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. Types of property 'addEventListener' are incompatible. Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. + Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any' tests/cases/compiler/overloadOnConstInheritance3.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -14,6 +15,7 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Speciali !!! error TS2430: Interface 'Deriver' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'addEventListener' are incompatible. !!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'. +!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any' // shouldn't need to redeclare the string overload addEventListener(x: 'bar'): string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/parseTypes.errors.txt b/tests/baselines/reference/parseTypes.errors.txt index baa5aaff738..cf8b0d79115 100644 --- a/tests/baselines/reference/parseTypes.errors.txt +++ b/tests/baselines/reference/parseTypes.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/parseTypes.ts(10,1): error TS2322: Type '(s: string) => voi tests/cases/compiler/parseTypes.ts(11,1): error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }'. Index signature is missing in type '(s: string) => void'. tests/cases/compiler/parseTypes.ts(12,1): error TS2322: Type '(s: string) => void' is not assignable to type 'new () => number'. + Type '(s: string) => void' provides no match for the signature 'new (): number' ==== tests/cases/compiler/parseTypes.ts (4 errors) ==== @@ -27,4 +28,5 @@ tests/cases/compiler/parseTypes.ts(12,1): error TS2322: Type '(s: string) => voi z=g; ~ !!! error TS2322: Type '(s: string) => void' is not assignable to type 'new () => number'. +!!! error TS2322: Type '(s: string) => void' provides no match for the signature 'new (): number' \ No newline at end of file diff --git a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt index ee17b6f82aa..9ffdc614ab1 100644 --- a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt +++ b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. + Type 'Object' provides no match for the signature '(): void' tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. + Type 'Object' provides no match for the signature '(): void' ==== tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts (2 errors) ==== @@ -13,6 +15,7 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut i = o; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' var a: { (): void @@ -21,4 +24,5 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut a = o; ~ !!! error TS2322: Type 'Object' is not assignable to type '() => void'. +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.errors.txt b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.errors.txt new file mode 100644 index 00000000000..52d6c4c0fff --- /dev/null +++ b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts(15,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'. +tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts(17,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'. + + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts (2 errors) ==== + /// + /// + // 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_public = require("m"); + export import im_public_mu_public = require("m2"); + + // Usage of privacy error imports + var privateUse_im_public_mi_private = new im_public_mi_private.c_public(); + 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(); + export var publicUse_im_public_mu_private = new im_public_mu_private.c_public(); + var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); + export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'. + var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); + export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'. + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts (0 errors) ==== + // Public elements + export class c_public { + foo: string; + } + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts (0 errors) ==== + export class c_public { + bar: string; + } + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts (0 errors) ==== + // private elements + // Export - Error ambient modules allowed only in global + declare module 'm' { + export class c_private { + baz: string; + } + } + + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts (0 errors) ==== + declare module 'm2' { + export class c_private { + bing: string; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols deleted file mode 100644 index 2dcddbbfa06..00000000000 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.symbols +++ /dev/null @@ -1,105 +0,0 @@ -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts === -/// -/// -// Privacy errors - importing private elements -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, 111)) - -export import im_public_mi_public = require("m"); ->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)) - -// Usage of privacy error imports -var privateUse_im_public_mi_private = new im_public_mi_private.c_public(); ->privateUse_im_public_mi_private : Symbol(privateUse_im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 9, 3)) ->im_public_mi_private.c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0)) ->im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0)) ->c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0)) - -export var publicUse_im_public_mi_private = new im_public_mi_private.c_public(); ->publicUse_im_public_mi_private : Symbol(publicUse_im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 10, 10)) ->im_public_mi_private.c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0)) ->im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0)) ->c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0)) - -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, 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, 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, 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, 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, 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, 112)) ->c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts === -// Public elements -export class c_public { ->c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0)) - - foo: string; ->foo : Symbol(foo, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 1, 23)) -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts === -export class c_public { ->c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0)) - - bar: string; ->bar : Symbol(bar, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 23)) -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts === -// private elements -// Export - Error ambient modules allowed only in global -declare module 'm' { - export class c_private { ->c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20)) - - baz: string; ->baz : Symbol(baz, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 3, 28)) - } -} - - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts === -declare module 'm2' { - export class c_private { ->c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts, 0, 21)) - - bing: string; ->bing : Symbol(bing, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts, 1, 28)) - } -} - diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types deleted file mode 100644 index 5c082bef5de..00000000000 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithExport.types +++ /dev/null @@ -1,113 +0,0 @@ -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts === -/// -/// -// Privacy errors - importing private elements -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"); ->im_public_mu_private : typeof im_public_mu_private - -export import im_public_mi_public = require("m"); ->im_public_mi_public : typeof im_public_mi_public - -export import im_public_mu_public = require("m2"); ->im_public_mu_public : typeof im_public_mu_public - -// Usage of privacy error imports -var privateUse_im_public_mi_private = new im_public_mi_private.c_public(); ->privateUse_im_public_mi_private : im_public_mi_private.c_public ->new im_public_mi_private.c_public() : im_public_mi_private.c_public ->im_public_mi_private.c_public : typeof im_public_mi_private.c_public ->im_public_mi_private : typeof im_public_mi_private ->c_public : typeof im_public_mi_private.c_public - -export var publicUse_im_public_mi_private = new im_public_mi_private.c_public(); ->publicUse_im_public_mi_private : im_public_mi_private.c_public ->new im_public_mi_private.c_public() : im_public_mi_private.c_public ->im_public_mi_private.c_public : typeof im_public_mi_private.c_public ->im_public_mi_private : typeof im_public_mi_private ->c_public : typeof im_public_mi_private.c_public - -var privateUse_im_public_mu_private = new im_public_mu_private.c_public(); ->privateUse_im_public_mu_private : im_public_mu_private.c_public ->new im_public_mu_private.c_public() : im_public_mu_private.c_public ->im_public_mu_private.c_public : typeof im_public_mu_private.c_public ->im_public_mu_private : typeof im_public_mu_private ->c_public : typeof im_public_mu_private.c_public - -export var publicUse_im_public_mu_private = new im_public_mu_private.c_public(); ->publicUse_im_public_mu_private : im_public_mu_private.c_public ->new im_public_mu_private.c_public() : im_public_mu_private.c_public ->im_public_mu_private.c_public : typeof im_public_mu_private.c_public ->im_public_mu_private : typeof im_public_mu_private ->c_public : typeof im_public_mu_private.c_public - -var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); ->privateUse_im_public_mi_public : im_public_mi_public.c_private ->new im_public_mi_public.c_private() : im_public_mi_public.c_private ->im_public_mi_public.c_private : typeof im_public_mi_public.c_private ->im_public_mi_public : typeof im_public_mi_public ->c_private : typeof im_public_mi_public.c_private - -export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); ->publicUse_im_public_mi_public : im_public_mi_public.c_private ->new im_public_mi_public.c_private() : im_public_mi_public.c_private ->im_public_mi_public.c_private : typeof im_public_mi_public.c_private ->im_public_mi_public : typeof im_public_mi_public ->c_private : typeof im_public_mi_public.c_private - -var privateUse_im_public_mi_public = new im_public_mi_public.c_private(); ->privateUse_im_public_mi_public : im_public_mi_public.c_private ->new im_public_mi_public.c_private() : im_public_mi_public.c_private ->im_public_mi_public.c_private : typeof im_public_mi_public.c_private ->im_public_mi_public : typeof im_public_mi_public ->c_private : typeof im_public_mi_public.c_private - -export var publicUse_im_public_mi_public = new im_public_mi_public.c_private(); ->publicUse_im_public_mi_public : im_public_mi_public.c_private ->new im_public_mi_public.c_private() : im_public_mi_public.c_private ->im_public_mi_public.c_private : typeof im_public_mi_public.c_private ->im_public_mi_public : typeof im_public_mi_public ->c_private : typeof im_public_mi_public.c_private - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts === -// Public elements -export class c_public { ->c_public : c_public - - foo: string; ->foo : string -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts === -export class c_public { ->c_public : c_public - - bar: string; ->bar : string -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts === -// private elements -// Export - Error ambient modules allowed only in global -declare module 'm' { - export class c_private { ->c_private : c_private - - baz: string; ->baz : string - } -} - - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts === -declare module 'm2' { - export class c_private { ->c_private : c_private - - bing: string; ->bing : string - } -} - diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.errors.txt b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.errors.txt new file mode 100644 index 00000000000..cc81762bce3 --- /dev/null +++ b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts(15,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'. +tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts(17,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'. + + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts (2 errors) ==== + /// + /// + // Privacy errors - importing private elements + import im_private_mi_private = require("m"); + import im_private_mu_private = require("m2"); + import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require"); + import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1"); + + // Usage of privacy error imports + var privateUse_im_private_mi_private = new im_private_mi_private.c_private(); + export var publicUse_im_private_mi_private = new im_private_mi_private.c_private(); + var privateUse_im_private_mu_private = new im_private_mu_private.c_private(); + export var publicUse_im_private_mu_private = new im_private_mu_private.c_private(); + var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'. + var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'. + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts (0 errors) ==== + + // Public elements + export class c_public { + foo: string; + } + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts (0 errors) ==== + export class c_public { + bar: string; + } + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts (0 errors) ==== + // private elements + // Export - Error ambient modules allowed only in global + declare module 'm' { + export class c_private { + baz: string + } + } + +==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts (0 errors) ==== + declare module 'm2' { + export class c_private { + bing: string; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.symbols b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.symbols deleted file mode 100644 index e366538124f..00000000000 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.symbols +++ /dev/null @@ -1,105 +0,0 @@ -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts === -/// -/// -// Privacy errors - importing private elements -import im_private_mi_private = require("m"); ->im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0)) - -import im_private_mu_private = require("m2"); ->im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44)) - -import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require"); ->im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45)) - -import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1"); ->im_private_mu_public : Symbol(im_private_mu_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 5, 105)) - -// Usage of privacy error imports -var privateUse_im_private_mi_private = new im_private_mi_private.c_private(); ->privateUse_im_private_mi_private : Symbol(privateUse_im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 9, 3)) ->im_private_mi_private.c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20)) ->im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0)) ->c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20)) - -export var publicUse_im_private_mi_private = new im_private_mi_private.c_private(); ->publicUse_im_private_mi_private : Symbol(publicUse_im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 10, 10)) ->im_private_mi_private.c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20)) ->im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0)) ->c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20)) - -var privateUse_im_private_mu_private = new im_private_mu_private.c_private(); ->privateUse_im_private_mu_private : Symbol(privateUse_im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 11, 3)) ->im_private_mu_private.c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21)) ->im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44)) ->c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21)) - -export var publicUse_im_private_mu_private = new im_private_mu_private.c_private(); ->publicUse_im_private_mu_private : Symbol(publicUse_im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 12, 10)) ->im_private_mu_private.c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21)) ->im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44)) ->c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21)) - -var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); ->privateUse_im_private_mi_public : Symbol(privateUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 15, 3)) ->im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) ->im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45)) ->c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) - -export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); ->publicUse_im_private_mi_public : Symbol(publicUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 16, 10)) ->im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) ->im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45)) ->c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) - -var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); ->privateUse_im_private_mi_public : Symbol(privateUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 15, 3)) ->im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) ->im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45)) ->c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) - -export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); ->publicUse_im_private_mi_public : Symbol(publicUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 16, 10)) ->im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) ->im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45)) ->c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts === - -// Public elements -export class c_public { ->c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0)) - - foo: string; ->foo : Symbol(foo, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 2, 23)) -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts === -export class c_public { ->c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts, 0, 0)) - - bar: string; ->bar : Symbol(bar, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts, 0, 23)) -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts === -// private elements -// Export - Error ambient modules allowed only in global -declare module 'm' { - export class c_private { ->c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20)) - - baz: string ->baz : Symbol(baz, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 3, 28)) - } -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts === -declare module 'm2' { - export class c_private { ->c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21)) - - bing: string; ->bing : Symbol(bing, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 1, 28)) - } -} - diff --git a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.types b/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.types deleted file mode 100644 index 437d35fb64a..00000000000 --- a/tests/baselines/reference/privacyTopLevelAmbientExternalModuleImportWithoutExport.types +++ /dev/null @@ -1,113 +0,0 @@ -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts === -/// -/// -// Privacy errors - importing private elements -import im_private_mi_private = require("m"); ->im_private_mi_private : typeof im_private_mi_private - -import im_private_mu_private = require("m2"); ->im_private_mu_private : typeof im_private_mu_private - -import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require"); ->im_private_mi_public : typeof im_private_mi_public - -import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1"); ->im_private_mu_public : typeof im_private_mu_public - -// Usage of privacy error imports -var privateUse_im_private_mi_private = new im_private_mi_private.c_private(); ->privateUse_im_private_mi_private : im_private_mi_private.c_private ->new im_private_mi_private.c_private() : im_private_mi_private.c_private ->im_private_mi_private.c_private : typeof im_private_mi_private.c_private ->im_private_mi_private : typeof im_private_mi_private ->c_private : typeof im_private_mi_private.c_private - -export var publicUse_im_private_mi_private = new im_private_mi_private.c_private(); ->publicUse_im_private_mi_private : im_private_mi_private.c_private ->new im_private_mi_private.c_private() : im_private_mi_private.c_private ->im_private_mi_private.c_private : typeof im_private_mi_private.c_private ->im_private_mi_private : typeof im_private_mi_private ->c_private : typeof im_private_mi_private.c_private - -var privateUse_im_private_mu_private = new im_private_mu_private.c_private(); ->privateUse_im_private_mu_private : im_private_mu_private.c_private ->new im_private_mu_private.c_private() : im_private_mu_private.c_private ->im_private_mu_private.c_private : typeof im_private_mu_private.c_private ->im_private_mu_private : typeof im_private_mu_private ->c_private : typeof im_private_mu_private.c_private - -export var publicUse_im_private_mu_private = new im_private_mu_private.c_private(); ->publicUse_im_private_mu_private : im_private_mu_private.c_private ->new im_private_mu_private.c_private() : im_private_mu_private.c_private ->im_private_mu_private.c_private : typeof im_private_mu_private.c_private ->im_private_mu_private : typeof im_private_mu_private ->c_private : typeof im_private_mu_private.c_private - -var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); ->privateUse_im_private_mi_public : im_private_mi_public.c_public ->new im_private_mi_public.c_public() : im_private_mi_public.c_public ->im_private_mi_public.c_public : typeof im_private_mi_public.c_public ->im_private_mi_public : typeof im_private_mi_public ->c_public : typeof im_private_mi_public.c_public - -export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); ->publicUse_im_private_mi_public : im_private_mi_public.c_public ->new im_private_mi_public.c_public() : im_private_mi_public.c_public ->im_private_mi_public.c_public : typeof im_private_mi_public.c_public ->im_private_mi_public : typeof im_private_mi_public ->c_public : typeof im_private_mi_public.c_public - -var privateUse_im_private_mi_public = new im_private_mi_public.c_public(); ->privateUse_im_private_mi_public : im_private_mi_public.c_public ->new im_private_mi_public.c_public() : im_private_mi_public.c_public ->im_private_mi_public.c_public : typeof im_private_mi_public.c_public ->im_private_mi_public : typeof im_private_mi_public ->c_public : typeof im_private_mi_public.c_public - -export var publicUse_im_private_mi_public = new im_private_mi_public.c_public(); ->publicUse_im_private_mi_public : im_private_mi_public.c_public ->new im_private_mi_public.c_public() : im_private_mi_public.c_public ->im_private_mi_public.c_public : typeof im_private_mi_public.c_public ->im_private_mi_public : typeof im_private_mi_public ->c_public : typeof im_private_mi_public.c_public - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts === - -// Public elements -export class c_public { ->c_public : c_public - - foo: string; ->foo : string -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts === -export class c_public { ->c_public : c_public - - bar: string; ->bar : string -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts === -// private elements -// Export - Error ambient modules allowed only in global -declare module 'm' { - export class c_private { ->c_private : c_private - - baz: string ->baz : string - } -} - -=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts === -declare module 'm2' { - export class c_private { ->c_private : c_private - - bing: string; ->bing : string - } -} - diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js index 6c9bb7e5029..a5ff923efe0 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 00c1d36ee61..d495eb07607 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:../test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js index e39147c6ae1..9f8555682d6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index 064a3ae0604..ee3b40dc285 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:../projects/outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js index 621d7634ee1..a31b4d772ec 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index 568d06c38d1..829640b7bb1 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js index 621d7634ee1..a31b4d772ec 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index ea4aeaeecd9..c3f681d3691 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js index 132e408c648..f4180b78739 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js index aa75fa33169..5db4d6336f1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index b4b30c5d8c2..116d03e99d1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js index aa75fa33169..5db4d6336f1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt index ef5fa1f7b5a..14557880a96 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js index aa75fa33169..5db4d6336f1 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt index 797b9c0bf3c..6a48a2b7d8d 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:../test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js index aa75fa33169..5db4d6336f1 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/bin/test.js @@ -28,7 +28,7 @@ define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function ( } exports.m2_f1 = m2_f1; }); -define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { "use strict"; exports.a1 = 10; var c1 = (function () { diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt index a2d611841c4..e4b0a3e7496 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.sourcemap.txt @@ -342,7 +342,7 @@ emittedFile:bin/test.js sourceFile:outputdir_module_multifolder/test.ts ------------------------------------------------------------------- >>>}); ->>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { +>>>define("outputdir_module_multifolder/test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) { >>> "use strict"; >>> exports.a1 = 10; 1 >^^^^ diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts index d42fc1cd136..b66a73a7c90 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/bin/test.d.ts @@ -14,7 +14,7 @@ declare module "outputdir_module_multifolder_ref/m2" { export var m2_instance1: m2_c1; export function m2_f1(): m2_c1; } -declare module "test" { +declare module "outputdir_module_multifolder/test" { import m1 = require("outputdir_module_multifolder/ref/m1"); import m2 = require("outputdir_module_multifolder_ref/m2"); export var a1: number; diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 47359caf9c2..815d0a44d53 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. + Type '{ x: number; }' provides no match for the signature 'new (): any' tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. + Type '{ x: number; }' provides no match for the signature '(): void' ==== tests/cases/compiler/propertyAssignment.ts (4 errors) ==== @@ -25,7 +27,9 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe foo1 = bar1; // should be an error ~~~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. +!!! error TS2322: Type '{ x: number; }' provides no match for the signature 'new (): any' foo2 = bar2; foo3 = bar3; // should be an error ~~~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. \ No newline at end of file +!!! error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. +!!! error TS2322: Type '{ x: number; }' provides no match for the signature '(): void' \ No newline at end of file diff --git a/tests/baselines/reference/qualify.errors.txt b/tests/baselines/reference/qualify.errors.txt index c7679a0a0f8..f38fc93ccde 100644 --- a/tests/baselines/reference/qualify.errors.txt +++ b/tests/baselines/reference/qualify.errors.txt @@ -7,7 +7,9 @@ tests/cases/compiler/qualify.ts(45,13): error TS2322: Type 'I4' is not assignabl tests/cases/compiler/qualify.ts(46,13): error TS2322: Type 'I4' is not assignable to type 'I3[]'. Property 'length' is missing in type 'I4'. tests/cases/compiler/qualify.ts(47,13): error TS2322: Type 'I4' is not assignable to type '() => I3'. + Type 'I4' provides no match for the signature '(): I3' tests/cases/compiler/qualify.ts(48,13): error TS2322: Type 'I4' is not assignable to type '(k: I3) => void'. + Type 'I4' provides no match for the signature '(k: I3): void' tests/cases/compiler/qualify.ts(49,13): error TS2322: Type 'I4' is not assignable to type '{ k: I3; }'. Property 'k' is missing in type 'I4'. tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable to type 'T.I'. @@ -76,9 +78,11 @@ tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable var v4:()=>K1.I3=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '() => I3'. +!!! error TS2322: Type 'I4' provides no match for the signature '(): I3' var v5:(k:K1.I3)=>void=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '(k: I3) => void'. +!!! error TS2322: Type 'I4' provides no match for the signature '(k: I3): void' var v6:{k:K1.I3;}=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '{ k: I3; }'. diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt index b8429be5ea0..bd392492899 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt +++ b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(6,27): error TS2314: Generic type 'abc' requires 1 type argument(s). -tests/cases/compiler/recursiveBaseConstructorCreation3.ts(10,18): error TS2339: Property 'foo' does not exist on type 'xyz'. +tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. ==== tests/cases/compiler/recursiveBaseConstructorCreation3.ts (2 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(10,18): error TS2339: } var bar = new xyz(); // Error: Invalid 'new' expression. - var r: xyz = bar.foo; - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'xyz'. \ No newline at end of file + ~~~~~~~~~ +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + var r: xyz = bar.foo; \ No newline at end of file diff --git a/tests/baselines/reference/recursiveUnionTypeInference.js b/tests/baselines/reference/recursiveUnionTypeInference.js new file mode 100644 index 00000000000..580a6bf83e5 --- /dev/null +++ b/tests/baselines/reference/recursiveUnionTypeInference.js @@ -0,0 +1,14 @@ +//// [recursiveUnionTypeInference.ts] +interface Foo { + x: T; +} + +function bar(x: Foo | string): T { + return bar(x); +} + + +//// [recursiveUnionTypeInference.js] +function bar(x) { + return bar(x); +} diff --git a/tests/baselines/reference/recursiveUnionTypeInference.symbols b/tests/baselines/reference/recursiveUnionTypeInference.symbols new file mode 100644 index 00000000000..88233573941 --- /dev/null +++ b/tests/baselines/reference/recursiveUnionTypeInference.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/recursiveUnionTypeInference.ts === +interface Foo { +>Foo : Symbol(Foo, Decl(recursiveUnionTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14)) + + x: T; +>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 0, 18)) +>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14)) +} + +function bar(x: Foo | string): T { +>bar : Symbol(bar, Decl(recursiveUnionTypeInference.ts, 2, 1)) +>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13)) +>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(recursiveUnionTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13)) +>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13)) + + return bar(x); +>bar : Symbol(bar, Decl(recursiveUnionTypeInference.ts, 2, 1)) +>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 4, 16)) +} + diff --git a/tests/baselines/reference/recursiveUnionTypeInference.types b/tests/baselines/reference/recursiveUnionTypeInference.types new file mode 100644 index 00000000000..e5d62a051a5 --- /dev/null +++ b/tests/baselines/reference/recursiveUnionTypeInference.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/recursiveUnionTypeInference.ts === +interface Foo { +>Foo : Foo +>T : T + + x: T; +>x : T +>T : T +} + +function bar(x: Foo | string): T { +>bar : (x: Foo | string) => T +>T : T +>x : Foo | string +>Foo : Foo +>T : T +>T : T + + return bar(x); +>bar(x) : T +>bar : (x: Foo | string) => T +>x : Foo | string +} + diff --git a/tests/baselines/reference/shebangBeforeReferences.js b/tests/baselines/reference/shebangBeforeReferences.js index 6be2707277d..6c3e1420c4a 100644 --- a/tests/baselines/reference/shebangBeforeReferences.js +++ b/tests/baselines/reference/shebangBeforeReferences.js @@ -16,6 +16,7 @@ import {x} from "test"; use(x); //// [f.js] -#!/usr/bin/env node"use strict"; +#!/usr/bin/env node +"use strict"; var test_1 = require("test"); use(test_1.x); diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 6f6a387429d..02ece81a1d9 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -1,6 +1,8 @@ +tests/cases/compiler/strictModeReservedWord.ts(1,5): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. tests/cases/compiler/strictModeReservedWord.ts(5,9): error TS1212: Identifier expected. 'public' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(6,9): error TS1212: Identifier expected. 'static' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(7,9): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(7,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. tests/cases/compiler/strictModeReservedWord.ts(8,9): error TS1212: Identifier expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(8,9): error TS2300: Duplicate identifier 'package'. tests/cases/compiler/strictModeReservedWord.ts(9,14): error TS1212: Identifier expected. 'package' is a reserved word in strict mode @@ -41,8 +43,10 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS1212: Identifier e tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. -==== tests/cases/compiler/strictModeReservedWord.ts (41 errors) ==== +==== tests/cases/compiler/strictModeReservedWord.ts (43 errors) ==== let let = 10; + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. function foo() { "use strict" @@ -55,6 +59,8 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok let let = "blah"; ~~~ !!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. var package = "hello" ~~~~~~~ !!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode diff --git a/tests/baselines/reference/targetTypeVoidFunc.errors.txt b/tests/baselines/reference/targetTypeVoidFunc.errors.txt index f9434c1d630..d47f811c2ed 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.errors.txt +++ b/tests/baselines/reference/targetTypeVoidFunc.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/targetTypeVoidFunc.ts(2,12): error TS2322: Type '() => void' is not assignable to type 'new () => number'. + Type '() => void' provides no match for the signature 'new (): number' ==== tests/cases/compiler/targetTypeVoidFunc.ts (1 errors) ==== @@ -6,6 +7,7 @@ tests/cases/compiler/targetTypeVoidFunc.ts(2,12): error TS2322: Type '() => void return function () { return; } ~~~~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'new () => number'. +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): number' }; var x = f1(); diff --git a/tests/baselines/reference/tsxPreserveEmit1.js b/tests/baselines/reference/tsxPreserveEmit1.js index 894d0c3d698..7ac6c18ebca 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.js +++ b/tests/baselines/reference/tsxPreserveEmit1.js @@ -22,12 +22,28 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} //// [test.jsx] define(["require", "exports", 'react-router'], function (require, exports, ReactRouter) { "use strict"; var Route = ReactRouter.Route; - var routes = ; + var routes1 = ; + var M; + (function (M) { + })(M || (M = {})); + var M; + (function (M) { + // Should emit 'M.X' in both opening and closing tags + var y = ; + })(M || (M = {})); }); diff --git a/tests/baselines/reference/tsxPreserveEmit1.symbols b/tests/baselines/reference/tsxPreserveEmit1.symbols index 6dcf4d9ac49..53707b86104 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.symbols +++ b/tests/baselines/reference/tsxPreserveEmit1.symbols @@ -11,10 +11,26 @@ import Route = ReactRouter.Route; >ReactRouter : Symbol(ReactRouter, Decl(react.d.ts, 4, 1)) >Route : Symbol(ReactRouter.Route, Decl(react.d.ts, 7, 4)) -var routes = ; ->routes : Symbol(routes, Decl(test.tsx, 6, 3)) +var routes1 = ; +>routes1 : Symbol(routes1, Decl(test.tsx, 6, 3)) >Route : Symbol(Route, Decl(test.tsx, 2, 45)) +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + export var X: any; +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : Symbol(y, Decl(test.tsx, 13, 4)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/baselines/reference/tsxPreserveEmit1.types b/tests/baselines/reference/tsxPreserveEmit1.types index ea64e2d2e94..26da75b39e4 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.types +++ b/tests/baselines/reference/tsxPreserveEmit1.types @@ -11,11 +11,28 @@ import Route = ReactRouter.Route; >ReactRouter : typeof ReactRouter >Route : any -var routes = ; ->routes : any +var routes1 = ; +>routes1 : any > : any >Route : any +module M { +>M : typeof M + + export var X: any; +>X : any +} +module M { +>M : typeof M + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : any +> : any +>X : any +>X : any +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/baselines/reference/typeofANonExportedType.errors.txt b/tests/baselines/reference/typeofANonExportedType.errors.txt index d07468f62e1..0fb239f6aee 100644 --- a/tests/baselines/reference/typeofANonExportedType.errors.txt +++ b/tests/baselines/reference/typeofANonExportedType.errors.txt @@ -1,8 +1,10 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. -==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (2 errors) ==== +==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (4 errors) ==== var x = 1; export var r1: typeof x; ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -25,7 +27,11 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType export var i: I; var i2: I; export var r5: typeof i; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'r5'. export var r5: typeof i2; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'r5'. module M { export var foo = ''; diff --git a/tests/baselines/reference/typeofAnExportedType.errors.txt b/tests/baselines/reference/typeofAnExportedType.errors.txt index cb6d8c68887..51dd7cf06b6 100644 --- a/tests/baselines/reference/typeofAnExportedType.errors.txt +++ b/tests/baselines/reference/typeofAnExportedType.errors.txt @@ -1,8 +1,10 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. -==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (2 errors) ==== +==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (4 errors) ==== export var x = 1; ~~~~~~~~~~~~~~~~~ !!! error TS1148: Cannot compile modules unless the '--module' flag is provided. @@ -25,7 +27,11 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.t export var i: I; var i2: I; export var r5: typeof i; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'r5'. export var r5: typeof i2; + ~~ +!!! error TS2323: Cannot redeclare exported variable 'r5'. export module M { export var foo = ''; diff --git a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt index 2440e51cd39..261038a1f4a 100644 --- a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt +++ b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(4,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. + Type 'Function' provides no match for the signature '(): void' tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(11,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(12,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. @@ -18,6 +19,7 @@ tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(15,10): err var r: () => void = c.constructor; ~ !!! error TS2322: Type 'Function' is not assignable to type '() => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(): void' class C2 { private constructor(x: number); diff --git a/tests/baselines/reference/typesWithPublicConstructor.errors.txt b/tests/baselines/reference/typesWithPublicConstructor.errors.txt index a3d66c3520a..54bee79dae0 100644 --- a/tests/baselines/reference/typesWithPublicConstructor.errors.txt +++ b/tests/baselines/reference/typesWithPublicConstructor.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/members/typesWithPublicConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. + Type 'Function' provides no match for the signature '(): void' tests/cases/conformance/types/members/typesWithPublicConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. @@ -13,6 +14,7 @@ tests/cases/conformance/types/members/typesWithPublicConstructor.ts(15,10): erro var r: () => void = c.constructor; ~ !!! error TS2322: Type 'Function' is not assignable to type '() => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(): void' class C2 { public constructor(x: number); diff --git a/tests/baselines/reference/undefinedTypeAssignment1.errors.txt b/tests/baselines/reference/undefinedTypeAssignment1.errors.txt new file mode 100644 index 00000000000..b8dd74a58a8 --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment1.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/undefinedTypeAssignment1.ts(1,1): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + + +==== tests/cases/compiler/undefinedTypeAssignment1.ts (1 errors) ==== + type undefined = string; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + function p(undefined = "wat") { + return undefined; + } + \ No newline at end of file diff --git a/tests/baselines/reference/undefinedTypeAssignment1.js b/tests/baselines/reference/undefinedTypeAssignment1.js new file mode 100644 index 00000000000..1f53c4f6c45 --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment1.js @@ -0,0 +1,12 @@ +//// [undefinedTypeAssignment1.ts] +type undefined = string; +function p(undefined = "wat") { + return undefined; +} + + +//// [undefinedTypeAssignment1.js] +function p(undefined) { + if (undefined === void 0) { undefined = "wat"; } + return undefined; +} diff --git a/tests/baselines/reference/undefinedTypeAssignment2.errors.txt b/tests/baselines/reference/undefinedTypeAssignment2.errors.txt new file mode 100644 index 00000000000..55fdbf0fc1b --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/undefinedTypeAssignment2.ts(1,5): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + + +==== tests/cases/compiler/undefinedTypeAssignment2.ts (1 errors) ==== + var undefined = void 0; + ~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + \ No newline at end of file diff --git a/tests/baselines/reference/undefinedTypeAssignment2.js b/tests/baselines/reference/undefinedTypeAssignment2.js new file mode 100644 index 00000000000..040bc8c800d --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment2.js @@ -0,0 +1,6 @@ +//// [undefinedTypeAssignment2.ts] +var undefined = void 0; + + +//// [undefinedTypeAssignment2.js] +var undefined = void 0; diff --git a/tests/baselines/reference/undefinedTypeAssignment3.errors.txt b/tests/baselines/reference/undefinedTypeAssignment3.errors.txt new file mode 100644 index 00000000000..88df370940f --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/undefinedTypeAssignment3.ts(1,5): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + + +==== tests/cases/compiler/undefinedTypeAssignment3.ts (1 errors) ==== + var undefined = null; + ~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + \ No newline at end of file diff --git a/tests/baselines/reference/undefinedTypeAssignment3.js b/tests/baselines/reference/undefinedTypeAssignment3.js new file mode 100644 index 00000000000..4015d49e33a --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment3.js @@ -0,0 +1,6 @@ +//// [undefinedTypeAssignment3.ts] +var undefined = null; + + +//// [undefinedTypeAssignment3.js] +var undefined = null; diff --git a/tests/baselines/reference/undefinedTypeAssignment4.errors.txt b/tests/baselines/reference/undefinedTypeAssignment4.errors.txt new file mode 100644 index 00000000000..dab6ea2a880 --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment4.errors.txt @@ -0,0 +1,24 @@ +tests/cases/compiler/undefinedTypeAssignment4.ts(1,7): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. +tests/cases/compiler/undefinedTypeAssignment4.ts(4,11): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. +tests/cases/compiler/undefinedTypeAssignment4.ts(7,11): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + + +==== tests/cases/compiler/undefinedTypeAssignment4.ts (3 errors) ==== + class undefined { + ~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + foo: string; + } + interface undefined { + ~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + member: number; + } + namespace undefined { + ~~~~~~~~~ +!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'. + export var x = 42; + } + var x: undefined; + var y: typeof undefined; + \ No newline at end of file diff --git a/tests/baselines/reference/undefinedTypeAssignment4.js b/tests/baselines/reference/undefinedTypeAssignment4.js new file mode 100644 index 00000000000..186afd872c3 --- /dev/null +++ b/tests/baselines/reference/undefinedTypeAssignment4.js @@ -0,0 +1,26 @@ +//// [undefinedTypeAssignment4.ts] +class undefined { + foo: string; +} +interface undefined { + member: number; +} +namespace undefined { + export var x = 42; +} +var x: undefined; +var y: typeof undefined; + + +//// [undefinedTypeAssignment4.js] +var undefined = (function () { + function undefined() { + } + return undefined; +})(); +var undefined; +(function (undefined) { + undefined.x = 42; +})(undefined || (undefined = {})); +var x; +var y; diff --git a/tests/baselines/reference/unionTypeParameterInference.js b/tests/baselines/reference/unionTypeParameterInference.js new file mode 100644 index 00000000000..c96e809cd4d --- /dev/null +++ b/tests/baselines/reference/unionTypeParameterInference.js @@ -0,0 +1,17 @@ +//// [unionTypeParameterInference.ts] +// Regression test for #5861 + +interface Foo { prop: T; } + +declare function lift(value: U | Foo): Foo; + +function unlift(value: U | Foo): U { + return lift(value).prop; +} + + +//// [unionTypeParameterInference.js] +// Regression test for #5861 +function unlift(value) { + return lift(value).prop; +} diff --git a/tests/baselines/reference/unionTypeParameterInference.symbols b/tests/baselines/reference/unionTypeParameterInference.symbols new file mode 100644 index 00000000000..f2dbaac31ff --- /dev/null +++ b/tests/baselines/reference/unionTypeParameterInference.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/unionTypeParameterInference.ts === +// Regression test for #5861 + +interface Foo { prop: T; } +>Foo : Symbol(Foo, Decl(unionTypeParameterInference.ts, 0, 0)) +>T : Symbol(T, Decl(unionTypeParameterInference.ts, 2, 14)) +>prop : Symbol(prop, Decl(unionTypeParameterInference.ts, 2, 18)) +>T : Symbol(T, Decl(unionTypeParameterInference.ts, 2, 14)) + +declare function lift(value: U | Foo): Foo; +>lift : Symbol(lift, Decl(unionTypeParameterInference.ts, 2, 29)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 4, 22)) +>value : Symbol(value, Decl(unionTypeParameterInference.ts, 4, 25)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 4, 22)) +>Foo : Symbol(Foo, Decl(unionTypeParameterInference.ts, 0, 0)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 4, 22)) +>Foo : Symbol(Foo, Decl(unionTypeParameterInference.ts, 0, 0)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 4, 22)) + +function unlift(value: U | Foo): U { +>unlift : Symbol(unlift, Decl(unionTypeParameterInference.ts, 4, 52)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 6, 16)) +>value : Symbol(value, Decl(unionTypeParameterInference.ts, 6, 19)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 6, 16)) +>Foo : Symbol(Foo, Decl(unionTypeParameterInference.ts, 0, 0)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 6, 16)) +>U : Symbol(U, Decl(unionTypeParameterInference.ts, 6, 16)) + + return lift(value).prop; +>lift(value).prop : Symbol(Foo.prop, Decl(unionTypeParameterInference.ts, 2, 18)) +>lift : Symbol(lift, Decl(unionTypeParameterInference.ts, 2, 29)) +>value : Symbol(value, Decl(unionTypeParameterInference.ts, 6, 19)) +>prop : Symbol(Foo.prop, Decl(unionTypeParameterInference.ts, 2, 18)) +} + diff --git a/tests/baselines/reference/unionTypeParameterInference.types b/tests/baselines/reference/unionTypeParameterInference.types new file mode 100644 index 00000000000..54eaed90ecc --- /dev/null +++ b/tests/baselines/reference/unionTypeParameterInference.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/unionTypeParameterInference.ts === +// Regression test for #5861 + +interface Foo { prop: T; } +>Foo : Foo +>T : T +>prop : T +>T : T + +declare function lift(value: U | Foo): Foo; +>lift : (value: U | Foo) => Foo +>U : U +>value : U | Foo +>U : U +>Foo : Foo +>U : U +>Foo : Foo +>U : U + +function unlift(value: U | Foo): U { +>unlift : (value: U | Foo) => U +>U : U +>value : U | Foo +>U : U +>Foo : Foo +>U : U +>U : U + + return lift(value).prop; +>lift(value).prop : U +>lift(value) : Foo +>lift : (value: U | Foo) => Foo +>value : U | Foo +>prop : U +} + diff --git a/tests/cases/compiler/ClassDeclaration26.ts b/tests/cases/compiler/ClassDeclaration26.ts new file mode 100644 index 00000000000..0adcbc470e0 --- /dev/null +++ b/tests/cases/compiler/ClassDeclaration26.ts @@ -0,0 +1,5 @@ +class C { + public const var export foo = 10; + + var constructor() { } +} \ No newline at end of file diff --git a/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts b/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts new file mode 100644 index 00000000000..06af5a0fdb5 --- /dev/null +++ b/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts @@ -0,0 +1,3 @@ +class AtomicNumbers { + static const H = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts b/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts new file mode 100644 index 00000000000..fe90dded9e3 --- /dev/null +++ b/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts @@ -0,0 +1,4 @@ +class C { + const + x = 10; +} \ No newline at end of file diff --git a/tests/cases/compiler/extendConstructSignatureInInterface.ts b/tests/cases/compiler/extendConstructSignatureInInterface.ts new file mode 100644 index 00000000000..a0880de69cd --- /dev/null +++ b/tests/cases/compiler/extendConstructSignatureInInterface.ts @@ -0,0 +1,9 @@ +interface C { + new(x: number): C; +} + +var CStatic: C; +class E extends CStatic { +} + +var e: E = new E(1); diff --git a/tests/cases/compiler/genericSignatureIdentity.ts b/tests/cases/compiler/genericSignatureIdentity.ts new file mode 100644 index 00000000000..c685b8cc573 --- /dev/null +++ b/tests/cases/compiler/genericSignatureIdentity.ts @@ -0,0 +1,20 @@ +// This test is here to remind us of our current limits of type identity checking. +// Ideally all of the below declarations would be considered different (and thus errors) +// but they aren't because we erase type parameters to type any and don't check that +// constraints are identical. + +var x: { + (x: T): T; +}; + +var x: { + (x: T): T; +}; + +var x: { + (x: T): T; +}; + +var x: { + (x: any): any; +}; diff --git a/tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts b/tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts new file mode 100644 index 00000000000..03a01204462 --- /dev/null +++ b/tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts @@ -0,0 +1,10 @@ +// @target: es6 +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + +var let = 10; +for (let of [1,2,3]) {} + +for (let in [1,2,3]) {} + + diff --git a/tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts b/tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts new file mode 100644 index 00000000000..03a01204462 --- /dev/null +++ b/tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts @@ -0,0 +1,10 @@ +// @target: es6 +// This should be an error +// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements + +var let = 10; +for (let of [1,2,3]) {} + +for (let in [1,2,3]) {} + + diff --git a/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts b/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts new file mode 100644 index 00000000000..3433adc17d5 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts @@ -0,0 +1,6 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js +var a = 10; +class a { +} \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts b/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts new file mode 100644 index 00000000000..32a9e77fcc7 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts @@ -0,0 +1,7 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js +// @target: es6 +export default class a { +} +export default var a = 10; \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts b/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts new file mode 100644 index 00000000000..b95f85c2139 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts @@ -0,0 +1,23 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js +// @noFallthroughCasesInSwitch: true +function foo(a, b) { + switch (a) { + case 10: + if (b) { + return b; + } + case 20: + return a; + } +} + +function bar() { + return x; + function bar2() { + } + var x = 10; // error +} + +label1: var x2 = 10; \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts b/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts new file mode 100644 index 00000000000..30b43b1990e --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts @@ -0,0 +1,40 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js +// @target: es6 +"use strict"; +var a = { + a: "hello", // error + b: 10, + a: 10 // error +}; +var let = 10; // error +delete a; // error +try { +} catch (eval) { // error +} +function arguments() { // error +} + +with (a) { + b = 10; +} + +// @filename: b.js +// this is not in strict mode but class definitions are always in strict mode +class c { + a(eval) { //error + } + method() { + var let = 10; // error + } +} + +// @filename: c.js +export var let = 10; // external modules are automatically in strict mode +var eval = function () { +}; + +//@filename: d.js +"use strict"; +var x = 009; // error \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationExternalPackageError.ts b/tests/cases/compiler/jsFileCompilationExternalPackageError.ts new file mode 100644 index 00000000000..cb9d32adb82 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationExternalPackageError.ts @@ -0,0 +1,16 @@ +// @allowJs: true +// @noEmit: true +// @module: commonjs + +// @filename: moduleA/a.js +import {a} from "b"; +a++; +import {c} from "c"; +c++; + +// @filename: node_modules/b.ts +var a = 10; + +// @filename: node_modules/c.js +exports.a = 10; +c = 10; diff --git a/tests/cases/compiler/letAsIdentifier2.ts b/tests/cases/compiler/letAsIdentifier2.ts new file mode 100644 index 00000000000..7ebbeb0704b --- /dev/null +++ b/tests/cases/compiler/letAsIdentifier2.ts @@ -0,0 +1,3 @@ +// @target: es6 + +function let() {} \ No newline at end of file diff --git a/tests/cases/compiler/letInConstDeclarations_ES5.ts b/tests/cases/compiler/letInConstDeclarations_ES5.ts new file mode 100644 index 00000000000..2898abd1e2a --- /dev/null +++ b/tests/cases/compiler/letInConstDeclarations_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 + +// All use of let in const declaration should be an error +const x = 50, let = 5; + +{ + const x = 10, let = 20; +} \ No newline at end of file diff --git a/tests/cases/compiler/letInConstDeclarations_ES6.ts b/tests/cases/compiler/letInConstDeclarations_ES6.ts new file mode 100644 index 00000000000..aac2a592d11 --- /dev/null +++ b/tests/cases/compiler/letInConstDeclarations_ES6.ts @@ -0,0 +1,8 @@ +// @target: es6 + +// All use of let in const declaration should be an error +const x = 50, let = 5; + +{ + const x = 10, let = 20; +} \ No newline at end of file diff --git a/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts b/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts new file mode 100644 index 00000000000..7e8b6824329 --- /dev/null +++ b/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES5.ts @@ -0,0 +1,21 @@ +// @target: es5 + +// Should be an error +for (let let of [1,2,3]) {} + +for (const let of [1,2,3]) {} + +for (let let in [1,2,3]) {} + +for (const let in [1,2,3]) {} + +{ + for (let let of [1,2,3]) {} + + for (const let of [1,2,3]) {} + + for (let let in [1,2,3]) {} + + for (const let in [1,2,3]) {} +} + diff --git a/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts b/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts new file mode 100644 index 00000000000..68ba1716199 --- /dev/null +++ b/tests/cases/compiler/letInLetConstDeclOfForOfAndForIn_ES6.ts @@ -0,0 +1,21 @@ +// @target: es6 + +// Should be an error +for (let let of [1,2,3]) {} + +for (const let of [1,2,3]) {} + +for (let let in [1,2,3]) {} + +for (const let in [1,2,3]) {} + +{ + for (let let of [1,2,3]) {} + + for (const let of [1,2,3]) {} + + for (let let in [1,2,3]) {} + + for (const let in [1,2,3]) {} +} + diff --git a/tests/cases/compiler/letInLetDeclarations_ES5.ts b/tests/cases/compiler/letInLetDeclarations_ES5.ts new file mode 100644 index 00000000000..8d4a71b85c8 --- /dev/null +++ b/tests/cases/compiler/letInLetDeclarations_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 + +// All use of let in const declaration should be an error +let x = 50, let = 5; + +{ + let x = 10, let = 20; +} \ No newline at end of file diff --git a/tests/cases/compiler/letInLetDeclarations_ES6.ts b/tests/cases/compiler/letInLetDeclarations_ES6.ts new file mode 100644 index 00000000000..8c4650dd938 --- /dev/null +++ b/tests/cases/compiler/letInLetDeclarations_ES6.ts @@ -0,0 +1,8 @@ +// @target: es6 + +// All use of let in const declaration should be an error +let x = 50, let = 5; + +{ + let x = 10, let = 20; +} \ No newline at end of file diff --git a/tests/cases/compiler/letInLetOrConstDeclarations.ts b/tests/cases/compiler/letInLetOrConstDeclarations.ts deleted file mode 100644 index c622759a459..00000000000 --- a/tests/cases/compiler/letInLetOrConstDeclarations.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @target: es6 -{ - let let = 1; // should error - for (let let in []) { } // should error -} -{ - const let = 1; // should error -} -{ - function let() { // should be ok - } -} \ No newline at end of file diff --git a/tests/cases/compiler/letInVarDeclOfForIn_ES5.ts b/tests/cases/compiler/letInVarDeclOfForIn_ES5.ts new file mode 100644 index 00000000000..684dc3b2e9f --- /dev/null +++ b/tests/cases/compiler/letInVarDeclOfForIn_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 + +// should not be an error +for (var let in [1,2,3]) {} + +{ + for (var let in [1,2,3]) {} +} diff --git a/tests/cases/compiler/letInVarDeclOfForIn_ES6.ts b/tests/cases/compiler/letInVarDeclOfForIn_ES6.ts new file mode 100644 index 00000000000..8d79f41713e --- /dev/null +++ b/tests/cases/compiler/letInVarDeclOfForIn_ES6.ts @@ -0,0 +1,8 @@ +// @target: es6 + +// should not be an error +for (var let in [1,2,3]) {} + +{ + for (var let in [1,2,3]) {} +} diff --git a/tests/cases/compiler/letInVarDeclOfForOf_ES5.ts b/tests/cases/compiler/letInVarDeclOfForOf_ES5.ts new file mode 100644 index 00000000000..2d369aa162e --- /dev/null +++ b/tests/cases/compiler/letInVarDeclOfForOf_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 + +// should not be an error +for (var let of [1,2,3]) {} + +{ + for (var let of [1,2,3]) {} +} diff --git a/tests/cases/compiler/letInVarDeclOfForOf_ES6.ts b/tests/cases/compiler/letInVarDeclOfForOf_ES6.ts new file mode 100644 index 00000000000..9e343a45f4b --- /dev/null +++ b/tests/cases/compiler/letInVarDeclOfForOf_ES6.ts @@ -0,0 +1,8 @@ +// @target: es6 + +// should not be an error +for (var let of [1,2,3]) {} + +{ + for (var let of [1,2,3]) {} +} diff --git a/tests/cases/compiler/missingSemicolonInModuleSpecifier.ts b/tests/cases/compiler/missingSemicolonInModuleSpecifier.ts new file mode 100644 index 00000000000..c3db4389504 --- /dev/null +++ b/tests/cases/compiler/missingSemicolonInModuleSpecifier.ts @@ -0,0 +1,8 @@ +// @module: commonjs + +// @filename: a.ts +export const x = 1; + +// @filename: b.ts +import {x} from "./a" +(function() { return 1; }()) \ No newline at end of file diff --git a/tests/cases/compiler/moduleDuplicateIdentifiers.ts b/tests/cases/compiler/moduleDuplicateIdentifiers.ts new file mode 100644 index 00000000000..47be2bc5dbb --- /dev/null +++ b/tests/cases/compiler/moduleDuplicateIdentifiers.ts @@ -0,0 +1,40 @@ +// @module: commonjs +export var Foo = 2; +export var Foo = 42; // Should error + +export interface Bar { + _brand1: any; +} + +export interface Bar { // Shouldn't error + _brand2: any; +} + +export namespace FooBar { + export var member1 = 2; +} + +export namespace FooBar { // Shouldn't error + export var member2 = 42; +} + +export class Kettle { + member1 = 2; +} + +export class Kettle { // Should error + member2 = 42; +} + +export var Pot = 2; +Pot = 42; // Shouldn't error + +export enum Utensils { + Spoon, + Fork, + Knife +} + +export enum Utensils { // Shouldn't error + Spork = 3 +} diff --git a/tests/cases/compiler/moduleSameValueDuplicateExportedBindings1.ts b/tests/cases/compiler/moduleSameValueDuplicateExportedBindings1.ts new file mode 100644 index 00000000000..d51de9c2e5a --- /dev/null +++ b/tests/cases/compiler/moduleSameValueDuplicateExportedBindings1.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @filename: a.ts +export * from "./b"; +export * from "./c"; + +// @filename: b.ts +export * from "./c"; + +// @filename: c.ts +export var foo = 42; \ No newline at end of file diff --git a/tests/cases/compiler/moduleSameValueDuplicateExportedBindings2.ts b/tests/cases/compiler/moduleSameValueDuplicateExportedBindings2.ts new file mode 100644 index 00000000000..1a30004301a --- /dev/null +++ b/tests/cases/compiler/moduleSameValueDuplicateExportedBindings2.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @filename: a.ts +export * from "./b"; +export * from "./c"; + +// @filename: b.ts +export {Animals} from "./c"; + +// @filename: c.ts +export enum Animals { + Cat, + Dog +}; \ No newline at end of file diff --git a/tests/cases/compiler/recursiveUnionTypeInference.ts b/tests/cases/compiler/recursiveUnionTypeInference.ts new file mode 100644 index 00000000000..4ffc6fcf4a7 --- /dev/null +++ b/tests/cases/compiler/recursiveUnionTypeInference.ts @@ -0,0 +1,7 @@ +interface Foo { + x: T; +} + +function bar(x: Foo | string): T { + return bar(x); +} diff --git a/tests/cases/compiler/undefinedTypeAssignment1.ts b/tests/cases/compiler/undefinedTypeAssignment1.ts new file mode 100644 index 00000000000..7d340daba69 --- /dev/null +++ b/tests/cases/compiler/undefinedTypeAssignment1.ts @@ -0,0 +1,4 @@ +type undefined = string; +function p(undefined = "wat") { + return undefined; +} diff --git a/tests/cases/compiler/undefinedTypeAssignment2.ts b/tests/cases/compiler/undefinedTypeAssignment2.ts new file mode 100644 index 00000000000..3f42068e24e --- /dev/null +++ b/tests/cases/compiler/undefinedTypeAssignment2.ts @@ -0,0 +1 @@ +var undefined = void 0; diff --git a/tests/cases/compiler/undefinedTypeAssignment3.ts b/tests/cases/compiler/undefinedTypeAssignment3.ts new file mode 100644 index 00000000000..8bada4f946c --- /dev/null +++ b/tests/cases/compiler/undefinedTypeAssignment3.ts @@ -0,0 +1 @@ +var undefined = null; diff --git a/tests/cases/compiler/undefinedTypeAssignment4.ts b/tests/cases/compiler/undefinedTypeAssignment4.ts new file mode 100644 index 00000000000..fc0dc155acd --- /dev/null +++ b/tests/cases/compiler/undefinedTypeAssignment4.ts @@ -0,0 +1,11 @@ +class undefined { + foo: string; +} +interface undefined { + member: number; +} +namespace undefined { + export var x = 42; +} +var x: undefined; +var y: typeof undefined; diff --git a/tests/cases/compiler/unionTypeParameterInference.ts b/tests/cases/compiler/unionTypeParameterInference.ts new file mode 100644 index 00000000000..79c4f3cc0e5 --- /dev/null +++ b/tests/cases/compiler/unionTypeParameterInference.ts @@ -0,0 +1,9 @@ +// Regression test for #5861 + +interface Foo { prop: T; } + +declare function lift(value: U | Foo): Foo; + +function unlift(value: U | Foo): U { + return lift(value).prop; +} diff --git a/tests/cases/conformance/enums/enumExportMergingES6.ts b/tests/cases/conformance/enums/enumExportMergingES6.ts new file mode 100644 index 00000000000..0a5185ecdd5 --- /dev/null +++ b/tests/cases/conformance/enums/enumExportMergingES6.ts @@ -0,0 +1,10 @@ +// @target: es6 +export enum Animals { + Cat = 1 +} +export enum Animals { + Dog = 2 +} +export enum Animals { + CatDog = Cat | Dog +} diff --git a/tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts b/tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts new file mode 100644 index 00000000000..7f6fad73490 --- /dev/null +++ b/tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: amd +// @rootDir: tests/cases/conformance/es6/moduleExportsAmd/src +// @outFile: output.js +// @filename: src/a.ts +import foo from "./b"; +export default class Foo {} +foo(); + +// @filename: src/b.ts +import Foo from "./a"; +export default function foo() { new Foo(); } diff --git a/tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts b/tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts new file mode 100644 index 00000000000..5708c84c4bd --- /dev/null +++ b/tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: system +// @rootDir: tests/cases/conformance/es6/moduleExportsSystem/src +// @outFile: output.js +// @filename: src/a.ts +import foo from "./b"; +export default class Foo {} +foo(); + +// @filename: src/b.ts +import Foo from "./a"; +export default function foo() { new Foo(); } diff --git a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx index e75a1dbfde2..179a3116b43 100644 --- a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx +++ b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx @@ -23,4 +23,12 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts new file mode 100644 index 00000000000..06a1c24230c --- /dev/null +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -0,0 +1,21 @@ +/// + +////interface I1 { +//// a(): void; +//// b(): void; +////} +//// +////var imp1: I1 { +//// a() {}, +//// /*0*/ +////} +//// +////var imp2: I1 { +//// a: () => {}, +//// /*1*/ +////} + +goTo.marker("0"); +verify.not.completionListContains("a"); +goTo.marker("1"); +verify.not.completionListContains("a"); diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index 9ab29b41798..58c02dae183 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -11,5 +11,12 @@ verify.getSemanticDiagnostics(`[ "length": 11, "category": "error", "code": 8003 + }, + { + "message": "Cannot compile modules unless the '--module' flag is provided.", + "start": 0, + "length": 11, + "category": "error", + "code": 1148 } ]`); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesConst04.ts b/tests/cases/fourslash/getOccurrencesConst04.ts index c7f293450d3..2a8ee4c9e2c 100644 --- a/tests/cases/fourslash/getOccurrencesConst04.ts +++ b/tests/cases/fourslash/getOccurrencesConst04.ts @@ -1,12 +1,14 @@ /// ////export const class C { -//// private static c/*1*/onst foo; -//// constructor(public con/*2*/st foo) { +//// private static c/*1*/onst f/*2*/oo; +//// constructor(public con/*3*/st foo) { //// } ////} goTo.marker("1"); -verify.occurrencesAtPositionCount(1); +verify.occurrencesAtPositionCount(0); goTo.marker("2"); +verify.occurrencesAtPositionCount(1); +goTo.marker("3"); verify.occurrencesAtPositionCount(0); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias1.ts b/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias1.ts new file mode 100644 index 00000000000..7f5f6df4d5b --- /dev/null +++ b/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias1.ts @@ -0,0 +1,19 @@ +/// + +//// type Ctor = new () => A/*1*/A; +//// type MixinCtor = new () => AA & { constructor: MixinCtor }; +//// type NestedCtor = new() => AA & (new () => AA & { constructor: NestedCtor }); +//// type Method = { method(): A/*4*/A }; +//// type Construct = { new(): A/*5*/A }; + + +goTo.marker('1'); +verify.quickInfoIs('(type parameter) AA in type Ctor'); +goTo.marker('2'); +verify.quickInfoIs('(type parameter) AA in type MixinCtor'); +goTo.marker('3'); +verify.quickInfoIs('(type parameter) AA in type NestedCtor'); +goTo.marker('4'); +verify.quickInfoIs('(type parameter) AA in type Method'); +goTo.marker('5'); +verify.quickInfoIs('(type parameter) AA in type Construct'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias2.ts b/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias2.ts new file mode 100644 index 00000000000..89a648470d6 --- /dev/null +++ b/tests/cases/fourslash/quickInfoForTypeParameterInTypeAlias2.ts @@ -0,0 +1,22 @@ +/// + +//// type Call = { (): A/*1*/A }; +//// type Index = {[foo: string]: A/*2*/A}; +//// type GenericMethod = { method(): A/*3*/A & B/*4*/B } +//// type Nesting = { method(): new () => T/*5*/T & U/*6*/U & W/*7*/W }; + +goTo.marker('1'); +verify.quickInfoIs('(type parameter) AA in type Call'); +goTo.marker('2'); +verify.quickInfoIs('(type parameter) AA in type Index'); +goTo.marker('3'); +verify.quickInfoIs('(type parameter) AA in type GenericMethod'); +goTo.marker('4'); +verify.quickInfoIs('(type parameter) BB in method(): AA & BB'); +goTo.marker('5'); +verify.quickInfoIs('(type parameter) TT in type Nesting'); +goTo.marker('6'); +verify.quickInfoIs('(type parameter) UU in method(): new () => TT & UU & WW'); +goTo.marker('7'); +verify.quickInfoIs('(type parameter) WW in (): TT & UU & WW'); + diff --git a/tests/cases/fourslash/smartIndentNamedImport.ts b/tests/cases/fourslash/smartIndentNamedImport.ts new file mode 100644 index 00000000000..37ef80f6316 --- /dev/null +++ b/tests/cases/fourslash/smartIndentNamedImport.ts @@ -0,0 +1,12 @@ +/// + +////import {/*0*/ +//// numbers as bn,/*1*/ +//// list/*2*/ +////} from '@bykov/basics';/*3*/ + +format.document(); +goTo.marker("0"); verify.currentLineContentIs("import {"); +goTo.marker("1"); verify.currentLineContentIs(" numbers as bn,"); +goTo.marker("2"); verify.currentLineContentIs(" list"); +goTo.marker("3"); verify.currentLineContentIs("} from '@bykov/basics';"); \ No newline at end of file diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index c4c17ebb223..5b924650401 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -99,13 +99,34 @@ module ts { assert.equal(resolution.failedLookupLocations.length, supportedTypeScriptExtensions.length); } - it("module name as directory - load from typings", () => { + it("module name as directory - load from 'typings'", () => { testLoadingFromPackageJson("/a/b/c/d.ts", "/a/b/c/bar/package.json", "c/d/e.d.ts", "/a/b/c/bar/c/d/e.d.ts", "./bar"); testLoadingFromPackageJson("/a/b/c/d.ts", "/a/bar/package.json", "e.d.ts", "/a/bar/e.d.ts", "../../bar"); testLoadingFromPackageJson("/a/b/c/d.ts", "/bar/package.json", "e.d.ts", "/bar/e.d.ts", "/bar"); testLoadingFromPackageJson("c:/a/b/c/d.ts", "c:/bar/package.json", "e.d.ts", "c:/bar/e.d.ts", "c:/bar"); }); + function testTypingsIgnored(typings: any): void { + let containingFile = { name: "/a/b.ts" }; + let packageJson = { name: "/node_modules/b/package.json", content: JSON.stringify({ "typings": typings }) }; + let moduleFile = { name: "/a/b.d.ts" }; + + let indexPath = "/node_modules/b/index.d.ts"; + let indexFile = { name: indexPath } + + let resolution = nodeModuleNameResolver("b", containingFile.name, {}, createModuleResolutionHost(containingFile, packageJson, moduleFile, indexFile)); + + assert.equal(resolution.resolvedModule.resolvedFileName, indexPath); + } + + it("module name as directory - handle invalid 'typings'", () => { + testTypingsIgnored(["a", "b"]); + testTypingsIgnored({ "a": "b" }); + testTypingsIgnored(true); + testTypingsIgnored(null); + testTypingsIgnored(undefined); + }); + it("module name as directory - load index.d.ts", () => { let containingFile = { name: "/a/b/c.ts" }; let packageJson = { name: "/a/b/foo/package.json", content: JSON.stringify({ main: "/c/d" }) }; diff --git a/tslint.json b/tslint.json index 3cafdbfd39c..9b010d9a896 100644 --- a/tslint.json +++ b/tslint.json @@ -40,6 +40,7 @@ "no-null": true, "boolean-trivia": true, "type-operator-spacing": true, - "prefer-const": true + "prefer-const": true, + "no-in-operator": true } }