diff --git a/Gulpfile.ts b/Gulpfile.ts index 738ec10786..022606e133 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -2,6 +2,7 @@ import * as cp from "child_process"; import * as path from "path"; import * as fs from "fs"; +import child_process = require("child_process"); import originalGulp = require("gulp"); import helpMaker = require("gulp-help"); import runSequence = require("run-sequence"); @@ -1019,40 +1020,16 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) = } gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => { - const fileMatcher = RegExp(cmdLineOptions["files"]); if (fold.isTravis()) console.log(fold.start("lint")); - - let files: {stat: fs.Stats, path: string}[] = []; - return gulp.src(lintTargets, { read: false }) - .pipe(through2.obj((chunk, enc, cb) => { - files.push(chunk); - cb(); - }, (cb) => { - files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size); - const workerCount = cmdLineOptions["workers"]; - for (let i = 0; i < workerCount; i++) { - spawnLintWorker(files, finished); - } - - let completed = 0; - let failures = 0; - function finished(fails) { - completed++; - failures += fails; - if (completed === workerCount) { - if (fold.isTravis()) console.log(fold.end("lint")); - if (failures > 0) { - throw new Error(`Linter errors: ${failures}`); - } - else { - cb(); - } - } - } - })); + const fileMatcher = cmdLineOptions["files"]; + const files = fileMatcher + ? `src/**/${fileMatcher}` + : "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'"; + const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`; + console.log("Linting: " + cmd); + child_process.execSync(cmd, { stdio: [0, 1, 2] }); }); - gulp.task("default", "Runs 'local'", ["local"]); gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => { diff --git a/Jakefile.js b/Jakefile.js index 2b0f0fe1f4..fa4869c192 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -29,7 +29,8 @@ var thirdParty = "ThirdPartyNoticeText.txt"; var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter; if (process.env.path !== undefined) { process.env.path = nodeModulesPathPrefix + process.env.path; -} else if (process.env.PATH !== undefined) { +} +else if (process.env.PATH !== undefined) { process.env.PATH = nodeModulesPathPrefix + process.env.PATH; } @@ -312,13 +313,15 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts if (useDebugMode) { if (opts.inlineSourceMap) { options += " --inlineSourceMap --inlineSources"; - } else { + } + else { options += " -sourcemap"; if (!opts.noMapRoot) { options += " -mapRoot file:///" + path.resolve(path.dirname(outFile)); } } - } else { + } + else { options += " --newLine LF"; } @@ -748,7 +751,8 @@ function exec(cmd, completeHandler, errorHandler) { ex.addListener("error", function (e, status) { if (errorHandler) { errorHandler(e, status); - } else { + } + else { fail("Process exited with code " + status); } }); @@ -1006,21 +1010,32 @@ task("baseline-accept", function () { function acceptBaseline(sourceFolder, targetFolder) { console.log('Accept baselines from ' + sourceFolder + ' to ' + targetFolder); - var files = fs.readdirSync(sourceFolder); var deleteEnding = '.delete'; - for (var i in files) { - var filename = files[i]; - var fullLocalPath = path.join(sourceFolder, filename); - if (fs.statSync(fullLocalPath).isFile()) { - if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) { - filename = filename.substr(0, filename.length - deleteEnding.length); - fs.unlinkSync(path.join(targetFolder, filename)); - } else { - var target = path.join(targetFolder, filename); - if (fs.existsSync(target)) { - fs.unlinkSync(target); + + acceptBaselineFolder(sourceFolder, targetFolder); + + function acceptBaselineFolder(sourceFolder, targetFolder) { + var files = fs.readdirSync(sourceFolder); + + for (var i in files) { + var filename = files[i]; + var fullLocalPath = path.join(sourceFolder, filename); + var stat = fs.statSync(fullLocalPath); + if (stat.isFile()) { + if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) { + filename = filename.substr(0, filename.length - deleteEnding.length); + fs.unlinkSync(path.join(targetFolder, filename)); } - fs.renameSync(path.join(sourceFolder, filename), target); + else { + var target = path.join(targetFolder, filename); + if (fs.existsSync(target)) { + fs.unlinkSync(target); + } + fs.renameSync(path.join(sourceFolder, filename), target); + } + } + else if (stat.isDirectory()) { + acceptBaselineFolder(fullLocalPath, path.join(targetFolder, filename)); } } } @@ -1177,43 +1192,16 @@ function spawnLintWorker(files, callback) { } desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex"); -task("lint", ["build-rules"], function () { +task("lint", ["build-rules"], () => { if (fold.isTravis()) console.log(fold.start("lint")); - var startTime = mark(); - var failed = 0; - var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || ""); - var done = {}; - for (var i in lintTargets) { - var target = lintTargets[i]; - if (!done[target] && fileMatcher.test(target)) { - done[target] = fs.statSync(target).size; - } - } - - var workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length; - - var names = Object.keys(done).sort(function (namea, nameb) { - return done[namea] - done[nameb]; + const fileMatcher = process.env.f || process.env.file || process.env.files; + const files = fileMatcher + ? `src/**/${fileMatcher}` + : "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'"; + const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`; + console.log("Linting: " + cmd); + jake.exec([cmd], { interactive: true }, () => { + if (fold.isTravis()) console.log(fold.end("lint")); + complete(); }); - - for (var i = 0; i < workerCount; i++) { - spawnLintWorker(names, finished); - } - - var completed = 0; - var failures = 0; - function finished(fails) { - completed++; - failures += fails; - if (completed === workerCount) { - measure(startTime); - if (fold.isTravis()) console.log(fold.end("lint")); - if (failures > 0) { - fail('Linter errors.', failed); - } - else { - complete(); - } - } - } -}, { async: true }); +}); diff --git a/lib/tsc.js b/lib/tsc.js index be8abfb4a0..f7231fcafd 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -53977,7 +53977,7 @@ var ts; var padding = makePadding(marginLength); output.push(getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + ts.sys.newLine); output.push(padding + "tsc --outFile file.js file.ts" + ts.sys.newLine); - output.push(padding + "tsc @args.txt" + ts.sys.newLine); + output.push(padding + "tsc --project tsconfig.json" + ts.sys.newLine); output.push(ts.sys.newLine); output.push(getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine); var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0be7f52894..b02b33e56b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -288,6 +288,8 @@ namespace ts { let deferredGlobalAsyncIterableIteratorType: GenericType; let deferredGlobalTemplateStringsArrayType: ObjectType; let deferredJsxElementClassType: Type; + let deferredJsxElementType: Type; + let deferredJsxStatelessElementType: Type; let deferredNodes: Node[]; let deferredUnusedIdentifierNodes: Node[]; @@ -408,7 +410,6 @@ namespace ts { }); const typeofType = createTypeofType(); - let jsxElementType: Type; let _jsxNamespace: string; let _jsxFactoryEntity: EntityName; @@ -1072,9 +1073,10 @@ namespace ts { // block-scoped variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, // we want to check for block-scoped - if (meaning & SymbolFlags.BlockScopedVariable) { + if (meaning & SymbolFlags.BlockScopedVariable || + ((meaning & SymbolFlags.Class || meaning & SymbolFlags.Enum) && (meaning & SymbolFlags.Value) === SymbolFlags.Value)) { const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & SymbolFlags.BlockScopedVariable) { + if (exportOrLocalSymbol.flags & SymbolFlags.BlockScopedVariable || exportOrLocalSymbol.flags & SymbolFlags.Class || exportOrLocalSymbol.flags & SymbolFlags.Enum) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } @@ -1187,14 +1189,22 @@ namespace ts { } function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { - Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0); + Debug.assert(!!(result.flags & SymbolFlags.BlockScopedVariable || result.flags & SymbolFlags.Class || result.flags & SymbolFlags.Enum)); // Block-scoped variables cannot be used before their definition - const declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); + const declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) || isClassLike(d) || (d.kind === SyntaxKind.EnumDeclaration) ? d : undefined); - Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { - error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); + if (result.flags & SymbolFlags.BlockScopedVariable) { + error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } + else if (result.flags & SymbolFlags.Class) { + error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } + else if (result.flags & SymbolFlags.Enum) { + error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } } } @@ -2203,7 +2213,7 @@ namespace ts { typeToTypeNode, indexInfoToIndexSignatureDeclaration, signatureToSignatureDeclaration - } + }; return nodeBuilderCache; @@ -2359,7 +2369,7 @@ namespace ts { const typeParameter = getTypeParameterFromMappedType(type); const typeParameterNode = typeParameterToDeclaration(typeParameter, enclosingDeclaration, flags); - const templateType = getTemplateTypeFromMappedType(type) + const templateType = getTemplateTypeFromMappedType(type); const templateTypeNode = templateType && typeToTypeNodeWorker(templateType); const readonlyToken = (type).declaration && (type).declaration.readonlyToken ? createToken(SyntaxKind.ReadonlyKeyword) : undefined; const questionToken = (type).declaration && (type).declaration.questionToken ? createToken(SyntaxKind.QuestionToken) : undefined; @@ -2395,7 +2405,7 @@ namespace ts { symbolStack = []; } symbolStack.push(symbol); - let result = createTypeNodeFromObjectType(type); + const result = createTypeNodeFromObjectType(type); symbolStack.pop(); return result; } @@ -2537,7 +2547,7 @@ namespace ts { return; } const propertyName = oldDeclaration.name; - const optionalToken = propertySymbol.flags & SymbolFlags.Optional ? createToken(SyntaxKind.QuestionToken) : undefined;; + const optionalToken = propertySymbol.flags & SymbolFlags.Optional ? createToken(SyntaxKind.QuestionToken) : undefined; if (propertySymbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(propertyType).length) { const signatures = getSignaturesOfType(propertyType, SignatureKind.Call); for (const signature of signatures) { @@ -2632,13 +2642,12 @@ namespace ts { function symbolToName(symbol: Symbol, enclosingDeclaration: Node | undefined, expectsIdentifier: false, flags: NodeBuilderFlags): EntityName; function symbolToName(symbol: Symbol, enclosingDeclaration: Node | undefined, expectsIdentifier: boolean, flags: NodeBuilderFlags): EntityName { let parentSymbol: Symbol; - let meaning: SymbolFlags; // Try to get qualified name if the symbol is not a type parameter and there is an enclosing declaration. let chain: Symbol[]; const isTypeParameter = symbol.flags & SymbolFlags.TypeParameter; if (!isTypeParameter && enclosingDeclaration) { - chain = getSymbolChain(symbol, meaning, /*endOfChain*/ true); + chain = getSymbolChain(symbol, SymbolFlags.None, /*endOfChain*/ true); Debug.assert(chain && chain.length > 0); } else { @@ -2671,7 +2680,7 @@ namespace ts { } } if (typeParameters && typeParameters.length > 0) { - encounteredError = encounteredError || !(flags & NodeBuilderFlags.allowTypeParameterInQualifiedName);; + encounteredError = encounteredError || !(flags & NodeBuilderFlags.allowTypeParameterInQualifiedName); const writer = getSingleLineStringWriter(); const displayBuilder = getSymbolDisplayBuilder(); @@ -2683,7 +2692,7 @@ namespace ts { } const symbolName = getNameOfSymbol(symbol); const symbolNameWithTypeParameters = typeParameterString.length > 0 ? `${symbolName}<${typeParameterString}>` : symbolName; - let identifier = createIdentifier(symbolNameWithTypeParameters); + const identifier = createIdentifier(symbolNameWithTypeParameters); return index > 0 ? createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; } @@ -5686,7 +5695,8 @@ namespace ts { const excludeModifiers = isUnion ? ModifierFlags.NonPublicAccessibilityModifier : 0; // Flags we want to propagate to the result if they exist in all source symbols let commonFlags = isUnion ? SymbolFlags.None : SymbolFlags.Optional; - let checkFlags = CheckFlags.SyntheticProperty; + let syntheticFlag = CheckFlags.SyntheticMethod; + let checkFlags = 0; for (const current of types) { const type = getApparentType(current); if (type !== unknownType) { @@ -5705,6 +5715,9 @@ namespace ts { (modifiers & ModifierFlags.Protected ? CheckFlags.ContainsProtected : 0) | (modifiers & ModifierFlags.Private ? CheckFlags.ContainsPrivate : 0) | (modifiers & ModifierFlags.Static ? CheckFlags.ContainsStatic : 0); + if (!isMethodLike(prop)) { + syntheticFlag = CheckFlags.SyntheticProperty; + } } else if (isUnion) { checkFlags |= CheckFlags.Partial; @@ -5734,7 +5747,7 @@ namespace ts { propTypes.push(type); } const result = createSymbol(SymbolFlags.Property | commonFlags, name); - result.checkFlags = checkFlags; + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; result.declarations = declarations; result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -8820,8 +8833,8 @@ namespace ts { maybeStack[depth].set(id, RelationComparisonResult.Succeeded); depth++; const saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2; + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; let result: Ternary; if (expandingFlags === 3) { result = Ternary.Maybe; @@ -9187,7 +9200,7 @@ namespace ts { // Invoke the callback for each underlying property symbol of the given symbol and return the first // value that isn't undefined. function forEachProperty(prop: Symbol, callback: (p: Symbol) => T): T { - if (getCheckFlags(prop) & CheckFlags.SyntheticProperty) { + if (getCheckFlags(prop) & CheckFlags.Synthetic) { for (const t of (prop).containingType.types) { const p = getPropertyOfType(t, prop.name); const result = p && forEachProperty(p, callback); @@ -9241,21 +9254,23 @@ namespace ts { return false; } - // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case - // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible, - // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely expanding. - // Effectively, we will generate a false positive when two types are structurally equal to at least 10 levels, but unequal at - // some level beyond that. - function isDeeplyNestedGeneric(type: Type, stack: Type[], depth: number): boolean { - // We track type references (created by createTypeReference) and instantiated types (created by instantiateType) - if (getObjectFlags(type) & (ObjectFlags.Reference | ObjectFlags.Instantiated) && depth >= 5) { + // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons + // for 5 or more occurrences or instantiations of the type have been recorded on the given stack. It is possible, + // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely + // expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5 + // levels, but unequal at some level beyond that. + function isDeeplyNestedType(type: Type, stack: Type[], depth: number): boolean { + // We track all object types that have an associated symbol (representing the origin of the type) + if (depth >= 5 && type.flags & TypeFlags.Object) { const symbol = type.symbol; - let count = 0; - for (let i = 0; i < depth; i++) { - const t = stack[i]; - if (getObjectFlags(t) & (ObjectFlags.Reference | ObjectFlags.Instantiated) && t.symbol === symbol) { - count++; - if (count >= 5) return true; + if (symbol) { + let count = 0; + for (let i = 0; i < depth; i++) { + const t = stack[i]; + if (t.flags & TypeFlags.Object && t.symbol === symbol) { + count++; + if (count >= 5) return true; + } } } } @@ -9998,7 +10013,7 @@ namespace ts { if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } const key = source.id + "," + target.id; @@ -13006,12 +13021,12 @@ namespace ts { type.flags & TypeFlags.UnionOrIntersection && !forEach((type).types, t => !isValidSpreadType(t))); } - function checkJsxSelfClosingElement(node: JsxSelfClosingElement) { + function checkJsxSelfClosingElement(node: JsxSelfClosingElement): Type { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } - function checkJsxElement(node: JsxElement) { + function checkJsxElement(node: JsxElement): Type { // Check attributes checkJsxOpeningLikeElement(node.openingElement); @@ -13038,7 +13053,7 @@ namespace ts { } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } /** @@ -13279,13 +13294,14 @@ namespace ts { function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement: JsxOpeningLikeElement, elementType: Type, elemInstanceType: Type, elementClassType?: Type): Type { Debug.assert(!(elementType.flags & TypeFlags.Union)); if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { - if (jsxElementType) { + const jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { // We don't call getResolvedSignature here because we have already resolve the type of JSX Element. const callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, /*candidatesOutArray*/ undefined); if (callSignature !== unknownSignature) { const callReturnType = callSignature && getReturnTypeOfSignature(callSignature); let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { // Intersect in JSX.IntrinsicAttributes if it exists const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); if (intrinsicAttributes !== unknownType) { @@ -13313,7 +13329,8 @@ namespace ts { Debug.assert(!(elementType.flags & TypeFlags.Union)); if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { // Is this is a stateless function component? See if its single signature's return type is assignable to the JSX Element Type - if (jsxElementType) { + const jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { // We don't call getResolvedSignature because here we have already resolve the type of JSX Element. const candidatesOutArray: Signature[] = []; getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); @@ -13322,7 +13339,7 @@ namespace ts { for (const candidate of candidatesOutArray) { const callReturnType = getReturnTypeOfSignature(candidate); const paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { let shouldBeCandidate = true; for (const attribute of openingLikeElement.attributes.properties) { if (isJsxAttribute(attribute) && @@ -13566,6 +13583,23 @@ namespace ts { return deferredJsxElementClassType; } + function getJsxGlobalElementType(): Type { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + + function getJsxGlobalStatelessElementType(): Type { + if (!deferredJsxStatelessElementType) { + const jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } + } + return deferredJsxStatelessElementType; + } + /** * Returns all the properties of the Jsx.IntrinsicElements interface */ @@ -13580,7 +13614,7 @@ namespace ts { error(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { + if (getJsxGlobalElementType() === undefined) { if (noImplicitAny) { error(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } @@ -13669,7 +13703,7 @@ namespace ts { const flags = getCombinedModifierFlags(s.valueDeclaration); return s.parent && s.parent.flags & SymbolFlags.Class ? flags : flags & ~ModifierFlags.AccessibilityModifier; } - if (getCheckFlags(s) & CheckFlags.SyntheticProperty) { + if (getCheckFlags(s) & CheckFlags.Synthetic) { const checkFlags = (s).checkFlags; const accessModifier = checkFlags & CheckFlags.ContainsPrivate ? ModifierFlags.Private : checkFlags & CheckFlags.ContainsPublic ? ModifierFlags.Public : @@ -13687,6 +13721,10 @@ namespace ts { return s.valueDeclaration ? getCombinedNodeFlags(s.valueDeclaration) : 0; } + function isMethodLike(symbol: Symbol) { + return !!(symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod); + } + /** * Check whether the requested property access is valid. * Returns true if node is a valid property access, and false otherwise. @@ -13716,11 +13754,11 @@ namespace ts { // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. if (languageVersion < ScriptTarget.ES2015) { - const propKind = getDeclarationKindFromSymbol(prop); - if (propKind !== SyntaxKind.MethodDeclaration && propKind !== SyntaxKind.MethodSignature) { - // `prop` refers to a *property* declared in the super class - // rather than a *method*, so it does not satisfy the above criteria. - + const hasNonMethodDeclaration = forEachProperty(prop, p => { + const propKind = getDeclarationKindFromSymbol(p); + return propKind !== SyntaxKind.MethodDeclaration && propKind !== SyntaxKind.MethodSignature; + }); + if (hasNonMethodDeclaration) { error(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -13871,10 +13909,17 @@ namespace ts { } return unknownType; } - if (prop.valueDeclaration && - isInPropertyInitializer(node) && - !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { - error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === SyntaxKind.ClassDeclaration && + node.parent && node.parent.kind !== SyntaxKind.TypeReference && + !isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, Diagnostics.Class_0_used_before_its_declaration, right.text); + } } markPropertyAsReferenced(prop); @@ -15659,8 +15704,8 @@ namespace ts { else { let types: Type[]; if (functionFlags & FunctionFlags.Generator) { // Generator or AsyncGenerator function - types = checkAndAggregateYieldOperandTypes(func, checkMode); - if (types.length === 0) { + types = concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { const iterableIteratorAny = functionFlags & FunctionFlags.Async ? createAsyncIterableIteratorType(anyType) // AsyncGenerator function : createIterableIteratorType(anyType); // Generator function @@ -19301,7 +19346,7 @@ namespace ts { // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.NonPrimitive)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -20121,14 +20166,6 @@ namespace ts { error(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (baseType.symbol && baseType.symbol.valueDeclaration && - !isInAmbientContext(baseType.symbol.valueDeclaration) && - baseType.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType.symbol.valueDeclaration, node)) { - error(baseTypeNode, Diagnostics.A_class_must_be_declared_after_its_base_class); - } - } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & SymbolFlags.Class) && !(baseConstructorType.flags & TypeFlags.TypeVariable)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type @@ -20254,7 +20291,7 @@ namespace ts { else { // derived overrides base. const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & ModifierFlags.Private) || (derivedDeclarationFlags & ModifierFlags.Private)) { + if (baseDeclarationFlags & ModifierFlags.Private || derivedDeclarationFlags & ModifierFlags.Private) { // either base or derived property is private - not override, skip it continue; } @@ -20264,28 +20301,24 @@ namespace ts { continue; } - if ((base.flags & derived.flags & SymbolFlags.Method) || ((base.flags & SymbolFlags.PropertyOrAccessor) && (derived.flags & SymbolFlags.PropertyOrAccessor))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & SymbolFlags.PropertyOrAccessor && derived.flags & SymbolFlags.PropertyOrAccessor) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } let errorMessage: DiagnosticMessage; - if (base.flags & SymbolFlags.Method) { + if (isMethodLike(base)) { if (derived.flags & SymbolFlags.Accessor) { errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - Debug.assert((derived.flags & SymbolFlags.Property) !== 0); errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & SymbolFlags.Property) { - Debug.assert((derived.flags & SymbolFlags.Method) !== 0); errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - Debug.assert((base.flags & SymbolFlags.Accessor) !== 0); - Debug.assert((derived.flags & SymbolFlags.Method) !== 0); errorMessage = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } @@ -21944,7 +21977,7 @@ namespace ts { } function getRootSymbols(symbol: Symbol): Symbol[] { - if (getCheckFlags(symbol) & CheckFlags.SyntheticProperty) { + if (getCheckFlags(symbol) & CheckFlags.Synthetic) { const symbols: Symbol[] = []; const name = symbol.name; forEach(getSymbolLinks(symbol).containingType.types, t => { @@ -22625,7 +22658,6 @@ namespace ts { globalNumberType = getGlobalType("Number", /*arity*/ 0, /*reportErrors*/ true); globalBooleanType = getGlobalType("Boolean", /*arity*/ 0, /*reportErrors*/ true); globalRegExpType = getGlobalType("RegExp", /*arity*/ 0, /*reportErrors*/ true); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4b3dc23d56..41d71c79ac 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -9,40 +9,13 @@ namespace ts { export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" }; /* @internal */ export const optionDeclarations: CommandLineOption[] = [ - { - name: "charset", - type: "string", - }, - compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, + // CommandLine only options { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, description: Diagnostics.Print_this_message, }, { @@ -50,53 +23,71 @@ namespace ts { shortName: "?", type: "boolean" }, + { + name: "all", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + description: Diagnostics.Show_all_compiler_options, + }, + { + name: "version", + shortName: "v", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + description: Diagnostics.Print_the_compiler_s_version, + }, { name: "init", type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, description: Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { - name: "inlineSourceMap", - type: "boolean", - }, - { - name: "inlineSources", - type: "boolean", - }, - { - name: "jsx", - type: createMapFromTemplate({ - "preserve": JsxEmit.Preserve, - "react-native": JsxEmit.ReactNative, - "react": JsxEmit.React - }), - paramType: Diagnostics.KIND, - description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", - type: "string", - description: Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", - type: "boolean", - }, - { - name: "locale", - type: "string", - }, - { - name: "mapRoot", + name: "project", + shortName: "p", type: "string", isFilePath: true, - description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: Diagnostics.LOCATION, + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + paramType: Diagnostics.FILE_OR_DIRECTORY, + description: Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + }, + { + name: "pretty", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental + }, + { + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + description: Diagnostics.Watch_input_files, + }, + + // Basic + { + name: "target", + shortName: "t", + type: createMapFromTemplate({ + "es3": ScriptTarget.ES3, + "es5": ScriptTarget.ES5, + "es6": ScriptTarget.ES2015, + "es2015": ScriptTarget.ES2015, + "es2016": ScriptTarget.ES2016, + "es2017": ScriptTarget.ES2017, + "esnext": ScriptTarget.ESNext, + }), + paramType: Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { name: "module", @@ -110,305 +101,10 @@ namespace ts { "es6": ModuleKind.ES2015, "es2015": ModuleKind.ES2015, }), - description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, paramType: Diagnostics.KIND, - }, - { - name: "newLine", - type: createMapFromTemplate({ - "crlf": NewLineKind.CarriageReturnLineFeed, - "lf": NewLineKind.LineFeed - }), - description: Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", - type: "boolean", - description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: Diagnostics.Report_errors_on_unused_locals, - }, - { - name: "noUnusedParameters", - type: "boolean", - description: Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noLib", - type: "boolean", - }, - { - name: "noResolve", - type: "boolean", - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - }, - { - name: "skipLibCheck", - type: "boolean", - description: Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files - // for correct behaviour, please use outFile - paramType: Diagnostics.FILE, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - description: Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: Diagnostics.FILE, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - description: Diagnostics.Redirect_output_structure_to_the_directory, - paramType: Diagnostics.DIRECTORY, - }, - { - name: "preserveConstEnums", - type: "boolean", - description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" - }, - { - name: "project", - shortName: "p", - type: "string", - isFilePath: true, - description: Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, - paramType: Diagnostics.FILE_OR_DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: Diagnostics.LOCATION, - description: Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "isolatedModules", - type: "boolean", - }, - { - name: "sourceMap", - type: "boolean", - description: Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: Diagnostics.LOCATION, - }, - { - name: "suppressExcessPropertyErrors", - type: "boolean", - description: Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true - }, - { - name: "suppressImplicitAnyIndexErrors", - type: "boolean", - description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, - }, - { - name: "stripInternal", - type: "boolean", - description: Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true - }, - { - name: "target", - shortName: "t", - type: createMapFromTemplate({ - "es3": ScriptTarget.ES3, - "es5": ScriptTarget.ES5, - "es6": ScriptTarget.ES2015, - "es2015": ScriptTarget.ES2015, - "es2016": ScriptTarget.ES2016, - "es2017": ScriptTarget.ES2017, - "esnext": ScriptTarget.ESNext, - }), - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, - paramType: Diagnostics.VERSION, - }, - { - name: "version", - shortName: "v", - type: "boolean", - description: Diagnostics.Print_the_compiler_s_version, - }, - { - name: "watch", - shortName: "w", - type: "boolean", - description: Diagnostics.Watch_input_files, - }, - { - name: "experimentalDecorators", - type: "boolean", - description: Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - experimental: true, - description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "moduleResolution", - type: createMapFromTemplate({ - "node": ModuleResolutionKind.NodeJs, - "classic": ModuleResolutionKind.Classic, - }), - description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: Diagnostics.STRATEGY, - }, - { - name: "allowUnusedLabels", - type: "boolean", - description: Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "noImplicitReturns", - type: "boolean", - description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "allowUnreachableCode", - type: "boolean", - description: Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "downlevelIteration", - type: "boolean", - description: Diagnostics.Use_full_down_level_iteration_for_iterables_and_arrays_for_for_of_spread_and_destructuring_in_ES5_Slash3 - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - description: Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "paths", - type: "object", - isTSConfigOnly: true - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - } - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - } - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - description: Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "traceResolution", - type: "boolean", - description: Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "allowJs", - type: "boolean", - description: Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "noImplicitUseStrict", - type: "boolean", - description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "listEmittedFiles", - type: "boolean" + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { name: "lib", @@ -446,31 +142,475 @@ namespace ts { "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", }), }, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "disableSizeLimit", - type: "boolean" + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "strictNullChecks", + name: "jsx", + type: createMapFromTemplate({ + "preserve": JsxEmit.Preserve, + "react-native": JsxEmit.ReactNative, + "react": JsxEmit.React + }), + paramType: Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", type: "boolean", - description: Diagnostics.Enable_strict_null_checks + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: Diagnostics.LOCATION, + category: Diagnostics.Basic_Options, + description: Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Do_not_emit_outputs, }, { name: "importHelpers", type: "boolean", + category: Diagnostics.Basic_Options, description: Diagnostics.Import_emit_helpers_from_tslib }, + { + name: "downlevelIteration", + type: "boolean", + category: Diagnostics.Basic_Options, + description: Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: Diagnostics.Basic_Options, + description: Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + + // Strict Type Checks + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, + description: Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, + description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, + description: Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, + description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "alwaysStrict", type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file }, + + // Additional Checks { - name: "strict", + name: "noUnusedLocals", type: "boolean", - description: Diagnostics.Enable_all_strict_type_checks + showInSimplifiedHelpView: true, + category: Diagnostics.Additional_Checks, + description: Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Additional_Checks, + description: Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Additional_Checks, + description: Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Additional_Checks, + description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + + // Module Resolution + { + name: "moduleResolution", + type: createMapFromTemplate({ + "node": ModuleResolutionKind.NodeJs, + "classic": ModuleResolutionKind.Classic, + }), + paramType: Diagnostics.STRATEGY, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: Diagnostics.Module_Resolution_Options, + description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + + // Source Maps + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: Diagnostics.LOCATION, + category: Diagnostics.Source_Map_Options, + description: Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: Diagnostics.LOCATION, + category: Diagnostics.Source_Map_Options, + description: Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: Diagnostics.Source_Map_Options, + description: Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: Diagnostics.Source_Map_Options, + description: Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + + // Experimental + { + name: "experimentalDecorators", + type: "boolean", + category: Diagnostics.Experimental_Options, + description: Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: Diagnostics.Experimental_Options, + description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + + // Advanced + { + name: "jsxFactory", + type: "string", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + + { + name: "out", + type: "string", + isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files + // for correct behaviour, please use outFile + category: Diagnostics.Advanced_Options, + paramType: Diagnostics.FILE, + description: Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: Diagnostics.Advanced_Options, + description: Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: Diagnostics.Advanced_Options, + description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: createMapFromTemplate({ + "crlf": NewLineKind.CarriageReturnLineFeed, + "lf": NewLineKind.LineFeed + }), + paramType: Diagnostics.NEWLINE, + category: Diagnostics.Advanced_Options, + description: Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: Diagnostics.DIRECTORY, + category: Diagnostics.Advanced_Options, + description: Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: Diagnostics.Advanced_Options, + description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files }, { // A list of plugins to load in the language service @@ -480,7 +620,8 @@ namespace ts { element: { name: "plugin", type: "object" - } + }, + description: Diagnostics.List_of_language_service_plugins } ]; @@ -525,8 +666,7 @@ namespace ts { export const defaultInitCompilerOptions: CompilerOptions = { module: ModuleKind.CommonJS, target: ScriptTarget.ES5, - strict: true, - sourceMap: false, + strict: true }; let optionNameMapCache: OptionNameMap; @@ -749,9 +889,9 @@ namespace ts { * @param fileNames array of filenames to be generated into tsconfig.json */ /* @internal */ - export function generateTSConfig(options: CompilerOptions, fileNames: string[]): { compilerOptions: MapLike } { + export function generateTSConfig(options: CompilerOptions, fileNames: string[]): string { const compilerOptions = extend(options, defaultInitCompilerOptions); - const configurations: any = { + const configurations: { compilerOptions: MapLike; files?: string[] } = { compilerOptions: serializeCompilerOptions(compilerOptions) }; if (fileNames && fileNames.length) { @@ -759,7 +899,8 @@ namespace ts { configurations.files = fileNames; } - return configurations; + + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): Map | undefined { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { @@ -791,43 +932,123 @@ namespace ts { if (hasProperty(options, name)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - const value = options[name]; - const optionDefinition = optionsNameMap.get(name.toLowerCase()); - if (optionDefinition) { - const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - // There is no map associated with this compiler option then use the value as-is - // This is the case if the value is expect to be string, number, boolean or list of string - result[name] = value; - } - else { - if (optionDefinition.type === "list") { - const convertedValue: string[] = []; - for (const element of value as (string | number)[]) { - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name] = convertedValue; - } - else { - // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name] = getNameOfCompilerOptionValue(value, customTypeMap); - } + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === Diagnostics.Command_line_Options) { + continue; + } + const value = options[name]; + const optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + // There is no map associated with this compiler option then use the value as-is + // This is the case if the value is expect to be string, number, boolean or list of string + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + const convertedValue: string[] = []; + for (const element of value as (string | number)[]) { + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + // There is a typeMap associated with this command-line option so use it to map value back to its name + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + + function getDefaultValueForOption(option: CommandLineOption) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return arrayFrom((option).type.keys())[0]; + } + } + + function makePadding(paddingLength: number): string { + return Array(paddingLength + 1).join(" "); + } + + function writeConfigurations() { + // Filter applicable options to place in the file + const categorizedOptions = reduceLeft( + filter(optionDeclarations, o => o.category !== Diagnostics.Command_line_Options && o.category !== Diagnostics.Advanced_Options), + (memo, value) => { + if (value.category) { + const name = getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, >{}); + + // Serialize all options and thier descriptions + let marginLength = 0; + let seenKnownKeys = 0; + const nameColumn: string[] = []; + const descriptionColumn: string[] = []; + const knownKesyCount = getOwnKeys(configurations.compilerOptions).length; + for (const category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push(`/* ${category} */`); + descriptionColumn.push(""); + for (const option of categorizedOptions[category]) { + let optionName; + if (hasProperty(configurations.compilerOptions, option.name)) { + optionName = `"${option.name}": ${JSON.stringify(configurations.compilerOptions[option.name])}${(seenKnownKeys += 1) === knownKesyCount ? "" : ","}`; + } + else { + optionName = `// "${option.name}": ${JSON.stringify(getDefaultValueForOption(option))},`; + } + nameColumn.push(optionName); + descriptionColumn.push(`/* ${option.description && getLocaleSpecificMessage(option.description) || option.name} */`); + marginLength = Math.max(optionName.length, marginLength); + } + } + + // Write the output + const tab = makePadding(2); + const result: string[] = []; + result.push(`{`); + result.push(`${tab}"compilerOptions": {`); + // Print out each row, aligning all the descriptions on the same column. + for (let i = 0; i < nameColumn.length; i++) { + const optionName = nameColumn[i]; + const description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(`${tab}},`); + result.push(`${tab}"files": [`); + for (let i = 0; i < configurations.files.length; i++) { + result.push(`${tab}${tab}${JSON.stringify(configurations.files[i])}${i === configurations.files.length - 1 ? "" : ","}`); + } + result.push(`${tab}]`); + } + else { + result.push(`${tab}}`); + } + result.push(`}`); + + return result.join(sys.newLine); + } } /** @@ -1430,4 +1651,4 @@ namespace ts { function caseInsensitiveKeyMapper(key: string) { return key.toLowerCase(); } -} +} \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 919158645a..92812604b8 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1,4 +1,4 @@ -{ +{ "Unterminated string literal.": { "category": "Error", "code": 1002 @@ -1435,6 +1435,14 @@ "category": "Error", "code": 2448 }, + "Class '{0}' used before its declaration.": { + "category": "Error", + "code": 2449 + }, + "Enum '{0}' used before its declaration.": { + "category": "Error", + "code": 2450 + }, "Cannot redeclare block-scoped variable '{0}'.": { "category": "Error", "code": 2451 @@ -2019,10 +2027,6 @@ "category": "Error", "code": 2689 }, - "A class must be declared after its base class.": { - "category": "Error", - "code": 2690 - }, "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.": { "category": "Error", "code": 2691 @@ -2781,7 +2785,7 @@ "category": "Message", "code": 6083 }, - "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit.": { + "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit": { "category": "Message", "code": 6084 }, @@ -3037,14 +3041,139 @@ "category": "Message", "code": 6148 }, - "Use full down-level iteration for iterables and arrays for 'for-of', spread, and destructuring in ES5/3.": { + "Show diagnostic information.": { "category": "Message", "code": 6149 }, - "Enable all strict type checks.": { + "Show verbose diagnostic information.": { "category": "Message", "code": 6150 }, + "Emit a single file with source maps instead of having a separate file.": { + "category": "Message", + "code": 6151 + }, + "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set.": { + "category": "Message", + "code": 6152 + }, + "Transpile each file as a separate module (similar to 'ts.transpileModule').": { + "category": "Message", + "code": 6153 + }, + "Print names of generated files part of the compilation.": { + "category": "Message", + "code": 6154 + }, + "Print names of files part of the compilation.": { + "category": "Message", + "code": 6155 + }, + "The locale used when displaying messages to the user (e.g. 'en-us')": { + "category": "Message", + "code": 6156 + }, + "Do not generate custom helper functions like '__extends' in compiled output.": { + "category": "Message", + "code": 6157 + }, + "Do not include the default library file (lib.d.ts).": { + "category": "Message", + "code": 6158 + }, + "Do not add triple-slash references or imported modules to the list of compiled files.": { + "category": "Message", + "code": 6159 + }, + "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files.": { + "category": "Message", + "code": 6160 + }, + "List of folders to include type definitions from.": { + "category": "Message", + "code": 6161 + }, + "Disable size limitations on JavaScript projects.": { + "category": "Message", + "code": 6162 + }, + "The character set of the input files.": { + "category": "Message", + "code": 6163 + }, + "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.": { + "category": "Message", + "code": 6164 + }, + "Do not truncate error messages.": { + "category": "Message", + "code": 6165 + }, + "Output directory for generated declaration files.": { + "category": "Message", + "code": 6166 + }, + "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'.": { + "category": "Message", + "code": 6167 + }, + "List of root folders whose combined content represents the structure of the project at runtime.": { + "category": "Message", + "code": 6168 + }, + "Show all compiler options.": { + "category": "Message", + "code": 6169 + }, + "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file": { + "category": "Message", + "code": 6170 + }, + "Command-line Options": { + "category": "Message", + "code": 6171 + }, + "Basic Options": { + "category": "Message", + "code": 6172 + }, + "Strict Type-Checking Options": { + "category": "Message", + "code": 6173 + }, + "Module Resolution Options": { + "category": "Message", + "code": 6174 + }, + "Source Map Options": { + "category": "Message", + "code": 6175 + }, + "Additional Checks": { + "category": "Message", + "code": 6176 + }, + "Experimental Options": { + "category": "Message", + "code": 6177 + }, + "Advanced Options": { + "category": "Message", + "code": 6178 + }, + "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'.": { + "category": "Message", + "code": 6179 + }, + "Enable all strict type-checking options.": { + "category": "Message", + "code": 6180 + }, + "List of language service plugins.": { + "category": "Message", + "code": 6181 + }, + "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 0d2dee8cfd..08dc91c6b2 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -46,7 +46,7 @@ namespace ts { */ /* @internal */ export function getSynthesizedClone(node: T | undefined): T { - if(node === undefined) { + if (node === undefined) { return undefined; } // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of @@ -334,7 +334,7 @@ namespace ts { export function createTypeOperatorNode(type: TypeNode) { const typeOperatorNode = createSynthesizedNode(SyntaxKind.TypeOperator) as TypeOperatorNode; typeOperatorNode.operator = SyntaxKind.KeyOfKeyword; - typeOperatorNode.type = type + typeOperatorNode.type = type; return typeOperatorNode; } @@ -423,7 +423,7 @@ namespace ts { return updateSignatureDeclaration(node, typeParameters, parameters, type); } - export function createMethodSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature{ + export function createMethodSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature { const methodSignature = createSignatureDeclaration(SyntaxKind.MethodSignature, typeParameters, parameters, type) as MethodSignature; methodSignature.name = asName(name); methodSignature.questionToken = questionToken; @@ -1749,7 +1749,7 @@ namespace ts { // Clauses - export function createHeritageClause(token: SyntaxKind, types: ExpressionWithTypeArguments[]) { + export function createHeritageClause(token: HeritageClause["token"], types: ExpressionWithTypeArguments[]) { const node = createSynthesizedNode(SyntaxKind.HeritageClause); node.token = token; node.types = createNodeArray(types); diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 1911605a0a..699919e056 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f2175f385e..ee74ce9c9a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5437,9 +5437,10 @@ namespace ts { } function parseHeritageClause(): HeritageClause | undefined { - if (token() === SyntaxKind.ExtendsKeyword || token() === SyntaxKind.ImplementsKeyword) { + const tok = token(); + if (tok === SyntaxKind.ExtendsKeyword || tok === SyntaxKind.ImplementsKeyword) { const node = createNode(SyntaxKind.HeritageClause); - node.token = token(); + node.token = tok; nextToken(); node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments); return finishNode(node); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e117761a3a..cffb6df1e3 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -298,8 +298,8 @@ namespace ts { let noDiagnosticsTypeChecker: TypeChecker; let classifiableNames: Map; - let cachedSemanticDiagnosticsForFile: DiagnosticCache = {}; - let cachedDeclarationDiagnosticsForFile: DiagnosticCache = {}; + const cachedSemanticDiagnosticsForFile: DiagnosticCache = {}; + const cachedDeclarationDiagnosticsForFile: DiagnosticCache = {}; let resolvedTypeReferenceDirectives = createMap(); let fileProcessingDiagnostics = createDiagnosticCollection(); @@ -1105,7 +1105,7 @@ namespace ts { return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); } - function getDeclarationDiagnosticsForFileNoCache(sourceFile: SourceFile| undefined, cancellationToken: CancellationToken) { + function getDeclarationDiagnosticsForFileNoCache(sourceFile: SourceFile | undefined, cancellationToken: CancellationToken) { return runWithCancellationToken(() => { const resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); // Don't actually write any files since we're just getting diagnostics. diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 32b6a90e26..4fd3ecb02b 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -225,9 +225,9 @@ namespace ts { return sys.exit(ExitStatus.Success); } - if (commandLine.options.help) { + if (commandLine.options.help || commandLine.options.all) { printVersion(); - printHelp(); + printHelp(commandLine.options.all); return sys.exit(ExitStatus.Success); } @@ -264,7 +264,7 @@ namespace ts { if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); - printHelp(); + printHelp(commandLine.options.all); return sys.exit(ExitStatus.Success); } @@ -618,7 +618,7 @@ namespace ts { sys.write(getDiagnosticText(Diagnostics.Version_0, ts.version) + sys.newLine); } - function printHelp() { + function printHelp(showAllOptions: boolean) { const output: string[] = []; // We want to align our "syntax" and "examples" commands to a certain margin. @@ -643,8 +643,9 @@ namespace ts { output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine); // Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch") - const optsList = filter(optionDeclarations.slice(), v => !v.experimental); - optsList.sort((a, b) => compareValues(a.name.toLowerCase(), b.name.toLowerCase())); + const optsList = showAllOptions ? + optionDeclarations.slice().sort((a, b) => compareValues(a.name.toLowerCase(), b.name.toLowerCase())) : + filter(optionDeclarations.slice(), v => v.showInSimplifiedHelpView); // We want our descriptions to align at the same column in our output, // so we keep track of the longest option usage string. @@ -738,7 +739,7 @@ namespace ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), /* host */ undefined); } else { - sys.writeFile(file, JSON.stringify(generateTSConfig(options, fileNames), undefined, 4)); + sys.writeFile(file, generateTSConfig(options, fileNames)); reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* host */ undefined); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f07338503e..461e33426e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -815,18 +815,21 @@ namespace ts { export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { kind: SyntaxKind.Constructor; + parent?: ClassDeclaration | ClassExpression; body?: FunctionBody; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.*/ export interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; + parent?: ClassDeclaration | ClassExpression; } // See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a // ClassElement and an ObjectLiteralElement. export interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.GetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } @@ -835,6 +838,7 @@ namespace ts { // ClassElement and an ObjectLiteralElement. export interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.SetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } @@ -843,6 +847,7 @@ namespace ts { export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { kind: SyntaxKind.IndexSignature; + parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode; } export interface TypeNode extends Node { @@ -867,15 +872,13 @@ namespace ts { kind: SyntaxKind.ThisType; } - export interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; - } + export type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; - export interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + export interface FunctionTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.FunctionType; } - export interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + export interface ConstructorTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.ConstructorType; } @@ -912,17 +915,16 @@ namespace ts { elementTypes: NodeArray; } - export interface UnionOrIntersectionTypeNode extends TypeNode { - kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; + export type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; + + export interface UnionTypeNode extends TypeNode { + kind: SyntaxKind.UnionType; types: NodeArray; } - export interface UnionTypeNode extends UnionOrIntersectionTypeNode { - kind: SyntaxKind.UnionType; - } - - export interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + export interface IntersectionTypeNode extends TypeNode { kind: SyntaxKind.IntersectionType; + types: NodeArray; } export interface ParenthesizedTypeNode extends TypeNode { @@ -944,6 +946,7 @@ namespace ts { export interface MappedTypeNode extends TypeNode, Declaration { kind: SyntaxKind.MappedType; + parent?: TypeAliasDeclaration; readonlyToken?: ReadonlyToken; typeParameter: TypeParameterDeclaration; questionToken?: QuestionToken; @@ -1457,7 +1460,7 @@ namespace ts { kind: SyntaxKind.NewExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray; - arguments: NodeArray; + arguments?: NodeArray; } export interface TaggedTemplateExpression extends MemberExpression { @@ -1511,6 +1514,7 @@ namespace ts { export type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; export interface JsxAttributes extends ObjectLiteralExpressionBase { + parent?: JsxOpeningLikeElement; } /// The opening element of a ... JsxElement @@ -1530,7 +1534,7 @@ namespace ts { export interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; - parent?: JsxOpeningLikeElement; + parent?: JsxAttributes; name: Identifier; /// JSX attribute initializers are optional; is sugar for initializer?: StringLiteral | JsxExpression; @@ -1538,7 +1542,7 @@ namespace ts { export interface JsxSpreadAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxSpreadAttribute; - parent?: JsxOpeningLikeElement; + parent?: JsxAttributes; expression: Expression; } @@ -1783,8 +1787,8 @@ namespace ts { export interface HeritageClause extends Node { kind: SyntaxKind.HeritageClause; parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression; - token: SyntaxKind; - types?: NodeArray; + token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; + types: NodeArray; } export interface TypeAliasDeclaration extends DeclarationStatement { @@ -2230,7 +2234,7 @@ namespace ts { endOfFileToken: Token; fileName: string; - /* internal */ path: Path; + /* @internal */ path: Path; text: string; amdDependencies: AmdDependency[]; @@ -2853,13 +2857,15 @@ namespace ts { export const enum CheckFlags { Instantiated = 1 << 0, // Instantiated symbol SyntheticProperty = 1 << 1, // Property in union or intersection type - Readonly = 1 << 2, // Readonly transient symbol - Partial = 1 << 3, // Synthetic property present in some but not all constituents - HasNonUniformType = 1 << 4, // Synthetic property with non-uniform type in constituents - ContainsPublic = 1 << 5, // Synthetic property with public constituent(s) - ContainsProtected = 1 << 6, // Synthetic property with protected constituent(s) - ContainsPrivate = 1 << 7, // Synthetic property with private constituent(s) - ContainsStatic = 1 << 8, // Synthetic property with static constituent(s) + SyntheticMethod = 1 << 2, // Method in union or intersection type + Readonly = 1 << 3, // Readonly transient symbol + Partial = 1 << 4, // Synthetic property present in some but not all constituents + HasNonUniformType = 1 << 5, // Synthetic property with non-uniform type in constituents + ContainsPublic = 1 << 6, // Synthetic property with public constituent(s) + ContainsProtected = 1 << 7, // Synthetic property with protected constituent(s) + ContainsPrivate = 1 << 8, // Synthetic property with private constituent(s) + ContainsStatic = 1 << 9, // Synthetic property with static constituent(s) + Synthetic = SyntheticProperty | SyntheticMethod } /* @internal */ @@ -3036,7 +3042,6 @@ namespace ts { ObjectLiteral = 1 << 7, // Originates in an object literal EvolvingArray = 1 << 8, // Evolving array type ObjectLiteralPatternWithComputedProperties = 1 << 9, // Object literal pattern with computed properties - NonPrimitive = 1 << 10, // NonPrimitive object type ClassOrInterface = Class | Interface } @@ -3353,6 +3358,7 @@ namespace ts { export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[]; export interface CompilerOptions { + /*@internal*/ all?: boolean; allowJs?: boolean; /*@internal*/ allowNonTsExtensions?: boolean; allowSyntheticDefaultImports?: boolean; @@ -3545,8 +3551,10 @@ namespace ts { shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter - experimental?: boolean; isTSConfigOnly?: boolean; // True if option can only be specified via tsconfig.json file + isCommandLineOnly?: boolean; + showInSimplifiedHelpView?: boolean; + category?: DiagnosticMessage; } /* @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 656b3c5db4..57c00ed8fb 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -524,7 +524,7 @@ namespace ts { export function declarationNameToString(name: DeclarationName) { return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } - + export function getNameFromIndexInfo(info: IndexInfo) { return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; } @@ -2679,7 +2679,7 @@ namespace ts { if (sourceFiles.length) { const jsFilePath = options.outFile || options.out; const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - const declarationFilePath = options.declaration ? removeFileExtension(jsFilePath) + ".d.ts" : undefined; + const declarationFilePath = options.declaration ? removeFileExtension(jsFilePath) + ".d.ts" : ""; action({ jsFilePath, sourceMapFilePath, declarationFilePath }, createBundle(sourceFiles), emitOnlyDtsFiles); } } diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index e6df9c211e..b8eb0210d0 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -2,7 +2,7 @@ /// /// -namespace ts { +namespace ts { export const nullTransformationContext: TransformationContext = { enableEmitNotification: noop, enableSubstitution: noop, diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 0863b8e2d4..4ef6b54e1b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -927,10 +927,9 @@ namespace FourSlash { this.assertObjectsEqual(fullActual, fullExpected); } - function rangeToReferenceEntry(r: Range) { - let { isWriteAccess, isDefinition, isInString } = (r.marker && r.marker.data) || { isWriteAccess: false, isDefinition: false, isInString: undefined }; - isWriteAccess = !!isWriteAccess; isDefinition = !!isDefinition; - const result: any = { fileName: r.fileName, textSpan: { start: r.start, length: r.end - r.start }, isWriteAccess, isDefinition }; + function rangeToReferenceEntry(r: Range): ts.ReferenceEntry { + const { isWriteAccess, isDefinition, isInString } = (r.marker && r.marker.data) || { isWriteAccess: false, isDefinition: false, isInString: undefined }; + const result: ts.ReferenceEntry = { fileName: r.fileName, textSpan: { start: r.start, length: r.end - r.start }, isWriteAccess: !!isWriteAccess, isDefinition: !!isDefinition }; if (isInString !== undefined) { result.isInString = isInString; } @@ -2291,7 +2290,6 @@ namespace FourSlash { else { if (actual === undefined) { this.raiseError(`${name} failed - expected the template {newText: "${expected.newText}", caretOffset: "${expected.caretOffset}"} but got nothing instead`); - } if (actual.newText !== expected.newText) { diff --git a/src/harness/unittests/initializeTSConfig.ts b/src/harness/unittests/initializeTSConfig.ts index ab9aaea000..d0bc72d430 100644 --- a/src/harness/unittests/initializeTSConfig.ts +++ b/src/harness/unittests/initializeTSConfig.ts @@ -12,7 +12,8 @@ namespace ts { it(`Correct output for ${outputFileName}`, () => { Harness.Baseline.runBaseline(outputFileName, () => { if (initResult) { - return JSON.stringify(initResult, undefined, 4); + // normalize line endings + return initResult.replace(new RegExp(sys.newLine, "g"), "\n"); } else { // This can happen if compiler recieve invalid compiler-options diff --git a/src/harness/unittests/services/formatting/documentFormattingTests.json b/src/harness/unittests/services/formatting/documentFormattingTests.json deleted file mode 100644 index f7d48dba8c..0000000000 --- a/src/harness/unittests/services/formatting/documentFormattingTests.json +++ /dev/null @@ -1,80 +0,0 @@ -{ input: "function foo () {}", rules: [ ], span: { start: 0, length: 20 }, expected: "function foo() { }" }, -{ input: "var a = (0);\r\na = (1 % 2);\r\nvar b = new Array(1, 2);\r\nfunction c(d) {\r\n try { }\r\n catch (e) { }\r\n for (f = 0; f < 10; ++f) { }\r\n for (g in h) { }\r\n if (true) {\r\n } else if (false) { }\r\n switch (i) {\r\n case (0):\r\n break;\r\n }\r\n do { } while (true);\r\n with (j) {\r\n }\r\n delete (h);\r\n void (i);\r\n}", rules: [ "SpaceAfterOpenParen", "SpaceBeforeCloseParen", "NoSpaceBetweenParens" ], span: { start: 0, length: 349 }, expected: "var a = ( 0 );\r\na = ( 1 % 2 );\r\nvar b = new Array( 1, 2 );\r\nfunction c( d ) {\r\n try { }\r\n catch ( e ) { }\r\n for ( f = 0; f < 10; ++f ) { }\r\n for ( g in h ) { }\r\n if ( true ) {\r\n } else if ( false ) { }\r\n switch ( i ) {\r\n case ( 0 ):\r\n break;\r\n }\r\n do { } while ( true );\r\n with ( j ) {\r\n }\r\n delete ( h );\r\n void ( i );\r\n}" }, -{ input: "var a = ( 0 );\r\na = ( 1 % 2 );\r\nvar b = new Array( 1, 2 );\r\nfunction c( d ) {\r\n try { }\r\n catch ( e ) { }\r\n for ( f = 0; f < 10; ++f ) { }\r\n for ( g in h ) { }\r\n if ( true ) {\r\n } else if ( false ) { }\r\n switch ( i ) {\r\n case ( 0 ):\r\n break;\r\n }\r\n do { } while ( true );\r\n with ( j ) {\r\n }\r\n delete ( h );\r\n void ( i );\r\n}", rules: [ "NoSpaceAfterOpenParen", "NoSpaceBeforeCloseParen", "NoSpaceBetweenParens" ], span: { start: 0, length: 379 }, expected: "var a = (0);\r\na = (1 % 2);\r\nvar b = new Array(1, 2);\r\nfunction c(d) {\r\n try { }\r\n catch (e) { }\r\n for (f = 0; f < 10; ++f) { }\r\n for (g in h) { }\r\n if (true) {\r\n } else if (false) { }\r\n switch (i) {\r\n case (0):\r\n break;\r\n }\r\n do { } while (true);\r\n with (j) {\r\n }\r\n delete (h);\r\n void (i);\r\n}" }, -{ input: "this . alert( \"Hello, World!\" );", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 32 }, expected: "this.alert( \"Hello, World!\" );" }, -{ input: "a\r\n;b;", rules: [ ], span: { start: 0, length: 6 }, expected: "a\r\n; b;" }, -{ input: "a\r\n; b;", rules: [ ], span: { start: 0, length: 8 }, expected: "a\r\n; b;" }, -{ input: "var a , b;\r\nf(a , b);", rules: [ ], span: { start: 0, length: 40 }, expected: "var a, b;\r\nf(a, b);" }, -{ input: "function a() {\r\n while(false)\r\n switch(b) { }\r\n\r\n for(c in d)\r\n if(c)\r\n break;\r\n\r\n do { } while(true);\r\n with(f)\r\n g = null;\r\n}", rules: [ "SpaceAfterKeywordInControl" ], span: { start: 0, length: 171 }, expected: "function a() {\r\n while (false)\r\n switch (b) { }\r\n\r\n for (c in d)\r\n if (c)\r\n break;\r\n\r\n do { } while (true);\r\n with (f)\r\n g = null;\r\n}" }, -{ input: "function a() {\r\n while (false)\r\n switch (b) { }\r\n\r\n for (c in d)\r\n if (c)\r\n break;\r\n\r\n do { } while (true);\r\n with (f)\r\n g = null;\r\n}", rules: [ "NoSpaceAfterKeywordInControl" ], span: { start: 0, length: 177 }, expected: "function a() {\r\n while(false)\r\n switch(b) { }\r\n\r\n for(c in d)\r\n if(c)\r\n break;\r\n\r\n do { } while(true);\r\n with(f)\r\n g = null;\r\n}" }, -{ input: "{\r\n(a);\r\n}", rules: [ ], span: { start: 0, length: 10 }, expected: "{\r\n (a);\r\n}" }, -{ input: "var a=[1,2];\r\nvar b=8>>2 ;\r\nvar c=1+2;", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 14, length: 12 }, expected: "var a=[1,2];\r\nvar b = 8 >> 2;\r\nvar c=1+2;" }, -{ input: "if (true) {\r\n(a);\r\n}", rules: [ ], span: { start: 0, length: 20 }, expected: "if (true) {\r\n (a);\r\n}" }, -{ input: " // var a=[1,2];\r\n /*var a=[3,4];*/\r\n /*\r\n var a=[5,6];\r\n */", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 62 }, expected: "// var a=[1,2];\r\n/*var a=[3,4];*/\r\n/*\r\n var a=[5,6];\r\n */" }, -{ input: "f ();", rules: [ ], span: { start: 0, length: 14 }, expected: "f();" }, -{ input: "var a = { b: 1 , c: 2 };\r\nvar d = [1 , 2];", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 44 }, expected: "var a = { b: 1, c: 2 };\r\nvar d = [1, 2];" }, -{ input: "if (a)\r\n if (b)\r\n if (c)\r\n c();\r\n else\r\n b();\r\n else\r\n b();\r\nelse\r\n a();", rules: [ ], span: { start: 0, length: 124 }, expected: "if (a)\r\n if (b)\r\n if (c)\r\n c();\r\n else\r\n b();\r\n else\r\n b();\r\nelse\r\n a();" }, -{ input: "function a() { };", rules: [ ], span: { start: 0, length: 20 }, expected: "function a() { };" }, -{ input: "var a =[1.2,\"JavaScript\",true,{ x: 1,y: 3 }];\r\nvar b =[[1,2],[3,4]];\r\nvar c =[1,,,,5];\r\nvar d =[\r\n [1,2],\r\n [3,4]\r\n];", rules: [ "SpaceAfterComma" ], span: { start: 0, length: 123 }, expected: "var a =[1.2, \"JavaScript\", true, { x: 1, y: 3 }];\r\nvar b =[[1, 2], [3, 4]];\r\nvar c =[1, , , , 5];\r\nvar d =[\r\n [1, 2],\r\n [3, 4]\r\n];" }, -{ input: "var a =[1.2, \"JavaScript\", true, { x: 1, y: 3 }];\r\nvar b =[[1, 2], [3, 4]];\r\nvar c =[1, , , , 5];\r\nvar d =[\r\n [1, 2],\r\n [3, 4]\r\n];", rules: [ "NoSpaceAfterComma" ], span: { start: 0, length: 136 }, expected: "var a =[1.2,\"JavaScript\",true,{ x: 1,y: 3 }];\r\nvar b =[[1,2],[3,4]];\r\nvar c =[1,,,,5];\r\nvar d =[\r\n [1,2],\r\n [3,4]\r\n];" }, -{ input: "function a(b,c) { }\r\na(0,1);\r\nvar a =[,];\r\nvar a =[0,1];\r\nvar a,b,c = 0,d = 0;\r\nfor (var a = 0,b = 10; a < 10,b >= 0; ++a,--b) { }\r\nvar a = new ActiveXObject(\"\",\"\");\r\nswitch (a) {\r\n case 1,2,3:\r\n break;\r\n}", rules: [ "SpaceAfterComma" ], span: { start: 0, length: 215 }, expected: "function a(b, c) { }\r\na(0, 1);\r\nvar a =[, ];\r\nvar a =[0, 1];\r\nvar a, b, c = 0, d = 0;\r\nfor (var a = 0, b = 10; a < 10, b >= 0; ++a, --b) { }\r\nvar a = new ActiveXObject(\"\", \"\");\r\nswitch (a) {\r\n case 1, 2, 3:\r\n break;\r\n}" }, -{ input: "function a(b, c) { }\r\na(0, 1);\r\nvar a =[, ];\r\nvar a =[0, 1];\r\nvar a, b, c = 0, d = 0;\r\nfor (var a = 0, b = 10; a < 10, b >= 0; ++a, --b) { }\r\nvar a = new ActiveXObject(\"\", \"\");\r\nswitch (a) {\r\n case 1, 2, 3:\r\n break;\r\n}", rules: [ "NoSpaceAfterComma" ], span: { start: 0, length: 228 }, expected: "function a(b,c) { }\r\na(0,1);\r\nvar a =[,];\r\nvar a =[0,1];\r\nvar a,b,c = 0,d = 0;\r\nfor (var a = 0,b = 10; a < 10,b >= 0; ++a,--b) { }\r\nvar a = new ActiveXObject(\"\",\"\");\r\nswitch (a) {\r\n case 1,2,3:\r\n break;\r\n}" }, -{ input: "function Sum(a, b, c) {\r\nvar d = 1;\r\n}", rules: [ ], span: { start: 0, length: 38 }, expected: "function Sum(a, b, c) {\r\n var d = 1;\r\n}" }, -{ input: "(function() { })();\r\nvar a = function() { };\r\nvar a = { b: function() { } };", rules: [ "SpaceAfterAnonymousFunctionKeyword" ], span: { start: 0, length: 76 }, expected: "(function () { })();\r\nvar a = function () { };\r\nvar a = { b: function () { } };" }, -{ input: "(function () { })();\r\nvar a = function () { };\r\nvar a = { b: function () { } };", rules: [ "NoSpaceAfterAnonymousFunctionKeyword" ], span: { start: 0, length: 79 }, expected: "(function() { })();\r\nvar a = function() { };\r\nvar a = { b: function() { } };" }, -{ input: "function a() {\r\n}b;", rules: [ ], span: { start: 0, length: 19 }, expected: "function a() {\r\n} b;" }, -{ input: "function a() {\r\n} b;", rules: [ ], span: { start: 0, length: 21 }, expected: "function a() {\r\n} b;" }, -{ input: "function a(){return 0;}\r\nfunction b(){toString();return 0;}", rules: [ ], span: { start: 0, length: 59 }, expected: "function a() { return 0; }\r\nfunction b() { toString(); return 0; }" }, -{ input: "for (var i = 0;i < 10;++i) { }", rules: [ "SpaceAfterSemicolonInFor" ], span: { start: 0, length: 30 }, expected: "for (var i = 0; i < 10; ++i) { }" }, -{ input: "for (var i = 0; i < 10; ++i) { }", rules: [ "NoSpaceAfterSemicolonInFor" ], span: { start: 0, length: 32 }, expected: "for (var i = 0;i < 10;++i) { }" }, -{ input: "function f() {\r\nif (1)\r\n{\r\nvar a=0;\r\n}\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl", "NewLineBeforeOpenCurlyInFunction" ], span: { start: 0, length: 41 }, expected: "function f()\n{\r\n if (1) {\r\n var a=0;\r\n }\r\n}" }, -{ input: "function a(b) {\r\n a({\r\n});\r\n}", rules: [ ], span: { start: 0, length: 32 }, expected: "function a(b) {\r\n a({\r\n });\r\n}" }, -{ input: "// var a=[1,2];\r\n/*\r\nvar a=[1,2];\r\n*/", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 3, length: 12 }, expected: "// var a=[1,2];\r\n/*\r\nvar a=[1,2];\r\n*/" }, -{ input: "// var a=[1,2];\r\n/*\r\nvar a=[1,2];\r\n*/", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 21, length: 12 }, expected: "// var a=[1,2];\r\n/*\r\nvar a=[1,2];\r\n*/" }, -{ input: "eval(\"var a=b[1,2+3];\");", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 6, length: 15 }, expected: "eval(\"var a=b[1,2+3];\");" }, -{ input: "0 + +1;\r\n0 + +a;\r\n0 + +(1);\r\n0 + +(+1);\r\n0 + +[1];\r\n0 + +[+1];\r\n0 + +this.a;\r\n0 + +new Number(+1);\r\n\r\n0 - -1;\r\n0 - -a;\r\n0 - -(1);\r\n0 - -(-1);\r\n0 - -[1];\r\n0 - -[-1];\r\n0 - -this.a;\r\n0 - -new Number(-1);\r\n\r\n0 + ~1;\r\n0 - ~a;\r\n0 + ~(1);\r\n0 - ~(~1);\r\n0 + ~[1];\r\n0 - ~[~1];\r\n0 + ~this.a;\r\n0 - ~new Number(~1);\r\n\r\n0 - !1;\r\n0 + !a;\r\n0 - !(1);\r\n0 + !(!1);\r\n0 - ![1];\r\n0 + ![!1];\r\n0 - !this.a;\r\n0 + !new Number(!1);", rules: [ "NoSpaceBeforeBinaryOperator", "NoSpaceAfterBinaryOperator" ], span: { start: 0, length: 404 }, expected: "0+ +1;\r\n0+ +a;\r\n0+ +(1);\r\n0+ +(+1);\r\n0+ +[1];\r\n0+ +[+1];\r\n0+ +this.a;\r\n0+ +new Number(+1);\r\n\r\n0- -1;\r\n0- -a;\r\n0- -(1);\r\n0- -(-1);\r\n0- -[1];\r\n0- -[-1];\r\n0- -this.a;\r\n0- -new Number(-1);\r\n\r\n0+~1;\r\n0-~a;\r\n0+~(1);\r\n0-~(~1);\r\n0+~[1];\r\n0-~[~1];\r\n0+~this.a;\r\n0-~new Number(~1);\r\n\r\n0-!1;\r\n0+!a;\r\n0-!(1);\r\n0+!(!1);\r\n0-![1];\r\n0+![!1];\r\n0-!this.a;\r\n0+!new Number(!1);" }, -{ input: "0+ +1;\r\n0+ +a;\r\n0+ +(1);\r\n0+ +(+1);\r\n0+ +[1];\r\n0+ +[+1];\r\n0+ +this.a;\r\n0+ +new Number(+1);\r\n\r\n0- -1;\r\n0- -a;\r\n0- -(1);\r\n0- -(-1);\r\n0- -[1];\r\n0- -[-1];\r\n0- -this.a;\r\n0- -new Number(-1);\r\n\r\n0+~1;\r\n0-~a;\r\n0+~(1);\r\n0-~(~1);\r\n0+~[1];\r\n0-~[~1];\r\n0+~this.a;\r\n0-~new Number(~1);\r\n\r\n0-!1;\r\n0+!a;\r\n0-!(1);\r\n0+!(!1);\r\n0-![1];\r\n0+![!1];\r\n0-!this.a;\r\n0+!new Number(!1);", rules: [ "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 356 }, expected: "0 + +1;\r\n0 + +a;\r\n0 + +(1);\r\n0 + +(+1);\r\n0 + +[1];\r\n0 + +[+1];\r\n0 + +this.a;\r\n0 + +new Number(+1);\r\n\r\n0 - -1;\r\n0 - -a;\r\n0 - -(1);\r\n0 - -(-1);\r\n0 - -[1];\r\n0 - -[-1];\r\n0 - -this.a;\r\n0 - -new Number(-1);\r\n\r\n0 + ~1;\r\n0 - ~a;\r\n0 + ~(1);\r\n0 - ~(~1);\r\n0 + ~[1];\r\n0 - ~[~1];\r\n0 + ~this.a;\r\n0 - ~new Number(~1);\r\n\r\n0 - !1;\r\n0 + !a;\r\n0 - !(1);\r\n0 + !(!1);\r\n0 - ![1];\r\n0 + ![!1];\r\n0 - !this.a;\r\n0 + !new Number(!1);" }, -{ input: "for (var a = 0; a < 2; ++a) {\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl", "SpaceAfterSemicolonInFor" ], span: { start: 0, length: 32 }, expected: "for (var a = 0; a < 2; ++a)\n{\r\n}" }, -{ input: "for (var a = 0; a < 2; ++a)\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl", "SpaceAfterSemicolonInFor" ], span: { start: 0, length: 32 }, expected: "for (var a = 0; a < 2; ++a) {\r\n}" }, -{ input: "function foo(a, b, c) { a = b + c;\n}", rules: [ "NewLineBeforeOpenCurlyInFunction", "NewLineAfterOpenCurlyInBlockContext", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 36 }, expected: "function foo(a, b, c)\n{\n a = b + c;\n}" }, -{ input: "function a() {\r\n // comment\r\n}", rules: [ ], span: { start: 0, length: 33 }, expected: "function a() {\r\n // comment\r\n}" }, -{ input: "if (false) {\r\n} else if (true) {\r\n} else {\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 45 }, expected: "if (false)\n{\r\n} else if (true)\n{\r\n} else\n{\r\n}" }, -{ input: "if (false)\n{\r\n} else if (true)\n{\r\n} else\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 45 }, expected: "if (false) {\r\n} else if (true) {\r\n} else {\r\n}" }, -{ input: "var a = (0);\r\nvar b = (1);\r\nvar c = (1 + 2);\r\nvar d = ((1 + 2)-(3 + 4));\r\n\r\nvar e = ( 0 );\r\nvar f = ( 1 );\r\nvar g = ( 1 + 2 );\r\nvar h = ( ( 1 + 2 ) - ( 3 + 4 ) );", rules: [ "SpaceAfterOpenParen", "SpaceBeforeCloseParen", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 162 }, expected: "var a = ( 0 );\r\nvar b = ( 1 );\r\nvar c = ( 1 + 2 );\r\nvar d = ( ( 1 + 2 ) - ( 3 + 4 ) );\r\n\r\nvar e = ( 0 );\r\nvar f = ( 1 );\r\nvar g = ( 1 + 2 );\r\nvar h = ( ( 1 + 2 ) - ( 3 + 4 ) );" }, -{ input: "eval(\"var a=b[1,2+3];\");", rules: [ "SpaceAfterComma", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 24 }, expected: "eval(\"var a=b[1,2+3];\");" }, -{ input: "for (a in b)\r\n\r\n{ i++; }\r\n\r\nfor (a in b)\r\n\r\n{\r\ni++; }", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 53 }, expected: "for (a in b)\r\n\r\n{ i++; }\r\n\r\nfor (a in b) {\r\n i++;\n}" }, -{ input: "for (a in b) {\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 17 }, expected: "for (a in b)\n{\r\n}" }, -{ input: "for (a in b)\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 17 }, expected: "for (a in b) {\r\n}" }, -{ input: " var a = { } ; \r\nvar b = { c : d, e : { } };\r\n ", rules: [ "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 59 }, expected: "var a = {};\r\nvar b = { c: d, e: {} };\r\n" }, -{ input: "while (true) { }", rules: [ ], span: { start: 0, length: 19 }, expected: "while (true) { }" }, -{ input: "for (a in b){ i++; }\r\n\r\nfor (a in b){ i++; }", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 44 }, expected: "for (a in b) { i++; }\r\n\r\nfor (a in b) { i++; }" }, -{ input: "function a() {\r\n}", rules: [ "NewLineBeforeOpenCurlyInFunction" ], span: { start: 0, length: 17 }, expected: "function a()\n{\r\n}" }, -{ input: "function a()\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInFunction" ], span: { start: 0, length: 17 }, expected: "function a() {\r\n}" }, -{ input: "a;\r\nb;c;\r\nd;", rules: [ ], span: { start: 0, length: 12 }, expected: "a;\r\nb; c;\r\nd;" }, -{ input: "a;\r\nb; c;\r\nd;", rules: [ ], span: { start: 0, length: 14 }, expected: "a;\r\nb; c;\r\nd;" }, -{ input: " var a = 0;\r\n function b() {\r\n var c = 0;\r\n }", rules: [ "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 61 }, expected: "var a = 0;\r\nfunction b() {\r\n var c = 0;\r\n}" }, -{ input: "a;b;", rules: [ ], span: { start: 0, length: 4 }, expected: "a; b;" }, -{ input: "a; b;", rules: [ ], span: { start: 0, length: 6 }, expected: "a; b;" }, -{ input: "var a = (0);\r\nvar b = (1);\r\nvar c = (1 + 2);\r\nvar d = ((1 + 2)-(3 + 4));\r\n\r\nvar e = ( 0 );\r\nvar f = ( 1 );\r\nvar g = ( 1 + 2 );\r\nvar h = ( ( 1 + 2 ) - ( 3 + 4 ) );", rules: [ "NoSpaceAfterOpenParen", "NoSpaceBeforeCloseParen", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 162 }, expected: "var a = (0);\r\nvar b = (1);\r\nvar c = (1 + 2);\r\nvar d = ((1 + 2) - (3 + 4));\r\n\r\nvar e = (0);\r\nvar f = (1);\r\nvar g = (1 + 2);\r\nvar h = ((1 + 2) - (3 + 4));" }, -{ input: "function a() {\r\n(b);\r\n}", rules: [ ], span: { start: 0, length: 23 }, expected: "function a() {\r\n (b);\r\n}" }, -{ input: "function test(a) {\n var i;\n for (i = 0;i < 1; i++){ //select\n a++;//select\n }\n}", rules: [ "NewLineBeforeOpenCurlyInControl", "NewLineAfterOpenCurlyInBlockContext", "NewLineBeforeOpenCurlyInFunction", "SpaceAfterSemicolonInFor" ], span: { start: 30, length: 50 }, expected: "function test(a) {\n var i;\n for (i = 0; i < 1; i++)\n { //select\n a++;//select\n }\n}" }, -{ input: "function a(){ return 1; }", rules: [ "SpaceBeforeOpenCurlyInFunction" ], span: { start: 0, length: 25 }, expected: "function a() { return 1; }" }, -{ input: "do {\r\n} while (true);", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 21 }, expected: "do\n{\r\n} while (true);" }, -{ input: "do\n{\r\n} while (true);", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 21 }, expected: "do {\r\n} while (true);" }, -{ input: "for (;;) { a = b + c; b = 2;\n}", rules: [ "NewLineBeforeOpenCurlyInControl", "NewLineAfterOpenCurlyInBlockContext", "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator", "NoSpaceAfterSemicolonInFor" ], span: { start: 0, length: 30 }, expected: "for (;;)\n{\n a = b + c; b = 2;\n}" }, -{ input: "var a =0;\r\n\r\n+ 1;\r\n+ a;\r\n+ (1);\r\n+ (+ 1);\r\n+ [1];\r\n+ [+ 1];\r\n+ this.a;\r\n+ new Number(+ 1);\r\n\r\n- 1;\r\n- a;\r\n- (1);\r\n- (- 1);\r\n- [1];\r\n- [- 1];\r\n- this.a;\r\n- new Number(- 1);\r\n\r\n~ 1;\r\n~ a;\r\n~ (1);\r\n~ (~ 1);\r\n~ [1];\r\n~ [~ 1];\r\n~ this.a;\r\n~ new Number(~ 1);\r\n\r\n! 1;\r\n! a;\r\n! (1);\r\n! (! 1);\r\n! [1];\r\n! [! 1];\r\n! this.a;\r\n! new Number(! 1);\r\n\r\n++ a;\r\n++ (a);\r\n++ this.a;\r\n++ new f().a;\r\n\r\n-- a;\r\n-- (a);\r\n-- this.a;\r\n-- new f().a;\r\n\r\na ++;\r\n(a) ++;\r\nthis.a ++;\r\nnew f().a ++;\r\n\r\na --;\r\n(a) --;\r\nthis.a --;\r\nnew f().a --;", rules: [ ], span: { start: 0, length: 513 }, expected: "var a =0;\r\n\r\n+1;\r\n+a;\r\n+(1);\r\n+(+1);\r\n+[1];\r\n+[+1];\r\n+this.a;\r\n+new Number(+1);\r\n\r\n-1;\r\n-a;\r\n-(1);\r\n-(-1);\r\n-[1];\r\n-[-1];\r\n-this.a;\r\n-new Number(-1);\r\n\r\n~1;\r\n~a;\r\n~(1);\r\n~(~1);\r\n~[1];\r\n~[~1];\r\n~this.a;\r\n~new Number(~1);\r\n\r\n!1;\r\n!a;\r\n!(1);\r\n!(!1);\r\n![1];\r\n![!1];\r\n!this.a;\r\n!new Number(!1);\r\n\r\n++a;\r\n++(a);\r\n++this.a;\r\n++new f().a;\r\n\r\n--a;\r\n--(a);\r\n--this.a;\r\n--new f().a;\r\n\r\na++;\r\n(a)++;\r\nthis.a++;\r\nnew f().a++;\r\n\r\na--;\r\n(a)--;\r\nthis.a--;\r\nnew f().a--;" }, -{ input: "switch (a) {\r\n case 0:\r\n break;\r\n default:\r\n break;\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 74 }, expected: "switch (a)\n{\r\n case 0:\r\n break;\r\n default:\r\n break;\r\n}" }, -{ input: "switch (a)\n{\r\n case 0:\r\n break;\r\n default:\r\n break;\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 74 }, expected: "switch (a) {\r\n case 0:\r\n break;\r\n default:\r\n break;\r\n}" }, -{ input: "function a()\r\n\r\n\r\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInFunction" ], span: { start: 0, length: 22 }, expected: "function a() {\r\n}" }, -{ input: "try {\r\n} catch (e) {\r\n} finally {\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 36 }, expected: "try\n{\r\n} catch (e)\n{\r\n} finally\n{\r\n}" }, -{ input: "try\n{\r\n} catch (e)\n{\r\n} finally\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 36 }, expected: "try {\r\n} catch (e) {\r\n} finally {\r\n}" }, -{ input: "with (a) {\r\n b = 0;\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 25 }, expected: "with (a)\n{\r\n b = 0;\r\n}" }, -{ input: "with (a)\n{\r\n b = 0;\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 25 }, expected: "with (a) {\r\n b = 0;\r\n}" }, -{ input: "var a=0+1-2*3/4%5;\r\na+=6;\r\na-=7;\r\na*=7;\r\na/=8;\r\na%=9;\r\na=+1- -2+ +3;\r\na=1.0+2.+.0;\r\n++a+a++;\r\n--a-a--;\r\n\r\nvar b=~1&2|3^4<<1>>1>>>2;\r\nb&=5;\r\nb^=6;\r\nb|=7;\r\nb<<=8;\r\nb>>=9;\r\nb>>>=10;\r\n\r\nvar c=a>b;\r\nc=b=b;\r\nc=!c;\r\n\r\n++a+ ++a+a++ +a++ + ++a;\r\n--a- --a-a-- -a-- - --a;\r\n\r\nfunction d::e() { }", rules: [ "SpaceBeforeBinaryOperator", "SpaceAfterBinaryOperator" ], span: { start: 0, length: 366 }, expected: "var a = 0 + 1 - 2 * 3 / 4 % 5;\r\na += 6;\r\na -= 7;\r\na *= 7;\r\na /= 8;\r\na %= 9;\r\na = +1 - -2 + +3;\r\na = 1.0 + 2. + .0;\r\n++a + a++;\r\n--a - a--;\r\n\r\nvar b = ~1 & 2 | 3 ^ 4 << 1 >> 1 >>> 2;\r\nb &= 5;\r\nb ^= 6;\r\nb |= 7;\r\nb <<= 8;\r\nb >>= 9;\r\nb >>>= 10;\r\n\r\nvar c = a > b;\r\nc = b < a ? a : b;\r\nc = true && false || true;\r\nc = a == b;\r\nc = a === b;\r\nc = a != b;\r\nc = a !== b;\r\nc = a <= b;\r\nc = a >= b;\r\nc = !c;\r\n\r\n++a + ++a + a++ + a++ + ++a;\r\n--a - --a - a-- - a-- - --a;\r\n\r\nfunction d::e() { }" }, -{ input: "var a = 0 + 1 - 2 * 3 / 4 % 5;\r\na += 6;\r\na -= 7;\r\na *= 7;\r\na /= 8;\r\na %= 9;\r\na = +1 - -2 + +3;\r\na = 1.0 + 2. + .0;\r\n++a + a++;\r\n--a - a--;\r\n\r\nvar b = ~1 & 2 | 3 ^ 4 << 1 >> 1 >>> 2;\r\nb &= 5;\r\nb ^= 6;\r\nb |= 7;\r\nb <<= 8;\r\nb >>= 9;\r\nb >>>= 10;\r\n\r\nvar c = a > b;\r\nc = b < a ? a : b;\r\nc = true && false || true;\r\nc = a == b;\r\nc = a === b;\r\nc = a != b;\r\nc = a !== b;\r\nc = a <= b;\r\nc = a >= b;\r\nc = !c;\r\n\r\n++a + ++a + a++ + a++ + ++a;\r\n--a - --a - a-- - a-- - --a;\r\n\r\nfunction d::e() { }", rules: [ "NoSpaceBeforeBinaryOperator", "NoSpaceAfterBinaryOperator" ], span: { start: 0, length: 480 }, expected: "var a=0+1-2*3/4%5;\r\na+=6;\r\na-=7;\r\na*=7;\r\na/=8;\r\na%=9;\r\na=+1- -2+ +3;\r\na=1.0+2.+.0;\r\n++a+a++;\r\n--a-a--;\r\n\r\nvar b=~1&2|3^4<<1>>1>>>2;\r\nb&=5;\r\nb^=6;\r\nb|=7;\r\nb<<=8;\r\nb>>=9;\r\nb>>>=10;\r\n\r\nvar c=a>b;\r\nc=b=b;\r\nc=!c;\r\n\r\n++a+ ++a+a++ +a++ + ++a;\r\n--a- --a-a-- -a-- - --a;\r\n\r\nfunction d::e() { }" }, -{ input: "function foo()\n\n{ a = 1\n}", rules: [ "NewLineBeforeOpenCurlyInFunction" ], span: { start: 0, length: 25 }, expected: "function foo()\n{\n a = 1\n}" }, -{ input: "while (true) {\r\n}", rules: [ "NewLineBeforeOpenCurlyInControl" ], span: { start: 0, length: 17 }, expected: "while (true)\n{\r\n}" }, -{ input: "while (true)\n{\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl" ], span: { start: 0, length: 17 }, expected: "while (true) {\r\n}" }, -{ input: "var z = 1;\r\n for (i = 0; i < 10; i++)\r\n for (j = 0; j < 10; j++)\r\nfor (k = 0; k < 10; ++k)\r\n{\r\nz++;\r\n}", rules: [ "SpaceBeforeOpenCurlyInControl", "SpaceAfterSemicolonInFor" ], span: { start: 0, length: 117 }, expected: "var z = 1;\r\nfor (i = 0; i < 10; i++)\r\n for (j = 0; j < 10; j++)\r\n for (k = 0; k < 10; ++k) {\r\n z++;\r\n }" }, -{ input: "a++;b++;\nfor (; ; ) {\nx++;m++;\n}", rules: [ "SpaceAfterSemicolonInFor" ], span: { start: 0, length: 32 }, expected: "a++; b++;\nfor (; ; ) {\n x++; m++;\n}" }, -{ input: "var a;\r\n $(document).ready(function() {\r\n alert('hello');\r\n});\r\n", rules: [ ], span: { start: 0, length: 117 }, expected: "var a;\r\n$(document).ready(function () {\r\n alert('hello');\r\n});\r\n" } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/formatDiffTemplate.html b/src/harness/unittests/services/formatting/formatDiffTemplate.html deleted file mode 100644 index d5bc6537cc..0000000000 --- a/src/harness/unittests/services/formatting/formatDiffTemplate.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/getFormattingEditsForRange.ts b/src/harness/unittests/services/formatting/getFormattingEditsForRange.ts deleted file mode 100644 index b369ba4374..0000000000 --- a/src/harness/unittests/services/formatting/getFormattingEditsForRange.ts +++ /dev/null @@ -1,88 +0,0 @@ -/// - -describe('getFormattingEditsForRange', function() { - // - // Verify that formatting the typescript file "sourceFileName" results in the - // baseline file "baselineFileName". - // - function getFormattingEditsForRange(sourceFileName: string) { - var baselineFileName = "tests/cases/unittests/services/testCode/formatting/" + sourceFileName + "BaseLine.ts"; - sourceFileName = "tests/cases/unittests/services/testCode/formatting/" + sourceFileName + ".ts"; - - var typescriptLS = new Harness.TypeScriptLS(); - typescriptLS.addDefaultLibrary(); - typescriptLS.addFile(sourceFileName); - - var ls = typescriptLS.getLanguageService(); - var script = ls.languageService.getScriptAST(sourceFileName); - assert.notNull(script); - - var edits = ls.languageService.getFormattingEditsForRange(sourceFileName, 0, script.limChar, new Services.FormatCodeOptions()); - typescriptLS.checkEdits(sourceFileName, baselineFileName, edits); - } - - describe('test cases for formatting engine', function() { - it("formats typescript constructs properly", function() { - getFormattingEditsForRange('typescriptConstructs'); - }); - it("formats document ready function properly", function() { - getFormattingEditsForRange('documentReadyFunction'); - }); - it("formats on closing bracket properly", function() { - getFormattingEditsForRange('onClosingBracket'); - }); - it("formats various javascript constructs", function() { - getFormattingEditsForRange('various'); - }); - it("formats main javascript program", function() { - getFormattingEditsForRange('main'); - }); - it("formats on semicolon properly", function() { - getFormattingEditsForRange('onSemiColon'); - }); - it("formats enum with trailling tab characters properly", function() { - getFormattingEditsForRange('tabAfterCloseCurly'); - }); - it("formats object literal", function() { - getFormattingEditsForRange('objectLiteral'); - }); - it("formats with statements", function() { - getFormattingEditsForRange('withStatement'); - }); - it("formats ':' and '?' in parameters", function() { - getFormattingEditsForRange('colonAndQMark'); - }); - it("formats 'import' declaration", function() { - getFormattingEditsForRange('importDeclaration'); - }); - it("formats exported class with implicit module", function() { - //TODO: this is to force generation of implicit module in AST - var svGenTarget = TypeScript.moduleGenTarget; - try { - TypeScript.moduleGenTarget = TypeScript.ModuleGenTarget.Asynchronous; - getFormattingEditsForRange('implicitModule'); - } - finally { - TypeScript.moduleGenTarget = svGenTarget; - } - }); - it("formats constructor statements correctelly", function() { - getFormattingEditsForRange('spaceAfterConstructor'); - }); - it("formats classes and interfaces correctelly", function() { - getFormattingEditsForRange('classes'); - }); - it("formats modules correctly", function() { - getFormattingEditsForRange('modules'); - }); - it("formats fat arrow expressions correctelly", function() { - getFormattingEditsForRange('fatArrowFunctions'); - }); - it("formats empty object/interface literals correctelly", function() { - getFormattingEditsForRange('emptyInterfaceLiteral'); - }); - it("formats variable declaration lists", function() { - getFormattingEditsForRange('formatVariableDeclarationList'); - }); - }); -}); diff --git a/src/harness/unittests/services/formatting/getSmartIndentAtLineNumber.ts b/src/harness/unittests/services/formatting/getSmartIndentAtLineNumber.ts deleted file mode 100644 index 52e7982bd4..0000000000 --- a/src/harness/unittests/services/formatting/getSmartIndentAtLineNumber.ts +++ /dev/null @@ -1,410 +0,0 @@ -/// - -describe('getSmartIndentAtLineNumber', function() { - var typescriptLS = new Harness.TypeScriptLS(); - - typescriptLS.addDefaultLibrary(); - - var fileName = 'tests/cases/unittests/services/testCode/getSmartIndentAtLineNumber.ts'; - var fileName2 = 'tests/cases/unittests/services/testCode/getSmartIndentAtLineNumber2.ts'; - var fileName3 = 'tests/cases/unittests/services/testCode/getSmartIndentAtLineNumber3.ts'; - - typescriptLS.addFile(fileName); - typescriptLS.addFile(fileName2); - typescriptLS.addFile(fileName3); - - var ls = typescriptLS.getLanguageService(); - - // - // line is 1-based - // - function getSmartIndent(fileName: string, line: number): number { - assert.is(line >= 1); - var options = new Services.EditorOptions(); - var position = typescriptLS.lineColToPosition(fileName, line, 1); - return ls.languageService.getSmartIndentAtLineNumber(fileName, position, options); - } - - describe("test cases for smart indent", function() { - - it("smart indent inside module", function() { - var result = getSmartIndent(fileName, 2); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside class", function() { - var result = getSmartIndent(fileName, 4); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after property in class", function() { - var result = getSmartIndent(fileName, 6); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent inside method in class ", function() { - var result = getSmartIndent(fileName, 9); - - assert.notNull(result); - assert.equal(12, result); - }); - - it("smart indent after after method in class", function() { - var result = getSmartIndent(fileName, 12); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after class", function() { - var result = getSmartIndent(fileName, 17); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent in interface", function() { - var result = getSmartIndent(fileName, 19); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after property in interface", function() { - var result = getSmartIndent(fileName, 21); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after method in interface", function() { - var result = getSmartIndent(fileName, 23); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after interface", function() { - var result = getSmartIndent(fileName, 25); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent in nested module", function() { - var result = getSmartIndent(fileName, 27); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after function in nested module", function() { - var result = getSmartIndent(fileName, 30); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after variable in nested module", function() { - var result = getSmartIndent(fileName, 32); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after nested module", function() { - var result = getSmartIndent(fileName, 34); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent in enum", function() { - var result = getSmartIndent(fileName, 36); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after variable in enum", function() { - var result = getSmartIndent(fileName, 38); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after 2nd variable in enum", function() { - var result = getSmartIndent(fileName, 40); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after enum", function() { - var result = getSmartIndent(fileName, 42); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent after module", function() { - var result = getSmartIndent(fileName, 44); - - assert.notNull(result); - assert.equal(0, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent after an aligned function argument", function() { - var result = getSmartIndent(fileName, 47); - - assert.notNull(result); - assert.equal(13, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent inside a 'for' statement", function() { - var result = getSmartIndent(fileName, 53); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after a 'for' statement", function() { - var result = getSmartIndent(fileName, 55); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside a 'for in' statement", function() { - var result = getSmartIndent(fileName, 57); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after a 'for in' statement", function() { - var result = getSmartIndent(fileName, 59); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside a 'with' statement", function() { - var result = getSmartIndent(fileName, 61); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after a 'with' statement", function() { - var result = getSmartIndent(fileName, 63); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside a 'switch' statement", function() { - var result = getSmartIndent(fileName, 65); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after a 'switch' statement", function() { - var result = getSmartIndent(fileName, 67); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside a 'break' statement", function() { - var result = getSmartIndent(fileName, 69); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after a 'break' statement", function() { - var result = getSmartIndent(fileName, 71); - - assert.notNull(result); - assert.equal(12, result); - }); - - it("smart indent after a 'break' statement", function() { - var result = getSmartIndent(fileName, 73); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after last 'switch' statement", function() { - var result = getSmartIndent(fileName, 75); - - assert.notNull(result); - assert.equal(4, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent before 'try' in 'try/catch' statement", function() { - var result = getSmartIndent(fileName, 79); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent insde 'try' in 'try/catch' statement", function() { - var result = getSmartIndent(fileName, 81); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent before 'catch' in 'try/catch' statement", function() { - var result = getSmartIndent(fileName, 83); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside 'catch' in 'try/catch' statement", function() { - var result = getSmartIndent(fileName, 85); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after 'catch' in 'try/catch' statement", function() { - var result = getSmartIndent(fileName, 87); - - assert.notNull(result); - assert.equal(4, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent before 'try' in 'try/finally' statement", function() { - var result = getSmartIndent(fileName, 92); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent insde 'try' in 'try/finally' statement", function() { - var result = getSmartIndent(fileName, 94); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent before 'finally' in 'try/finally' statement", function() { - var result = getSmartIndent(fileName, 96); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside 'finally' in 'try/finally' statement", function() { - var result = getSmartIndent(fileName, 98); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after 'finally' in 'try/finally' statement", function() { - var result = getSmartIndent(fileName, 100); - - assert.notNull(result); - assert.equal(4, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent before 'try' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 104); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent insde 'try' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 106); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent before 'catch' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 108); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside 'catch' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 110); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent before 'finally' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 112); - - assert.notNull(result); - assert.equal(4, result); - }); - - it("smart indent inside 'finally' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 114); - - assert.notNull(result); - assert.equal(8, result); - }); - - it("smart indent after 'finally' in 'try/catch/finally' statement", function() { - var result = getSmartIndent(fileName, 116); - - assert.notNull(result); - assert.equal(4, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent inside a block inside case", function() { - var result = getSmartIndent(fileName, 127); - - assert.notNull(result); - assert.equal(20, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent works for a non terminated argument list at the end of a file", function() { - var result = getSmartIndent(fileName2, 8); - - assert.notNull(result); - assert.equal(4, result); - }); - - /////////////////////////////////////////////////////////////////////// - - it("smart indent works for a non terminated if statement at the end of a file", function() { - var result = getSmartIndent(fileName3, 7); - - assert.notNull(result); - assert.equal(4, result); - }); - }); -}); diff --git a/src/harness/unittests/services/formatting/importedJavaScriptFormatting.ts b/src/harness/unittests/services/formatting/importedJavaScriptFormatting.ts deleted file mode 100644 index 2fcb997767..0000000000 --- a/src/harness/unittests/services/formatting/importedJavaScriptFormatting.ts +++ /dev/null @@ -1,212 +0,0 @@ -/// -/// - -interface DocumentTestJson { - input: string; - rules: string[]; - span: { start: number; length: number; }; - expected: string; -} - -interface FormatOperationTestJson { - input: string; - operations: { - operation: string; - point: { position: number; }; - span: { start: number; length: number; }; - }[]; - expected: string; -} - -function markupCodeForHtml(code: string) { - var formatted = code.replace(/'); - var escaped = encodeURIComponent(code).replace(/'/g, '%27'); - - return formatted + '
Copy'; -} - -describe('importedJavaScriptFormatting - formatting rules', function() { - var documentTests: DocumentTestJson[] = eval('[' + IO.readFile(Harness.userSpecifiedroot + 'tests/cases/unittests/services/documentFormattingTests.json').contents() + ']'); - - var outputFile = 'diff-1.html'; - IO.writeFile(outputFile, IO.readFile(Harness.userSpecifiedroot + 'tests/cases/unittests/services/formatDiffTemplate.html').contents(), false); - - var checkTest = function(test: DocumentTestJson) { - var filename = 'temp.ts'; - var typescriptLS = new Harness.TypeScriptLS(); - typescriptLS.addScript(filename, test.input); - - var ls = typescriptLS.getLanguageService().languageService; - - var unsupportedRules = []; - var ruleMap = { - 'SpaceAfterSemicolonInFor': 'InsertSpaceAfterSemicolonInForStatements', - 'SpaceAfterComma': 'InsertSpaceAfterCommaDelimiter', - 'NewLineBeforeOpenCurlyInControl': 'PlaceOpenBraceOnNewLineForControlBlocks', - 'NewLineBeforeOpenCurlyInFunction': 'PlaceOpenBraceOnNewLineForFunctions' - }; - - var options = new Services.FormatCodeOptions(); - if (test.rules.indexOf('SpaceBeforeBinaryOperator') >= 0 && test.rules.indexOf('SpaceAfterBinaryOperator') >= 0) { - test.rules.splice(test.rules.indexOf('SpaceBeforeBinaryOperator'), 1); - test.rules.splice(test.rules.indexOf('SpaceAfterBinaryOperator'), 1); - options.InsertSpaceBeforeAndAfterBinaryOperators = true; - } - - test.rules.forEach(ruleName => { - if (options[ruleName] !== undefined) { - // The options struct has a matching property, just set it directly - options[ruleName] = true; - } else { - if (ruleMap[ruleName] !== undefined) { - // We have a remapping of this name, use that instead - options[ruleMap[ruleName]] = true; - } else { - if (ruleName.indexOf('No') === 0) { - // This is a 'NoFoo', set 'Foo' to false - options[ruleMap[ruleName.substr(2)]] = false; - } else { - // ?? - IO.printLine('Unsupported rule name ' + ruleName); - return; - } - } - } - }); - - var edits = ls.getFormattingEditsForRange(filename, test.span.start, test.span.start + test.span.length, options); - - var output = typescriptLS.applyEdits(test.input, edits); - - // Normalize line endings - output = output.replace(/\r\n/g, '\n'); - test.expected = test.expected.replace(/\r\n/g, '\n'); - - if (output != test.expected) { - var outputHtml = ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += '
InputOutputExpected
' + markupCodeForHtml(test.input) + '' + markupCodeForHtml(output) + '' + markupCodeForHtml(test.expected) + '
Format from character ' + test.span.start + ' to ' + (test.span.start + test.span.length) + ' with rules: ' + test.rules.join(', ') + '
'; // test-table - - IO.writeFile(outputFile, IO.readFile(outputFile).contents() + outputHtml, false); - - // TODO: Uncomment when things are working - // throw new Error("Formatting failed - refer to diff-1.html"); - } - } - - var i = 0; - - for (var i = 0; i < documentTests.length; i++) { - var test = documentTests[i]; - - var msg = 'formats the code (index ' + i + ') from ' + test.span.start + ' to ' + (test.span.start + test.span.length) + ' with rules = [' + test.rules.join(', ') + '] correctly'; - it(msg, function(t) { - return function() { - checkTest(t); - } - }(test)); - } -}); - -describe('importedJavaScriptFormatting - formatting operations', function() { - var outputFile = 'diff-2.html'; - IO.writeFile(outputFile, IO.readFile(Harness.userSpecifiedroot + 'tests/cases/unittests/services/formatDiffTemplate.html').contents(), false); - - var checkTest = function(test: FormatOperationTestJson) { - var filename = 'temp.ts'; - var typescriptLS = new Harness.TypeScriptLS(); - typescriptLS.addScript(filename, test.input); - - var ls = typescriptLS.getLanguageService(); - - var operationsText = ''; - - var markedUpInput = test.input; - var output = test.input; - - for (var i = 0; i < test.operations.length; i++) { - var options = new Services.FormatCodeOptions(); - var op = test.operations[i]; - var edits: Services.TextEdit[]; - - if (op.operation === 'CloseBrace') { - edits = ls.languageService.getFormattingEditsAfterKeystroke(filename, op.point.position, '}', options); - operationsText += 'Format for } at position ' + op.point.position.toString(); - markedUpInput = markedUpInput.substring(0, op.point.position) + '✪' + markedUpInput.substring(op.point.position); - } else if (op.operation === 'Enter') { - edits = ls.languageService.getFormattingEditsAfterKeystroke(filename, op.point.position, '\n', options); - operationsText += 'Format for [enter] at position ' + op.point.position.toString(); - markedUpInput = markedUpInput.substring(0, op.point.position) + '✪' + markedUpInput.substring(op.point.position); - } else if (op.operation === 'Semicolon') { - edits = ls.languageService.getFormattingEditsAfterKeystroke(filename, op.point.position, ';', options); - operationsText += 'Format for ; at position ' + op.point.position.toString(); - markedUpInput = markedUpInput.substring(0, op.point.position) + '✪' + markedUpInput.substring(op.point.position); - } else if (op.operation === 'Document') { - edits = ls.languageService.getFormattingEditsForRange(filename, 0, output.length, options); - operationsText += 'Format Document'; - } else if (op.operation === 'Selection') { - edits = ls.languageService.getFormattingEditsForRange(filename, op.span.start, op.span.start + op.span.length, options); - operationsText += 'Format selection from ' + op.span.start + ', length = ' + op.span.length; - } else if (op.operation === 'Paste') { - edits = ls.languageService.getFormattingEditsForRange(filename, op.span.start, op.span.start + op.span.length, options); - operationsText += 'Format pasted content from ' + op.span.start + ', length = ' + op.span.length; - } else { - throw new Error('Unknown operation: ' + op.operation); - } - - output = typescriptLS.applyEdits(test.input, edits); - typescriptLS.updateScript(filename, output); - } - - // Normalize line endings - output = output.replace(/\r\n/g, '\n'); - test.expected = test.expected.replace(/\r\n/g, '\n'); - - var outputHtml = ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += ''; - outputHtml += '
InputOutputExpected
' + markupCodeForHtml(markedUpInput) + '' + markupCodeForHtml(output) + '' + markupCodeForHtml(test.expected) + '
' + operationsText + '
'; // test-table - - if (test.expected == output) { - // Pass - } else { - IO.writeFile(outputFile, IO.readFile(outputFile).contents() + outputHtml, false); - // TODO: Uncomment when things are working - // throw new Error('Format test failed - refer to ' + outputFile); - } - } - - var operationsTests: FormatOperationTestJson[] = eval('[' + IO.readFile(Harness.userSpecifiedroot + 'tests/cases/unittests/services/ruleFormattingTests.json').contents() + ']'); - for (var i = 0; i < operationsTests.length; i++) { - var test = operationsTests[i]; - - var msg = 'formats the text correctly, line = ' + i; - it(msg, function(t) { - return function() { - checkTest(t); - } - }(test)); - } -}); - diff --git a/src/harness/unittests/services/formatting/ruleFormattingTests.json b/src/harness/unittests/services/formatting/ruleFormattingTests.json deleted file mode 100644 index 8f330156f6..0000000000 --- a/src/harness/unittests/services/formatting/ruleFormattingTests.json +++ /dev/null @@ -1,284 +0,0 @@ -{ input: "function a() {\r\nvar b = 0;//}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 31 } } ], expected: "function a() {\r\nvar b = 0;//}\r\n}" }, -{ input: "function foo() {\n do {\n } while (y < 10)\n\n}", operations: [ { operation: "Enter", point: { position: 50 } } ], expected: "function foo() {\n do {\n } while (y < 10)\n\n}" }, -{ input: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\r\n}\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 87 } } ], expected: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\r\n }\r\n\r\n}" }, -{ input: "function a() {\r\n return (\r\n {\r\n x: 0\r\n }\r\n}", operations: [ { operation: "CloseBrace", point: { position: 76 } } ], expected: "function a() {\r\n return (\r\n {\r\n x: 0\r\n }\r\n}" }, -{ input: " if ( a[\";\"])\r\nb++;", operations: [ { operation: "Semicolon", point: { position: 10 } } ], expected: " if ( a[\";\"])\r\nb++;" }, -{ input: "(function () {\r\n a({\r\n b: 0\r\n });\r\n\r\n})();", operations: [ { operation: "Enter", point: { position: 48 } } ], expected: "(function () {\r\n a({\r\n b: 0\r\n });\r\n\r\n})();" }, -{ input: "var obj={a:{b:2,c:{d:{e:{\r\n}}}}}", operations: [ { operation: "Enter", point: { position: 27 } } ], expected: "var obj = {\n a: {\n b: 2, c: {\n d: {\n e: {\r\n }\n }\n }\n }\n}" }, -{ input: "if(1)if(1)if(1)if(1)x+=2;", operations: [ { operation: "Semicolon", point: { position: 25 } } ], expected: "if (1) if (1) if (1) if (1) x += 2;" }, -{ input: "\r\nvar webclass = [\r\n { 'student':\r\n { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' }\r\n }\r\n]", operations: [ { operation: "Document" } ], expected: "\r\nvar webclass = [\r\n {\n 'student':\r\n { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' }\r\n }\r\n]" }, -{ input: "function f(x){ return x }\nwhile (f(true))\n y++;\n", operations: [ { operation: "Enter", point: { position: 51 } } ], expected: "function f(x){ return x }\nwhile (f(true))\n y++;\n" }, -{ input: "throw e;", operations: [ { operation: "Document" } ], expected: "throw e;" }, -{ input: "x = {\n a: 1,\n b: 1\n +\n // test\n 2\n}", operations: [ { operation: "Document" } ], expected: "x = {\n a: 1,\n b: 1\n +\n // test\n 2\n}" }, -{ input: "return 1;", operations: [ { operation: "Document" } ], expected: "return 1;" }, -{ input: "var x = [\n 1,\n 2,\n 3\n]", operations: [ { operation: "Document" } ], expected: "var x = [\n 1,\n 2,\n 3\n]" }, -{ input: "switch \r\n( a ){\r\n case 1:x+=2; break\r\n case 2:{\r\n }\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 9 } } ], expected: "switch\r\n(a) {\r\n case 1:x+=2; break\r\n case 2:{\r\n }\r\n}\r\n" }, -{ input: "if (a)\r\ntest;\r\nelse\r\nif (b)\r\ntest;\r\n", operations: [ { operation: "Enter", point: { position: 36 } } ], expected: "if (a)\r\ntest;\r\nelse\r\nif (b)\r\n test;\r\n" }, -{ input: "do{\r\ndo{\r\ndo{\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)", operations: [ { operation: "CloseBrace", point: { position: 16 } } ], expected: "do{\r\ndo{\r\n do {\r\n } while (a !== b)\r\n}while(a!==b)\r\n}while(a!==b)" }, -{ input: "label1:\r\nvar a;\r\nvar b;", operations: [ { operation: "Document" } ], expected: "label1:\r\n var a;\r\nvar b;" }, -{ input: "\r\nfunction a() {\r\nfunction test() // test\r\n{\r\nif (test) // test\r\n{\r\n}\r\n}\r\n}", operations: [ { operation: "Document" } ], expected: "\r\nfunction a() {\r\n function test() // test\r\n {\r\n if (test) // test\r\n {\r\n }\r\n }\r\n}" }, -{ input: "var obj = {\r\na:{\r\nb:2,c:{\r\nd: {\r\ne: function f() {\r\nreturn obj.a.c.d.e() +f();\r\n}\r\n}\r\n}\r\n}\r\n};", operations: [ { operation: "Semicolon", point: { position: 94 } } ], expected: "var obj = {\r\n a: {\r\n b: 2, c: {\r\n d: {\r\n e: function f() {\r\n return obj.a.c.d.e() + f();\r\n }\r\n }\r\n }\r\n }\r\n};" }, -{ input: "function f() {\r\n do{\r\nx++ }\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "function f() {\r\n do{\r\n x++\n }\r\n\r\n}" }, -{ input: "function foo (a, b, c)", operations: [ { operation: "Document" } ], expected: "function foo(a, b, c)" }, -{ input: "{ var b;\n}", operations: [ { operation: "Document" } ], expected: "{\n var b;\n}" }, -{ input: "var z = {\na: 1};", operations: [ { operation: "Document" } ], expected: "var z = {\n a: 1\n};" }, -{ input: "for (var i = 0; i < 10; i++)\n { var a\n}", operations: [ { operation: "Document" } ], expected: "for (var i = 0; i < 10; i++) {\n var a\n}" }, -{ input: "if (1)\n {\nvar a }", operations: [ { operation: "Document" } ], expected: "if (1) {\n var a\n}" }, -{ input: "while (1)\n { var a\n}", operations: [ { operation: "Document" } ], expected: "while (1) {\n var a\n}" }, -{ input: "do\n { var a\n} while (1)", operations: [ { operation: "Document" } ], expected: "do {\n var a\n} while (1)" }, -{ input: "for (var a in b)\n { var a\n}", operations: [ { operation: "Document" } ], expected: "for (var a in b) {\n var a\n}" }, -{ input: "with (x)\n { var a\n}", operations: [ { operation: "Document" } ], expected: "with (x) {\n var a\n}" }, -{ input: "try\n { var a\n} \ncatch (e)\n { var a\n} \nfinally\n {\n}", operations: [ { operation: "Document" } ], expected: "try {\n var a\n}\ncatch (e) {\n var a\n}\nfinally {\n}" }, -{ input: "switch (x)\n { case 1: { var a }\n}", operations: [ { operation: "Document" } ], expected: "switch (x) {\n case 1: { var a }\n}" }, -{ input: "function f()\n { var x\n}", operations: [ { operation: "Document" } ], expected: "function f() {\n var x\n}" }, -{ input: "if(1)if(1)if(1)if(1){x+=2\r\n}", operations: [ { operation: "CloseBrace", point: { position: 28 } } ], expected: "if (1) if (1) if (1) if (1) {\n x += 2\r\n}" }, -{ input: "switch (a){\r\n case 1: x += 2;\r\n case 2 : \r\n for (var i=0;i<10;i++)\r\ni --;\r\n}\r\n", operations: [ { operation: "Semicolon", point: { position: 84 } } ], expected: "switch (a){\r\n case 1: x += 2;\r\n case 2 : \r\n for (var i = 0; i < 10; i++)\r\n i--;\r\n}\r\n" }, -{ input: "do{for(var i=0;i<10;i++)i-=2}while(1!==1);", operations: [ { operation: "Semicolon", point: { position: 42 } } ], expected: "do { for (var i = 0; i < 10; i++) i -= 2 } while (1 !== 1);" }, -{ input: "for(var i=0;i<10;i++){for(var j=0;j<10;j++)\r\n{j-=i}}", operations: [ { operation: "Enter", point: { position: 45 } } ], expected: "for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++)\r\n { j -= i }\n}" }, -{ input: "function f() {\r\nstring='string\\r\n line2' + 'other part'}", operations: [ { operation: "CloseBrace", point: { position: 63 } } ], expected: "function f() {\r\n string = 'string\\r\n line2' + 'other part'\n}" }, -{ input: "x =\r\n function ()\r\n{\r\n var a\r\n}", operations: [ { operation: "Document" } ], expected: "x =\r\n function () {\r\n var a\r\n }" }, -{ input: "if (a instanceof b) { }", operations: [ { operation: "Document" } ], expected: "if (a instanceof b) { }" }, -{ input: "do a++; while (0)", operations: [ { operation: "Document" } ], expected: "do a++; while (0)" }, -{ input: "foo\r\n(1, 2, 3)", operations: [ { operation: "Document" } ], expected: "foo\r\n(1, 2, 3)" }, -{ input: "if(1) //comment\r\n{\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "if (1) //comment\r\n{\r\n}\r\n" }, -{ input: "var x =\n [\n1\n]", operations: [ { operation: "Document" } ], expected: "var x =\n [\n1\n ]" }, -{ input: "\r\n{\r\n function f() {\r\n var s = 1\r\n }\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 59 } } ], expected: "\r\n{\r\n function f() {\r\n var s = 1\r\n }\r\n\r\n}" }, -{ input: "\r\ndefine(null,\r\n function test() {\r\nvar a;\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\ndefine(null,\r\n function test() {\r\n var a;\r\n }\r\n" }, -{ input: "x = [\r\n 1,\r\n\r\n]", operations: [ { operation: "Enter", point: { position: 15 } } ], expected: "x = [\r\n 1,\r\n\r\n]" }, -{ input: "var x =\n {\na: 1\n}", operations: [ { operation: "Document" } ], expected: "var x =\n {\n a: 1\n }" }, -{ input: "for(var i=0;i<10;i++){for(var j=0;j<10;j++){j-=i}}", operations: [ { operation: "CloseBrace", point: { position: 50 } } ], expected: "for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { j -= i } }" }, -{ input: "function f()\n{\n for (a in b)\n a++;\n}", operations: [ { operation: "Semicolon", point: { position: 40 } } ], expected: "function f()\n{\n for (a in b)\n a++;\n}" }, -{ input: "if(x!=1^y===2) \r\nx+=2\r\n", operations: [ { operation: "Enter", point: { position: 25 } } ], expected: "if(x!=1^y===2) \r\n x += 2\r\n" }, -{ input: "if (1)\r\n if (1)\r\n x++\r\n else\r\n if (1)\r\n x--\r\nelse\r\n x+=2\r\n", operations: [ { operation: "Enter", point: { position: 81 } } ], expected: "if (1)\r\n if (1)\r\n x++\r\n else\r\n if (1)\r\n x--\r\n else\r\n x += 2\r\n" }, -{ input: "switch (a){\r\ncase 1 : x+=2 ; break;\r\n case 2:{\r\n }\r\n}\r\n", operations: [ { operation: "Semicolon", point: { position: 44 } } ], expected: "switch (a){\r\n case 1: x += 2; break;\r\n case 2:{\r\n }\r\n}\r\n" }, -{ input: "{ { {\r\n{\r\ntest\r\n}\r\n}\r\n}\r\n}", operations: [ { operation: "Selection", span: { start: 7, length: 19 } } ], expected: "{ { {\r\n {\r\n test\r\n }\r\n}\r\n}\r\n}" }, -{ input: "do {\r\n do {\r\n do {\r\n }while(a!==b)\r\n\r\n} while (a !== b)\r\n} while (a !== b)", operations: [ { operation: "Enter", point: { position: 55 } } ], expected: "do {\r\n do {\r\n do {\r\n }while(a!==b)\r\n\r\n } while (a !== b)\r\n} while (a !== b)" }, -{ input: "\r\nswitch (t) {\r\n case 1:\r\n{\r\ntest\r\n}\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\nswitch (t) {\r\n case 1:\r\n {\r\n test\r\n }\r\n}\r\n" }, -{ input: "if (true) {\r\n \r\n}", operations: [ { operation: "Document" } ], expected: "if (true) {\r\n\r\n}" }, -{ input: "for(var j=0;j<10;j++)\r\nj-=i;", operations: [ { operation: "Semicolon", point: { position: 28 } } ], expected: "for (var j = 0; j < 10; j++)\r\n j -= i;" }, -{ input: "function a() {\r\n function b() {\r\n //\r\n\r\n }\r\n}", operations: [ { operation: "Enter", point: { position: 48 } } ], expected: "function a() {\r\n function b() {\r\n //\r\n\r\n }\r\n}" }, -{ input: "if(1)if(1)if(1)if(1)x+=2\r\n", operations: [ { operation: "Enter", point: { position: 26 } } ], expected: "if (1) if (1) if (1) if (1) x += 2\r\n" }, -{ input: "do{do{do{}while(a!==b)}while(a!==b)}while(a!==b)\r\n", operations: [ { operation: "Enter", point: { position: 50 } } ], expected: "do { do { do { } while (a !== b) } while (a !== b) } while (a !== b)\r\n" }, -{ input: "foo(\r\n)", operations: [ { operation: "Document" } ], expected: "foo(\r\n)" }, -{ input: "function f() {\r\n'use strict';\r\n}", operations: [ { operation: "Semicolon", point: { position: 29 } } ], expected: "function f() {\r\n 'use strict';\r\n}" }, -{ input: "var x = function() {\n//comment\nreturn 1;\n}", operations: [ { operation: "Document" } ], expected: "var x = function () {\n //comment\n return 1;\n}" }, -{ input: " function foo4() {\r\n function foo5() {\r\n function foo6() {\r\n test1\r\n }\r\n test2\r\n }\r\n }", operations: [ { operation: "Selection", span: { start: 62, length: 120 } } ], expected: " function foo4() {\r\n function foo5() {\r\n function foo6() {\r\n test1\r\n }\r\n test2\r\n }\r\n }" }, -{ input: "do{\r\ndo{\r\ndo{\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)", operations: [ { operation: "CloseBrace", point: { position: 46 } } ], expected: "do {\r\n do {\r\n do {\r\n } while (a !== b)\r\n } while (a !== b)\r\n} while (a !== b)" }, -{ input: "if (true)\n// test\n test;", operations: [ { operation: "Document" } ], expected: "if (true)\n // test\n test;" }, -{ input: "function test() {\r\n return (\r\n function test() {\r\n test;\r\n }\r\n );\r\n}", operations: [ { operation: "Document" } ], expected: "function test() {\r\n return (\r\n function test() {\r\n test;\r\n }\r\n );\r\n}" }, -{ input: "for(var i=0;i<10;i++){\r\nfor(var j=0;j<10;j++){\r\nj-=i\r\n}}", operations: [ { operation: "CloseBrace", point: { position: 56 } } ], expected: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\r\n }\n}" }, -{ input: " var a = 0 ;", operations: [ { operation: "Semicolon", point: { position: 14 } } ], expected: "var a = 0;" }, -{ input: "var obj={a:{b:2,c:{d:\r\n{e:{}}}}}", operations: [ { operation: "Enter", point: { position: 23 } } ], expected: "var obj = {\n a: {\n b: 2, c: {\n d:\r\n { e: {} }\n }\n }\n}" }, -{ input: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n}finally {\r\nx+=2\r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 74 } } ], expected: "function foo() {\r\n try {\r\n x += 2\r\n }\r\n catch (e) {\r\n x += 2\r\n } finally {\r\n x += 2\r\n }\r\n}" }, -{ input: "var obj = {\r\na: {\r\nb: 2, c: {\r\nd: {\r\ne: function f() {\r\nreturn obj.a.c.d.e() + f();\r\n}\r\n}\r\n}\r\n}}", operations: [ { operation: "CloseBrace", point: { position: 96 } } ], expected: "var obj = {\r\n a: {\r\n b: 2, c: {\r\n d: {\r\n e: function f() {\r\n return obj.a.c.d.e() + f();\r\n }\r\n }\r\n }\r\n }\n}" }, -{ input: "if (x!=1^y===2){ x+=2}", operations: [ { operation: "CloseBrace", point: { position: 24 } } ], expected: "if (x != 1 ^ y === 2) { x += 2 }" }, -{ input: "function test() {\r\n var a;\r\n label:\r\n for (; ;)\r\n\r\n", operations: [ { operation: "Enter", point: { position: 58 } } ], expected: "function test() {\r\n var a;\r\n label:\r\n for (; ;)\r\n\r\n" }, -{ input: "for(var i=0;i<10;i++){for(var j=0;j<10;j++){\r\nj-=i}}", operations: [ { operation: "Enter", point: { position: 46 } } ], expected: "for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\r\n j -= i\n }\n}" }, -{ input: "do {\r\n for (var i = 0; i < 10; i++)\r\n i -= 2\r\n }\r\nwhile (1 !== 1)", operations: [ { operation: "Enter", point: { position: 67 } } ], expected: "do {\r\n for (var i = 0; i < 10; i++)\r\n i -= 2\r\n}\r\nwhile (1 !== 1)" }, -{ input: "{\r\n try {\r\n } catch (e) {\r\n }\r\n}", operations: [ { operation: "Document" } ], expected: "{\r\n try {\r\n } catch (e) {\r\n }\r\n}" }, -{ input: "{ { {\r\n{\r\n}\r\n}\r\n}\r\n}", operations: [ { operation: "Selection", span: { start: 7, length: 13 } } ], expected: "{ { {\r\n {\r\n }\r\n}\r\n}\r\n}" }, -{ input: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) {\r\nj -= i}}\r\n", operations: [ { operation: "Enter", point: { position: 78 } } ], expected: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\n }\n}\r\n" }, -{ input: "var a = {\r\n}", operations: [ { operation: "Document" } ], expected: "var a = {\r\n}" }, -{ input: "\r\n switch ( a ) {\r\n case 1: x+=2;\r\n case 2:{\r\n }\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 2 } } ], expected: "\r\nswitch (a) {\r\n case 1: x+=2;\r\n case 2:{\r\n }\r\n}\r\n" }, -{ input: "function a() {\r\nvar b = 0;//;\r\n}", operations: [ { operation: "Semicolon", point: { position: 31 } } ], expected: "function a() {\r\nvar b = 0;//;\r\n}" }, -{ input: "for (a in b) { }", operations: [ { operation: "Document" } ], expected: "for (a in b) { }" }, -{ input: "\r\n{\r\nfunction test(/* test */ a,\r\n /* test */ b\r\n /* test */) {\r\n// test\r\n}\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\n{\r\n function test(/* test */ a,\r\n /* test */ b\r\n /* test */) {\r\n // test\r\n }\r\n}\r\n" }, -{ input: " //\r\n", operations: [ { operation: "Enter", point: { position: 8 } } ], expected: "//\r\n" }, -{ input: " if ( a[\"}\"])\r\nb++;", operations: [ { operation: "CloseBrace", point: { position: 10 } } ], expected: " if ( a[\"}\"])\r\nb++;" }, -{ input: "$ ( document ) . ready ( function ( ) { \n alert ( \"i am ready\" ) ;\n } );", operations: [ { operation: "Semicolon", point: { position: 138 } } ], expected: "$(document).ready(function () {\n alert(\"i am ready\");\n});" }, -{ input: "function f() {\r\nvar s=\"string\";\r\n}", operations: [ { operation: "Semicolon", point: { position: 31 } } ], expected: "function f() {\r\n var s = \"string\";\r\n}" }, -{ input: "do{for(var i=0;i<10;i++)i-=2\r\n}while(1!==1)", operations: [ { operation: "Enter", point: { position: 30 } } ], expected: "do {\n for (var i = 0; i < 10; i++) i -= 2\r\n} while (1 !== 1)" }, -{ input: "do{\r\ndo{\r\n\r\ndo{\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)", operations: [ { operation: "Enter", point: { position: 12 } } ], expected: "do{\r\ndo{\r\n\r\n do {\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)" }, -{ input: "for(var i=0;i<10;i++){for(var j=0;j<10;j++){j-=i}}", operations: [ { operation: "CloseBrace", point: { position: 49 } } ], expected: "for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { j -= i }}" }, -{ input: "var obj = {\r\na: {\r\nb: 2, c: {\r\nd: {\r\ne: function f() {\r\nreturn obj.a.c.d.e() + f();\r\n}\r\n}\r\n } \r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 99 } } ], expected: "var obj = {\r\na: {\r\n b: 2, c: {\r\n d: {\r\n e: function f() {\r\n return obj.a.c.d.e() + f();\r\n }\r\n }\r\n }\r\n}\r\n}" }, -{ input: "var a = 0 ;var b=0;var c = 0 ;", operations: [ { operation: "Paste", span: { start: 13, length: 7 } } ], expected: "var a = 0; var b = 0; var c = 0;" }, -{ input: "function a()\r\n{\r\n}", operations: [ { operation: "Enter", point: { position: 14 } } ], expected: "function a()\r\n{\r\n}" }, -{ input: " function test() { function foo() { function foo3() { function foo4() { function foo5() { function foo6()\r\n{\r\ntest\r\n}\r\n}\r\n}\r\n}\r\n}\r\n}", operations: [ { operation: "Selection", span: { start: 110, length: 25 } } ], expected: " function test() { function foo() { function foo3() { function foo4() { function foo5() { function foo6()\r\n {\r\n test\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }" }, -{ input: " \r\nfunction a() { \r\n return; \r\n} \r\n ", operations: [ { operation: "Document" } ], expected: "\r\nfunction a() {\r\n return;\r\n}\r\n" }, -{ input: "foo(\r\n1, 2, 3)", operations: [ { operation: "Document" } ], expected: "foo(\r\n1, 2, 3)" }, -{ input: "function Init() {\r\n var a = [[1, 2],\r\n [3, 4],\r\n\r\n ];\r\n}", operations: [ { operation: "Enter", point: { position: 63 } } ], expected: "function Init() {\r\n var a = [[1, 2],\r\n [3, 4],\r\n\r\n ];\r\n}" }, -{ input: "\r\n //function start\r\n function abc() { }\r\n //function end\r\n", operations: [ { operation: "Document" } ], expected: "\r\n//function start\r\nfunction abc() { }\r\n//function end\r\n" }, -{ input: "for(var i=0;i<10;i++){\r\n for (var j = 0; j < 10; j++) {\r\nj-=i\r\n\r\n}\r\n}", operations: [ { operation: "Enter", point: { position: 66 } } ], expected: "for(var i=0;i<10;i++){\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\r\n\r\n}\r\n}" }, -{ input: "// JScript source code\r\nfunction adder(a, b) {\r\n ///Adds two numbers \r\n return a + b;\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 94 } } ], expected: "// JScript source code\r\nfunction adder(a, b) {\r\n ///Adds two numbers \r\n return a + b;\r\n}\r\n" }, -{ input: "x = {\r\n a: function() {\r\n},\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "x = {\r\n a: function() {\r\n },\r\n\r\n}" }, -{ input: "if(1)\r\n if(1)\r\n x++\r\n else\r\n if(1)\r\n x+=2\r\n else\r\nx+=2\r\n", operations: [ { operation: "Enter", point: { position: 94 } } ], expected: "if(1)\r\n if(1)\r\n x++\r\n else\r\n if(1)\r\n x+=2\r\n else\r\n x += 2\r\n" }, -{ input: "for (a in b) {\nx++;}\n", operations: [ { operation: "Enter", point: { position: 21 } } ], expected: "for (a in b) {\n x++;\n}\n" }, -{ input: "if(1)if(1)if(1)if(1){x+=2}", operations: [ { operation: "CloseBrace", point: { position: 26 } } ], expected: "if (1) if (1) if (1) if (1) { x += 2 }" }, -{ input: "if (x!=1^y===2){ x+=2\r\n}", operations: [ { operation: "CloseBrace", point: { position: 26 } } ], expected: "if (x != 1 ^ y === 2) {\n x += 2\r\n}" }, -{ input: "var d = new Date ()", operations: [ { operation: "Document" } ], expected: "var d = new Date()" }, -{ input: "do {\r\n} while (1 == 10);", operations: [ { operation: "Document" } ], expected: "do {\r\n} while (1 == 10);" }, -{ input: "string='string+=2';", operations: [ { operation: "Semicolon", point: { position: 19 } } ], expected: "string = 'string+=2';" }, -{ input: "function foo() {\r\n try {\r\n }\r\ncatch(e){\r\n } finally {\r\n }\r\n}", operations: [ { operation: "Enter", point: { position: 48 } } ], expected: "function foo() {\r\n try {\r\n }\r\n catch (e) {\r\n } finally {\r\n }\r\n}" }, -{ input: "try // comment\r\n{\r\n}\r\ncatch (e) // comment\r\n{\r\n}\r\nfinally // comment\r\n{\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "try // comment\r\n{\r\n}\r\ncatch (e) // comment\r\n{\r\n}\r\nfinally // comment\r\n{\r\n}\r\n" }, -{ input: "function f() {\r\n /**/ var x;\r\n}", operations: [ { operation: "Semicolon", point: { position: 39 } } ], expected: "function f() {\r\n /**/ var x;\r\n}" }, -{ input: "if (a)\r\ntest;\r\nelse if (b)\r\ntest;", operations: [ { operation: "Document" } ], expected: "if (a)\r\n test;\r\nelse if (b)\r\n test;" }, -{ input: "foo(1, 2, 3\r\n)", operations: [ { operation: "Document" } ], expected: "foo(1, 2, 3\r\n)" }, -{ input: "\r\nswitch (a){\r\n case 1: x++;\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\nswitch (a) {\r\n case 1: x++;\r\n}\r\n" }, -{ input: "x = {\r\n a: function () {\r\n\r\n }\r\n}", operations: [ { operation: "Enter", point: { position: 39 } } ], expected: "x = {\r\n a: function () {\r\n\r\n }\r\n}" }, -{ input: "switch (a) {\n case 1: b++;\n break;\n\n default: a++;\n break;\n}", operations: [ { operation: "Enter", point: { position: 45 } } ], expected: "switch (a) {\n case 1: b++;\n break;\n\n default: a++;\n break;\n}" }, -{ input: "string='string+=2;'", operations: [ { operation: "Semicolon", point: { position: 18 } } ], expected: "string='string+=2;'" }, -{ input: "function test() {\r\n function foo() {\r\n var a;\r\n// some\r\ncomment\r\n", operations: [ { operation: "Enter", point: { position: 66 } } ], expected: "function test() {\r\n function foo() {\r\n var a;\r\n // some\r\n comment\r\n" }, -{ input: "switch ( a ) {\r\n case 1: x+=2;\r\n case 2:{for(var i=0;i<10;i++){ \r\nx+=2;}\r\n }\r\n}", operations: [ { operation: "CloseBrace", point: { position: 89 } } ], expected: "switch (a) {\r\n case 1: x += 2;\r\n case 2: {\n for (var i = 0; i < 10; i++) {\r\n x += 2;\n }\r\n }\r\n}" }, -{ input: "do{\r\nfor(var i=0;i<10;i++)\r\ni-=2;\r\n}while(1!==1)", operations: [ { operation: "Semicolon", point: { position: 33 } } ], expected: "do{\r\n for (var i = 0; i < 10; i++)\r\n i -= 2;\r\n}while(1!==1)" }, -{ input: "\r\nfunction foo() {\r\n try{ } catch (e) { } finally { }\r\n\r\n\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 63 } } ], expected: "\r\nfunction foo() {\r\n try { } catch (e) { } finally { }\r\n\r\n\r\n}\r\n" }, -{ input: "do{for(var i=0;i<10;i++)\r\ni-=2}while(1!==1)", operations: [ { operation: "Enter", point: { position: 26 } } ], expected: "do {\n for (var i = 0; i < 10; i++)\r\n i -= 2\n} while (1 !== 1)" }, -{ input: "\r\n fun(\r\n {\r\n a: 1\r\n });\r\n", operations: [ { operation: "Document" } ], expected: "\r\nfun(\r\n {\r\n a: 1\r\n });\r\n" }, -{ input: "function f () //comment\r\n{\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "function f() //comment\r\n{\r\n}\r\n" }, -{ input: "function a(b) {\r\n var c = 0;\r\n if (b != null) {\r\n for (d in b) {\r\n }\r\n }\r\n}", operations: [ { operation: "CloseBrace", point: { position: 94 } } ], expected: "function a(b) {\r\n var c = 0;\r\n if (b != null) {\r\n for (d in b) {\r\n }\r\n }\r\n}" }, -{ input: "switch (a) {\r\n case 1:\r\n\r\n break;\r\n}", operations: [ { operation: "Enter", point: { position: 34 } } ], expected: "switch (a) {\r\n case 1:\r\n\r\n break;\r\n}" }, -{ input: " \r\n do{\r\n for(var i=0;i<10;i++)\r\n i -= 2\r\n}\r\nwhile (1 !== 1)", operations: [ { operation: "Enter", point: { position: 5 } } ], expected: "\r\ndo {\r\n for(var i=0;i<10;i++)\r\n i -= 2\r\n}\r\nwhile (1 !== 1)" }, -{ input: "function test() {\r\n label1:\r\nvar a\r\n\r\n var b;\r\n}", operations: [ { operation: "Enter", point: { position: 39 } } ], expected: "function test() {\r\n label1:\r\n var a\r\n\r\n var b;\r\n}" }, -{ input: "var x = {\n//comment\na: 1\n}", operations: [ { operation: "Document" } ], expected: "var x = {\n //comment\n a: 1\n}" }, -{ input: "for(var i=0;i<10;i++){\r\n\r\nfor(var j=0;j<10;j++){\r\nj-=i\r\n}\r\n}", operations: [ { operation: "Enter", point: { position: 26 } } ], expected: "for(var i=0;i<10;i++){\r\n\r\n for (var j = 0; j < 10; j++) {\r\nj-=i\r\n}\r\n}" }, -{ input: "if (true) {\r\n//\r\n} else if (false) {\r\n//\r\n} else\r\n if (true)\r\n//", operations: [ { operation: "Document" } ], expected: "if (true) {\r\n //\r\n} else if (false) {\r\n //\r\n} else\r\n if (true)\r\n //" }, -{ input: "x = [\n 1,\n 1\n +\n // test\n 2\n]", operations: [ { operation: "Document" } ], expected: "x = [\n 1,\n 1\n +\n // test\n 2\n]" }, -{ input: "var x =\n function() {\nreturn 1;\n}", operations: [ { operation: "Document" } ], expected: "var x =\n function () {\n return 1;\n }" }, -{ input: "function f() {\n var x }", operations: [ { operation: "Document" } ], expected: "function f() {\n var x\n}" }, -{ input: "switch (a) {\r\n case 1: b++;\r\n break ;\r\n\r\n default: a++;\r\n break;\r\n}", operations: [ { operation: "Enter", point: { position: 46 } } ], expected: "switch (a) {\r\n case 1: b++;\r\n break;\r\n\r\n default: a++;\r\n break;\r\n}" }, -{ input: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n} finally {\r\nx+=2\r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 32 } } ], expected: "function foo() {\r\n try {\r\n x += 2\r\n }\r\ncatch( e){\r\nx+=2\r\n} finally {\r\nx+=2\r\n}\r\n}" }, -{ input: "function f(a, b\n , c){\n}", operations: [ { operation: "CloseBrace", point: { position: 39 } } ], expected: "function f(a, b\n , c) {\n}" }, -{ input: "function add(a, b) { return a + b}", operations: [ { operation: "Document" } ], expected: "function add(a, b) { return a + b }" }, -{ input: "var a = 0 ;\r\n", operations: [ { operation: "Enter", point: { position: 15 } } ], expected: "var a = 0;\r\n" }, -{ input: "var a = function (b) {\r\nb = 0;\r\n}", operations: [ { operation: "CloseBrace", point: { position: 33 } } ], expected: "var a = function (b) {\r\n b = 0;\r\n}" }, -{ input: "\r\nif (\r\n test) {\r\n a;\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\nif (\r\n test) {\r\n a;\r\n}\r\n" }, -{ input: " var a = 0 ;\r\n var b = { } ;\r\n var c = false ;", operations: [ { operation: "Selection", span: { start: 18, length: 34 } } ], expected: " var a = 0 ;\r\n var b = {};\r\n var c = false ;" }, -{ input: "function a() {\r\n return (\r\n function () {\r\n return 0;\r\n }\r\n}", operations: [ { operation: "CloseBrace", point: { position: 93 } } ], expected: "function a() {\r\n return (\r\n function () {\r\n return 0;\r\n }\r\n}" }, -{ input: "function test() {\r\n label1:\r\n a();\r\n b()\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 59 } } ], expected: "function test() {\r\n label1:\r\n a();\r\n b()\r\n\r\n}" }, -{ input: "(function () {\r\n a({\r\n b: 0\r\n });\r\n})();", operations: [ { operation: "Document" } ], expected: "(function () {\r\n a({\r\n b: 0\r\n });\r\n})();" }, -{ input: "function a() {\r\n /**/ }", operations: [ { operation: "Document" } ], expected: "function a() {\r\n /**/\n}" }, -{ input: "for (var i = 0; i < 10; i++) {\r\n for (var j=0;j<10;j++) {\r\nj=i;\r\n }\r\n}", operations: [ { operation: "Semicolon", point: { position: 64 } } ], expected: "for (var i = 0; i < 10; i++) {\r\n for (var j=0;j<10;j++) {\r\n j = i;\r\n }\r\n}" }, -{ input: "function f() {\r\n var x; /*\r\n */ var y = 2;\r\n}", operations: [ { operation: "Document" } ], expected: "function f() {\r\n var x; /*\r\n */ var y = 2;\r\n}" }, -{ input: "foo (1, 2, 3)", operations: [ { operation: "Document" } ], expected: "foo(1, 2, 3)" }, -{ input: "if (typeof a == null);", operations: [ { operation: "Document" } ], expected: "if (typeof a == null);" }, -{ input: "function f() {\r\n var x = \"\\r\n \"; var y = 2;\r\n}", operations: [ { operation: "Document" } ], expected: "function f() {\r\n var x = \"\\r\n \"; var y = 2;\r\n}" }, -{ input: "void x;", operations: [ { operation: "Document" } ], expected: "void x;" }, -{ input: "function f() {\r\n string='string'\r\n }\r\n", operations: [ { operation: "Enter", point: { position: 44 } } ], expected: "function f() {\r\n string='string'\r\n}\r\n" }, -{ input: "do{\r\nfor(var i=0;i<10;i++)\r\ni-=2\r\n}while(1!==1);", operations: [ { operation: "Semicolon", point: { position: 48 } } ], expected: "do {\r\n for (var i = 0; i < 10; i++)\r\n i -= 2\r\n} while (1 !== 1);" }, -{ input: "function test() {\r\n return (\r\n {\r\n a: 1\r\n }\r\n );\r\n}", operations: [ { operation: "Document" } ], expected: "function test() {\r\n return (\r\n {\r\n a: 1\r\n }\r\n );\r\n}" }, -{ input: "for(var i=0;i<10;i++)\r\n{for(var j=0;j<10;j++){j-=i}}", operations: [ { operation: "Enter", point: { position: 23 } } ], expected: "for (var i = 0; i < 10; i++)\r\n{ for (var j = 0; j < 10; j++) { j -= i } }" }, -{ input: "for(var i=0;i<10;i++){\r\nfor(var j=0;j<10;j++){j-=i}}", operations: [ { operation: "Enter", point: { position: 24 } } ], expected: "for (var i = 0; i < 10; i++) {\r\n for (var j = 0; j < 10; j++) { j -= i }\n}" }, -{ input: "do{\r\nfor(var i=0;i<10;i++)\r\ni-=2\r\n}while(1!==1)\r\n", operations: [ { operation: "Enter", point: { position: 49 } } ], expected: "do{\r\nfor(var i=0;i<10;i++)\r\ni-=2\r\n} while (1 !== 1)\r\n" }, -{ input: "if(1===1\r\n&& 2===2)x+=2", operations: [ { operation: "Enter", point: { position: 10 } } ], expected: "if (1 === 1\r\n&& 2 === 2) x += 2" }, -{ input: "\r\n{\r\n\r\n/* test\r\n test2\r\n test3 */\r\nvar a,\r\n // test\r\n // test\r\n b;\r\n\r\nx = {\r\na: 1 +\r\n // test\r\n /* test\r\n test2 */\r\n 2\r\n}\r\n\r\na(1,\r\n 2). // test\r\n test(); /* test */\r\n\r\n/* test\r\n test2\r\n test3 */\r\nfunction foo(a, b,\r\n /* test\r\n test2\r\n test3 */\r\n c) {\r\n}\r\n\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\n{\r\n\r\n /* test\r\n test2\r\n test3 */\r\n var a,\r\n // test\r\n // test\r\n b;\r\n\r\n x = {\r\n a: 1 +\r\n // test\r\n /* test\r\n test2 */\r\n 2\r\n }\r\n\r\n a(1,\r\n 2). // test\r\n test(); /* test */\r\n\r\n /* test\r\n test2\r\n test3 */\r\n function foo(a, b,\r\n /* test\r\n test2\r\n test3 */\r\n c) {\r\n }\r\n\r\n}\r\n" }, -{ input: "\r\n for (var i = 0; i < 10\r\n ; i--) {\r\n test\r\n ;\r\n }\r\n", operations: [ { operation: "Document" } ], expected: "\r\nfor (var i = 0; i < 10\r\n ; i--) {\r\n test\r\n ;\r\n}\r\n" }, -{ input: "if (1)\r\n x++;\r\nelse if (1)\r\n x--;", operations: [ { operation: "Document" } ], expected: "if (1)\r\n x++;\r\nelse if (1)\r\n x--;" }, -{ input: "x = {\n get foo () {\n },\n set foo (val) {\n }\n};", operations: [ { operation: "Document" } ], expected: "x = {\n get foo() {\n },\n set foo(val) {\n }\n};" }, -{ input: "function foo\r\n(a, b, c) {\r\n}", operations: [ { operation: "Document" } ], expected: "function foo\r\n(a, b, c) {\r\n}" }, -{ input: "switch ( a ) {\r\n case 1: x+=2;\r\n case 2:{for(var i=0;i<10;i++){ \r\nx+=2;\r\n }}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 80 } } ], expected: "switch ( a ) {\r\n case 1: x+=2;\r\n case 2: {\n for (var i = 0; i < 10; i++) {\r\n x += 2;\r\n }\n }\r\n}" }, -{ input: "function f() {\r\n'use strict'}", operations: [ { operation: "CloseBrace", point: { position: 29 } } ], expected: "function f() {\r\n 'use strict'\n}" }, -{ input: "foo(1\r\n, 2, 3)", operations: [ { operation: "Document" } ], expected: "foo(1\r\n, 2, 3)" }, -{ input: "do{\r\ndo\r\n{\r\ndo{\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)", operations: [ { operation: "Enter", point: { position: 9 } } ], expected: "do{\r\n do\r\n {\r\ndo{\r\n}while(a!==b)\r\n}while(a!==b)\r\n}while(a!==b)" }, -{ input: "function Sum(a,b,c) {\r\n for(i=0,j=1,k=0,fib=1;i<5;i++,fib=j+k,k=j,j=fib) {\r\n var sparseArray = [1,,,,5]\r\n }\r\n}", operations: [ { operation: "Selection", span: { start: 49, length: 3 } } ], expected: "function Sum(a,b,c) {\r\n for (i = 0, j = 1, k = 0, fib = 1; i < 5; i++, fib = j + k, k = j, j = fib) {\r\n var sparseArray = [1,,,,5]\r\n }\r\n}" }, -{ input: "function a() {\r\n function b() {\r\n\r\n }\r\n}", operations: [ { operation: "Document" } ], expected: "function a() {\r\n function b() {\r\n\r\n }\r\n}" }, -{ input: "", operations: [ { operation: "Document" } ], expected: "" }, -{ input: "function a() {\r\nvar b=\"c\"\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 27 } } ], expected: "function a() {\r\n var b = \"c\"\r\n\r\n}" }, -{ input: " if ( a[\"\r\n\"])\r\nb++;", operations: [ { operation: "Enter", point: { position: 11 } } ], expected: "if ( a[\"\r\n\"])\r\nb++;" }, -{ input: "/* \r\n \r\n*/ ", operations: [ { operation: "Document" } ], expected: "/* \r\n \r\n*/" }, -{ input: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n}finally {\r\nx+=2\r\n}\r\n};", operations: [ { operation: "Semicolon", point: { position: 75 } } ], expected: "function foo() {\r\n try {\r\n x += 2\r\n }\r\n catch (e) {\r\n x += 2\r\n } finally {\r\n x += 2\r\n }\r\n};" }, -{ input: "if (1) if (1) a++;", operations: [ { operation: "Document" } ], expected: "if (1) if (1) a++;" }, -{ input: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n}finally {\r\nx+=2\r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 53 } } ], expected: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\n catch (e) {\r\n x += 2\r\n }finally {\r\nx+=2\r\n}\r\n}" }, -{ input: "function f() {\r\n'use strict'\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 30 } } ], expected: "function f() {\r\n 'use strict'\r\n\r\n}" }, -{ input: " \r\n ", operations: [ { operation: "Document" } ], expected: " \r\n " }, -{ input: "{ var b; }", operations: [ { operation: "Document" } ], expected: "{ var b; }" }, -{ input: "var z = {a: 1};", operations: [ { operation: "Document" } ], expected: "var z = { a: 1 };" }, -{ input: "var z =\n {a: 1};", operations: [ { operation: "Document" } ], expected: "var z =\n { a: 1 };" }, -{ input: "for (var i = 0; i < 10; i++) { var a }", operations: [ { operation: "Document" } ], expected: "for (var i = 0; i < 10; i++) { var a }" }, -{ input: "for (var i = 0; i < 10; i++)\n { var a }", operations: [ { operation: "Document" } ], expected: "for (var i = 0; i < 10; i++)\n{ var a }" }, -{ input: "if (1) { var a }", operations: [ { operation: "Document" } ], expected: "if (1) { var a }" }, -{ input: "if (1)\n { var a }", operations: [ { operation: "Document" } ], expected: "if (1)\n{ var a }" }, -{ input: "while (1) { var a }", operations: [ { operation: "Document" } ], expected: "while (1) { var a }" }, -{ input: "while (1)\n { var a }", operations: [ { operation: "Document" } ], expected: "while (1)\n{ var a }" }, -{ input: "do { var a } while (1)", operations: [ { operation: "Document" } ], expected: "do { var a } while (1)" }, -{ input: "do\n { var a }\n while (1)", operations: [ { operation: "Document" } ], expected: "do\n{ var a }\nwhile (1)" }, -{ input: "for (var a in b) { var a }", operations: [ { operation: "Document" } ], expected: "for (var a in b) { var a }" }, -{ input: "for (var a in b)\n { var a }", operations: [ { operation: "Document" } ], expected: "for (var a in b)\n{ var a }" }, -{ input: "with (x) { var a }", operations: [ { operation: "Document" } ], expected: "with (x) { var a }" }, -{ input: "with (x)\n { var a }", operations: [ { operation: "Document" } ], expected: "with (x)\n{ var a }" }, -{ input: "try { var a } \ncatch (e) { var a } \nfinally { }", operations: [ { operation: "Document" } ], expected: "try { var a }\ncatch (e) { var a }\nfinally { }" }, -{ input: "try\n { var a } \ncatch (e)\n { var a } \nfinally\n { }", operations: [ { operation: "Document" } ], expected: "try\n{ var a }\ncatch (e)\n{ var a }\nfinally\n{ }" }, -{ input: "switch (x) { case 1: { var a } }", operations: [ { operation: "Document" } ], expected: "switch (x) { case 1: { var a } }" }, -{ input: "switch (x)\n { case 1: { var a } }", operations: [ { operation: "Document" } ], expected: "switch (x)\n{ case 1: { var a } }" }, -{ input: "function f() { var x }", operations: [ { operation: "Document" } ], expected: "function f() { var x }" }, -{ input: "function f()\n\n { var x }", operations: [ { operation: "Document" } ], expected: "function f()\n\n{ var x }" }, -{ input: "function test() {\r\nlabel1:\r\nvar a;\r\nvar b;\r\n}", operations: [ { operation: "Document" } ], expected: "function test() {\r\n label1:\r\n var a;\r\n var b;\r\n}" }, -{ input: "{\n x =\nfunction () {\n };\n}", operations: [ { operation: "Document" } ], expected: "{\n x =\nfunction () {\n};\n}" }, -{ input: "switch (a){\r\n case 1: x+=2;\r\ncase 2 : { \r\nx+=2}\r\n}", operations: [ { operation: "Enter", point: { position: 49 } } ], expected: "switch (a){\r\n case 1: x+=2;\r\n case 2: {\r\n x += 2\n }\r\n}" }, -{ input: " // ;", operations: [ { operation: "Semicolon", point: { position: 7 } } ], expected: " // ;" }, -{ input: "// JScript source code\r\nfunction adder(a, b) {\r\n ///Adds two numbers \r\n return a + b;\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 115 } } ], expected: "// JScript source code\r\nfunction adder(a, b) {\r\n ///Adds two numbers \r\n return a + b;\r\n}\r\n" }, -{ input: "function foo4() {\r\n test;\r\n for (; ;) {\r\n test\r\n }\r\n}", operations: [ { operation: "Selection", span: { start: 46, length: 33 } } ], expected: "function foo4() {\r\n test;\r\n for (; ;) {\r\n test\r\n }\r\n}" }, -{ input: "if (a in b) { }", operations: [ { operation: "Document" } ], expected: "if (a in b) { }" }, -{ input: "\r\nfunction f() {\r\nlabel0:\r\nfor (var i = 0; i < 10; i++) {\r\nlabel1: {\r\nfor (var i = 0; i < 10; i++)\r\nx = 2;\r\nlabel2:\r\nfor (var i = 0; i < 10; i++) {\r\nbreak label2\r\n}\r\n}\r\n}\r\n}", operations: [ { operation: "Document" } ], expected: "\r\nfunction f() {\r\n label0:\r\n for (var i = 0; i < 10; i++) {\r\n label1: {\r\n for (var i = 0; i < 10; i++)\r\n x = 2;\r\n label2:\r\n for (var i = 0; i < 10; i++) {\r\n break label2\r\n }\r\n }\r\n }\r\n}" }, -{ input: "function f() {\r\nstring='string'}", operations: [ { operation: "CloseBrace", point: { position: 32 } } ], expected: "function f() {\r\n string = 'string'\n}" }, -{ input: "\r\nfunction a() {\r\nfunction test() /* test */\r\n{\r\nif (test) /* test */\r\n{\r\n}\r\n}\r\n}", operations: [ { operation: "Document" } ], expected: "\r\nfunction a() {\r\n function test() /* test */ {\r\n if (test) /* test */ {\r\n }\r\n }\r\n}" }, -{ input: "that = {\r\n method: function () {\r\n return this.datum;\r\n } , \r\n\r\n datum: 0\r\n};", operations: [ { operation: "Enter", point: { position: 98 } } ], expected: "that = {\r\n method: function () {\r\n return this.datum;\r\n },\r\n\r\n datum: 0\r\n};" }, -{ input: "for (; ;)\n// test\n test;", operations: [ { operation: "Document" } ], expected: "for (; ;)\n // test\n test;" }, -{ input: "(function () {\r\n a({\r\n b: 0\r\n });\r\n\r\n})();", operations: [ { operation: "Enter", point: { position: 50 } } ], expected: "(function () {\r\n a({\r\n b: 0\r\n });\r\n\r\n})();" }, -{ input: "var f = function () {\n mycanvas.onmousedown = function () {\n };\n\n}", operations: [ { operation: "Enter", point: { position: 70 } } ], expected: "var f = function () {\n mycanvas.onmousedown = function () {\n };\n\n}" }, -{ input: "var obj={a:{b:2,c:{d:{e:{}}}}};", operations: [ { operation: "Semicolon", point: { position: 31 } } ], expected: "var obj = { a: { b: 2, c: { d: { e: {} } } } };" }, -{ input: "if (1)\r\n x++;\r\nelse x--;", operations: [ { operation: "Document" } ], expected: "if (1)\r\n x++;\r\nelse x--;" }, -{ input: "do{\r\nfor(var i=0;i<10;i++)i-=2}while(1!==1)", operations: [ { operation: "Enter", point: { position: 5 } } ], expected: "do {\r\n for (var i = 0; i < 10; i++) i -= 2\n} while (1 !== 1)" }, -{ input: "switch (a){\r\n case 1,2,3:\r\n break;\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "switch (a) {\r\n case 1, 2, 3:\r\n break;\r\n}\r\n" }, -{ input: " foo(function (file) {\r\n return 0\r\n })\r\n .then(function (doc) {\r\n return 1\r\n });", operations: [ { operation: "Document" } ], expected: "foo(function (file) {\r\n return 0\r\n})\r\n .then(function (doc) {\r\n return 1\r\n });" }, -{ input: "var a = 1;\nvar f = function () {\n var b = 2;\n}\n", operations: [ { operation: "Enter", point: { position: 50 } } ], expected: "var a = 1;\nvar f = function () {\n var b = 2;\n}\n" }, -{ input: "do{for(var i=0;i<10;i++)i-=2}\r\nwhile(1!==1)", operations: [ { operation: "Enter", point: { position: 31 } } ], expected: "do { for (var i = 0; i < 10; i++) i -= 2 }\r\nwhile (1 !== 1)" }, -{ input: " function a( b,c ) \r\n {\r\n var d=0 ;\r\n }", operations: [ { operation: "Document" } ], expected: "function a(b, c) {\r\n var d = 0;\r\n}" }, -{ input: "function f() {\r\n /*\r\n */ var x\r\n\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 59 } } ], expected: "function f() {\r\n /*\r\n */ var x\r\n\r\n\r\n}" }, -{ input: "if (x!=1^y===2) x+=2\r\n", operations: [ { operation: "Enter", point: { position: 24 } } ], expected: "if (x != 1 ^ y === 2) x += 2\r\n" }, -{ input: "function f() {\n }", operations: [ { operation: "Enter", point: { position: 15 } } ], expected: "function f() {\n}" }, -{ input: "function test() {\r\n try { }\r\n catch (e) { }\r\n finally\r\n}", operations: [ { operation: "Document" } ], expected: "function test() {\r\n try { }\r\n catch (e) { }\r\n finally\r\n }" }, -{ input: "a = [\n // test\n foo(\n // test\n 1),\n 2\n];", operations: [ { operation: "Document" } ], expected: "a = [\n // test\n foo(\n // test\n 1),\n 2\n];" }, -{ input: "if (x!=1^y===2) x+=2;", operations: [ { operation: "Semicolon", point: { position: 23 } } ], expected: "if (x != 1 ^ y === 2) x += 2;" }, -{ input: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n}finally {\r\nx+=2\r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 71 } } ], expected: "function foo() {\r\ntry {\r\nx+=2\r\n}\r\ncatch( e){\r\nx+=2\r\n} finally {\r\n x += 2\r\n}\r\n}" }, -{ input: "switch (a) {\n case 1: b++;\n break;\n\n default: a++;\n break;\n}", operations: [ { operation: "Enter", point: { position: 46 } } ], expected: "switch (a) {\n case 1: b++;\n break;\n\n default: a++;\n break;\n}" }, -{ input: "function test() { }\r\n", operations: [ { operation: "Enter", point: { position: 27 } } ], expected: "function test() { }\r\n" }, -{ input: "delete x;", operations: [ { operation: "Document" } ], expected: "delete x;" }, -{ input: "\r\n{\r\n\r\nvar a,\r\n b;\r\n\r\nx = {\r\na: 1 +\r\n 2\r\n}\r\n\r\na(1,\r\n 2).\r\n test();\r\n\r\nfunction foo(a, b,\r\n c) {\r\n}\r\n\r\nfor (i = 0;\r\n i < 1;\r\n i++) {\r\n}\r\n\r\nfor (a\r\n in b) {\r\n}\r\n\r\nwhile (i +\r\n 2) {\r\n}\r\n\r\nswitch (i +\r\n 2) {\r\n\r\n case 1 +\r\n 3:\r\n break;\r\n}\r\n\r\ntry {\r\n}\r\ncatch (\r\n e) {\r\n}\r\n\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\n{\r\n\r\n var a,\r\n b;\r\n\r\n x = {\r\n a: 1 +\r\n 2\r\n }\r\n\r\n a(1,\r\n 2).\r\n test();\r\n\r\n function foo(a, b,\r\n c) {\r\n }\r\n\r\n for (i = 0;\r\n i < 1;\r\n i++) {\r\n }\r\n\r\n for (a\r\n in b) {\r\n }\r\n\r\n while (i +\r\n 2) {\r\n }\r\n\r\n switch (i +\r\n 2) {\r\n\r\n case 1 +\r\n 3:\r\n break;\r\n }\r\n\r\n try {\r\n }\r\n catch (\r\n e) {\r\n }\r\n\r\n}\r\n" }, -{ input: "function f() {\r\n do{\r\nx++ }\r\n}", operations: [ { operation: "CloseBrace", point: { position: 30 } } ], expected: "function f() {\r\n do {\r\n x++\n }\r\n}" }, -{ input: "do\r\n{for(var i=0;i<10;i++)i-=2}while(1!==1)", operations: [ { operation: "Enter", point: { position: 4 } } ], expected: "do\r\n{ for (var i = 0; i < 10; i++) i -= 2 } while (1 !== 1)" }, -{ input: "switch (a){\r\n case 1 :\r\n x+=2\r\n case 2:{\r\n }\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 28 } } ], expected: "switch (a){\r\n case 1:\r\n x += 2\r\n case 2:{\r\n }\r\n}\r\n" }, -{ input: "var x = [\n //comment\n 1,\n 2,\n 3\n]", operations: [ { operation: "Document" } ], expected: "var x = [\n //comment\n 1,\n 2,\n 3\n]" }, -{ input: "switch (a){\r\n case 1: x += 2;\r\n\r\ncase 1 : x+=2;\r\n}\r\n", operations: [ { operation: "Enter", point: { position: 36 } } ], expected: "switch (a){\r\n case 1: x += 2;\r\n\r\n case 1: x += 2;\r\n}\r\n" }, -{ input: " foo(function (file) {\r\n return 0\r\n }).then(function (doc) {\r\n return 1\r\n });", operations: [ { operation: "Document" } ], expected: "foo(function (file) {\r\n return 0\r\n}).then(function (doc) {\r\n return 1\r\n});" }, -{ input: "function f() {\r\nvar s=1 /**/;\r\n}", operations: [ { operation: "Semicolon", point: { position: 30 } } ], expected: "function f() {\r\n var s = 1 /**/;\r\n}" }, -{ input: "switch (a){\r\n case 1: x+=2;\r\n case 2:{\r\n }\r\n \r\n}", operations: [ { operation: "Enter", point: { position: 61 } } ], expected: "switch (a){\r\n case 1: x+=2;\r\n case 2:{\r\n }\r\n\r\n}" }, -{ input: "if(1)\r\nif(1)\r\nx++\r\nelse\r\nif(1)\r\nx+=2\r\nelse\r\nx+=2\r\n\r\n\r\n\r\n;", operations: [ { operation: "Semicolon", point: { position: 57 } } ], expected: "if (1)\r\n if (1)\r\n x++\r\n else\r\n if (1)\r\n x += 2\r\n else\r\n x += 2\r\n\r\n\r\n\r\n;" }, -{ input: "function a() {\r\nvar b = 0;//\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "function a() {\r\n var b = 0;//\r\n\r\n}" }, -{ input: "if (a)\r\ntest;\r\nelse\r\nif (b)\r\ntest;", operations: [ { operation: "Document" } ], expected: "if (a)\r\n test;\r\nelse\r\n if (b)\r\n test;" }, -{ input: "for(var j=0;j<10;j++)j-=i;", operations: [ { operation: "Semicolon", point: { position: 26 } } ], expected: "for (var j = 0; j < 10; j++) j -= i;" }, -{ input: "if(1)\r\nif(1)\r\nx++\r\nelse\r\nif(1)\r\nx+=2\r\nelse\r\nx+=2;", operations: [ { operation: "Semicolon", point: { position: 49 } } ], expected: "if (1)\r\n if (1)\r\n x++\r\n else\r\n if (1)\r\n x += 2\r\n else\r\n x += 2;" }, -{ input: "function test() {\r\n var a\r\n }", operations: [ { operation: "Document" } ], expected: "function test() {\r\n var a\r\n}" }, -{ input: "if (1) {\r\n} else { }", operations: [ { operation: "Document" } ], expected: "if (1) {\r\n} else { }" }, -{ input: "function f() {\r\n /*\r\n\r\n */\r\n}", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "function f() {\r\n /*\r\n\r\n */\r\n}" }, -{ input: "if (x!=1^y===2) \r\n x+=2", operations: [ { operation: "Enter", point: { position: 18 } } ], expected: "if (x != 1 ^ y === 2)\r\n x += 2" }, -{ input: "for (a in b) {\n for (c in d) {\n for (e in f) {\n for (q in w) {}}}}\n", operations: [ { operation: "Enter", point: { position: 88 } } ], expected: "for (a in b) {\n for (c in d) {\n for (e in f) {\n for (q in w) { }\n }\n }\n}\n" }, -{ input: "a=a+\nb+\n c+\n d +\ne +\nm+f;", operations: [ { operation: "Semicolon", point: { position: 100 } } ], expected: "a = a +\nb +\n c +\n d +\ne +\nm + f;" }, -{ input: "x = {\r\n get a() {\r\n\r\n }\r\n}", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "x = {\r\n get a() {\r\n\r\n }\r\n}" }, -{ input: "if(1)\r\n;", operations: [ { operation: "Enter", point: { position: 7 } } ], expected: "if (1)\r\n ;" }, -{ input: "function test() {\r\n return (\r\n [\r\n 1\r\n ]\r\n );\r\n}", operations: [ { operation: "Document" } ], expected: "function test() {\r\n return (\r\n [\r\n 1\r\n ]\r\n );\r\n}" }, -{ input: "string='string+=2\\r\n'", operations: [ { operation: "Enter", point: { position: 20 } } ], expected: "string = 'string+=2\\r\n'" }, -{ input: "if(1)\r\nif(1)\r\nx++\r\nelse\r\n{if(1)\r\nx+=2\r\nelse\r\nx+=2}", operations: [ { operation: "CloseBrace", point: { position: 50 } } ], expected: "if(1)\r\n if (1)\r\n x++\r\n else {\n if (1)\r\n x += 2\r\n else\r\n x += 2\n }" }, -{ input: " function test() { function foo() { function foo3() { function foo4() { function foo5() { function foo6()\r\n{\r\n}\r\n}\r\n}\r\n}\r\n}\r\n}", operations: [ { operation: "Selection", span: { start: 110, length: 19 } } ], expected: " function test() { function foo() { function foo3() { function foo4() { function foo5() { function foo6()\r\n {\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }" }, -{ input: "switch (a){\r\n case 1: x+=2;\r\n case 2 : { x+=2;}\r\n}\r\n", operations: [ { operation: "Semicolon", point: { position: 53 } } ], expected: "switch (a){\r\n case 1: x+=2;\r\n case 2: { x += 2;}\r\n}\r\n" }, -{ input: "// ", operations: [ { operation: "Document" } ], expected: "// " }, -{ input: "for(var i=0;\r\ni<10;i++){for(var j=0;j<10;j++){j-=i}}", operations: [ { operation: "Enter", point: { position: 14 } } ], expected: "for (var i = 0;\r\ni < 10; i++) { for (var j = 0; j < 10; j++) { j -= i } }" }, -{ input: "if (a) if (b) if (c) if (d)\r\ntest;", operations: [ { operation: "Document" } ], expected: "if (a) if (b) if (c) if (d)\r\n test;" }, -{ input: "do{for(var i=0;i<10;i++)i-=2}while(1!==1)", operations: [ { operation: "Semicolon", point: { position: 15 } } ], expected: "do { for (var i = 0;i<10;i++)i-=2}while(1!==1)" }, -{ input: "$ ( '#TextBox1' ) . unbind ( ) ;", operations: [ { operation: "Document" } ], expected: "$('#TextBox1').unbind();" }, -{ input: "do{do{do{}while(a!==b)}while(a!==b)}while(a!==b);", operations: [ { operation: "Semicolon", point: { position: 49 } } ], expected: "do { do { do { } while (a !== b) } while (a !== b) } while (a !== b);" }, -{ input: "do{for(var i=0;i<10;i++)i-=2;}while(1!==1)", operations: [ { operation: "Semicolon", point: { position: 29 } } ], expected: "do { for (var i = 0; i < 10; i++) i -= 2;}while(1!==1)" }, -{ input: "for(var i=0;i<10;i++){\r\nfor(var j=0;j<10;j++){\r\nj-=i\r\n}\r\n}", operations: [ { operation: "CloseBrace", point: { position: 55 } } ], expected: "for(var i=0;i<10;i++){\r\n for (var j = 0; j < 10; j++) {\r\n j -= i\r\n }\r\n}" }, -{ input: "function a() {\r\nfunction b() {\r\nfunction c() {\r\n}}}", operations: [ { operation: "CloseBrace", point: { position: 51 } } ], expected: "function a() {\r\n function b() {\r\n function c() {\r\n }\n }\n}" }, -{ input: " do do do do\r\n test;\r\n while (0)\r\n while (0)\r\n while (0)\r\n while (0)", operations: [ { operation: "Document" } ], expected: "do do do do\r\n test;\r\nwhile (0)\r\nwhile (0)\r\nwhile (0)\r\nwhile (0)" }, -{ input: "/**/ ", operations: [ { operation: "Document" } ], expected: "/**/" }, -{ input: "function a()\n{ var a\n}", operations: [ { operation: "Enter", point: { position: 21 } } ], expected: "function a()\n{\n var a\n}" }, -{ input: "for(var i=0;i<10;i++){for(var j=0;j<10;\r\nj++){j-=i}}", operations: [ { operation: "Enter", point: { position: 41 } } ], expected: "for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10;\r\n j++) { j -= i }\n}" }, -{ input: "function a() {\r\n if (true) {\r\n }\r\n\r\n}", operations: [ { operation: "Enter", point: { position: 40 } } ], expected: "function a() {\r\n if (true) {\r\n }\r\n\r\n}" }, -{ input: "string='string+=2'\r\n", operations: [ { operation: "Enter", point: { position: 20 } } ], expected: "string = 'string+=2'\r\n" }, -{ input: "for (a in b) {\r\nx++;}\r\n", operations: [ { operation: "Enter", point: { position: 23 } } ], expected: "for (a in b) {\r\n x++;\n}\r\n" }, -{ input: "var obj={a:{b:2,c:{\r\nd:{e:{}}}}}", operations: [ { operation: "Enter", point: { position: 21 } } ], expected: "var obj = {\n a: {\n b: 2, c: {\r\n d: { e: {} }\n }\n }\n}" }, -{ input: "\r\n// test\r\n\r\n{\r\n// test\r\n}\r\n\r\nfunction foo() {\r\n// test\r\n\r\nswitch (a) {\r\n// test\r\ncase 1:\r\n// test\r\ndefault:\r\n// test\r\n}\r\n\r\nif (false)\r\n// test\r\nifblock;\r\n\r\nif (false) {\r\n//test\r\n}\r\n\r\nif (false) test;\r\nelse\r\n// test\r\ntest;\r\n\r\nif (false) test;\r\nelse {\r\n// test\r\ntest;\r\n}\r\n\r\nfor (; ;)\r\n// test\r\ntest;\r\n\r\nfor (; ;) {\r\n// test\r\nforblock;\r\n}\r\n\r\nfor (a in b)\r\n// test\r\ntest;\r\n\r\nfor (a in b) {\r\n// test\r\ntest\r\n}\r\n\r\nwhile (false)\r\n// test\r\ntest;\r\n\r\nwhile (false) {\r\n// test\r\ntest;\r\n}\r\n\r\nwith (a) {\r\n// test\r\n}\r\n\r\ndo\r\n// test\r\ntestl\r\nwhile (false)\r\n\r\ndo {\r\n// test\r\ntest;\r\n} while (false)\r\n\r\ntry {\r\n// test\r\n} catch (e) {\r\n// test\r\n} finally {\r\n// test\r\n}\r\n\r\n(function () {\r\nvar a = function () {\r\nreturn 1;\r\n},\r\n// This is a comment inline with a multiline statement\r\nb = 2,\r\nc = 3;\r\n})();\r\n\r\n\r\nvar a = {\r\n// test\r\nx: 1,\r\ny: 2 +\r\n// test\r\n3 +\r\n4,\r\n}\r\n\r\n\r\nvar a,\r\n// test\r\nb;\r\n\r\nvar a = [\r\n// test\r\n1,\r\n2,\r\n3\r\n];\r\n\r\na = 1 +\r\n// test\r\n2;\r\n\r\n}\r\n", operations: [ { operation: "Document" } ], expected: "\r\n// test\r\n\r\n{\r\n // test\r\n}\r\n\r\nfunction foo() {\r\n // test\r\n\r\n switch (a) {\r\n // test\r\n case 1:\r\n // test\r\n default:\r\n // test\r\n }\r\n\r\n if (false)\r\n // test\r\n ifblock;\r\n\r\n if (false) {\r\n //test\r\n }\r\n\r\n if (false) test;\r\n else\r\n // test\r\n test;\r\n\r\n if (false) test;\r\n else {\r\n // test\r\n test;\r\n }\r\n\r\n for (; ;)\r\n // test\r\n test;\r\n\r\n for (; ;) {\r\n // test\r\n forblock;\r\n }\r\n\r\n for (a in b)\r\n // test\r\n test;\r\n\r\n for (a in b) {\r\n // test\r\n test\r\n }\r\n\r\n while (false)\r\n // test\r\n test;\r\n\r\n while (false) {\r\n // test\r\n test;\r\n }\r\n\r\n with (a) {\r\n // test\r\n }\r\n\r\n do\r\n // test\r\n testl\r\n while (false)\r\n\r\n do {\r\n // test\r\n test;\r\n } while (false)\r\n\r\n try {\r\n // test\r\n } catch (e) {\r\n // test\r\n } finally {\r\n // test\r\n }\r\n\r\n (function () {\r\n var a = function () {\r\n return 1;\r\n },\r\n // This is a comment inline with a multiline statement\r\n b = 2,\r\n c = 3;\r\n })();\r\n\r\n\r\n var a = {\r\n // test\r\n x: 1,\r\n y: 2 +\r\n // test\r\n 3 +\r\n 4,\r\n }\r\n\r\n\r\n var a,\r\n // test\r\n b;\r\n\r\n var a = [\r\n // test\r\n 1,\r\n 2,\r\n 3\r\n ];\r\n\r\n a = 1 +\r\n // test\r\n 2;\r\n\r\n}\r\n" }, -{ input: " \r\n /* \r\n\r\n a \r\n a\r\n a \r\n a \r\na \r\n \r\n\r\n */ \r\n ", operations: [ { operation: "Document" } ], expected: "\r\n/* \r\n\r\n a \r\n a\r\n a \r\na \r\na \r\n\r\n\r\n*/\r\n" }, -{ input: "string='{string +=2}'", operations: [ { operation: "CloseBrace", point: { position: 20 } } ], expected: "string='{string +=2}'" }, -{ input: "var obj={a:{b:2,c:{d:{e:{}}}}}\r\n", operations: [ { operation: "Enter", point: { position: 32 } } ], expected: "var obj = { a: { b: 2, c: { d: { e: {} } } } }\r\n" }, -{ input: "string='string\\r\n line2'+'other part'\r\n", operations: [ { operation: "Enter", point: { position: 47 } } ], expected: "string='string\\r\n line2' + 'other part'\r\n" }, -{ input: " switch( a)\r\n{case 1 :x+=2 ;break\r\n case 2:{\r\n }\r\n}", operations: [ { operation: "Enter", point: { position: 13 } } ], expected: "switch (a)\r\n{\n case 1: x += 2; break\r\n case 2:{\r\n }\r\n}" } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/classes.ts b/src/harness/unittests/services/formatting/testCode/formatting/classes.ts deleted file mode 100644 index e779f69810..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/classes.ts +++ /dev/null @@ -1,79 +0,0 @@ - class a { - constructor ( n : number ) ; - constructor ( s : string ) ; - constructor ( ns : any ) { - - } - - public pgF ( ) { } ; - - public pv ; - public get d ( ) { - return 30 ; - } - public set d ( ) { - } - - public static get p2 ( ) { - return { x : 30 , y : 40 } ; - } - - private static d2 ( ) { - } - private static get p3 ( ) { - return "string" ; - } - private pv3 ; - - private foo ( n : number ) : string ; - private foo ( s : string ) : string ; - private foo ( ns : any ) { - return ns.toString ( ) ; - } -} - - class b extends a { -} - - class m1b { - -} - - interface m1ib { - - } - class c extends m1b { -} - - class ib2 implements m1ib { -} - - declare class aAmbient { - constructor ( n : number ) ; - constructor ( s : string ) ; - public pgF ( ) : void ; - public pv ; - public d : number ; - static p2 : { x : number ; y : number ; } ; - static d2 ( ) ; - static p3 ; - private pv3 ; - private foo ( s ) ; -} - - class d { - private foo ( n : number ) : string ; - private foo ( ns : any ) { - return ns.toString ( ) ; - } - private foo ( s : string ) : string ; -} - - class e { - private foo ( ns : any ) { - return ns.toString ( ) ; - } - private foo ( s : string ) : string ; - private foo ( n : number ) : string ; -} - diff --git a/src/harness/unittests/services/formatting/testCode/formatting/classesBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/classesBaseline.ts deleted file mode 100644 index e7e69b4412..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/classesBaseline.ts +++ /dev/null @@ -1,79 +0,0 @@ -class a { - constructor(n: number); - constructor(s: string); - constructor(ns: any) { - - } - - public pgF() { }; - - public pv; - public get d() { - return 30; - } - public set d() { - } - - public static get p2() { - return { x: 30, y: 40 }; - } - - private static d2() { - } - private static get p3() { - return "string"; - } - private pv3; - - private foo(n: number): string; - private foo(s: string): string; - private foo(ns: any) { - return ns.toString(); - } -} - -class b extends a { -} - -class m1b { - -} - -interface m1ib { - -} -class c extends m1b { -} - -class ib2 implements m1ib { -} - -declare class aAmbient { - constructor(n: number); - constructor(s: string); - public pgF(): void; - public pv; - public d: number; - static p2: { x: number; y: number; }; - static d2(); - static p3; - private pv3; - private foo(s); -} - -class d { - private foo(n: number): string; - private foo(ns: any) { - return ns.toString(); - } - private foo(s: string): string; -} - -class e { - private foo(ns: any) { - return ns.toString(); - } - private foo(s: string): string; - private foo(n: number): string; -} - diff --git a/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMark.ts b/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMark.ts deleted file mode 100644 index 5562e14204..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMark.ts +++ /dev/null @@ -1,4 +0,0 @@ -class foo { - constructor (n?: number, m? = 5, o?: string = "") { } - x:number = 1?2:3; -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMarkBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMarkBaseline.ts deleted file mode 100644 index 52bbe56251..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/colonAndQMarkBaseline.ts +++ /dev/null @@ -1,4 +0,0 @@ -class foo { - constructor(n?: number, m? = 5, o?: string = "") { } - x: number = 1 ? 2 : 3; -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunction.ts b/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunction.ts deleted file mode 100644 index 35daa4d895..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunction.ts +++ /dev/null @@ -1,3 +0,0 @@ -$ ( document ) . ready ( function ( ) { - alert ( 'i am ready' ) ; - } ); \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunctionBaseLine.ts b/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunctionBaseLine.ts deleted file mode 100644 index 838ef68220..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/documentReadyFunctionBaseLine.ts +++ /dev/null @@ -1,3 +0,0 @@ -$(document).ready(function() { - alert('i am ready'); -}); \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/emptyBlock.ts b/src/harness/unittests/services/formatting/testCode/formatting/emptyBlock.ts deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/emptyBlock.ts +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/emptyBlockBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/emptyBlockBaseline.ts deleted file mode 100644 index 6f31cf5a2e..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/emptyBlockBaseline.ts +++ /dev/null @@ -1 +0,0 @@ -{ } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteral.ts b/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteral.ts deleted file mode 100644 index 1feec453d0..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteral.ts +++ /dev/null @@ -1,10 +0,0 @@ - function foo ( x : { } ) { } - -foo ( { } ) ; - - - - interface bar { - x : { } ; - y : ( ) => { } ; - } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteralBaseLine.ts b/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteralBaseLine.ts deleted file mode 100644 index 04f3c0bc9b..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/emptyInterfaceLiteralBaseLine.ts +++ /dev/null @@ -1,10 +0,0 @@ -function foo(x: {}) { } - -foo({}); - - - -interface bar { - x: {}; - y: () => {}; -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctions.ts b/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctions.ts deleted file mode 100644 index ebbf54557f..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctions.ts +++ /dev/null @@ -1,112 +0,0 @@ -// valid - ( ) => 1 ; - ( arg ) => 2 ; - arg => 2 ; - ( arg = 1 ) => 3 ; - ( arg ? ) => 4 ; - ( arg : number ) => 5 ; - ( arg : number = 0 ) => 6 ; - ( arg ? : number ) => 7 ; - ( ... arg : number [ ] ) => 8 ; - ( arg1 , arg2 ) => 12 ; - ( arg1 = 1 , arg2 =3 ) => 13 ; - ( arg1 ? , arg2 ? ) => 14 ; - ( arg1 : number , arg2 : number ) => 15 ; - ( arg1 : number = 0 , arg2 : number = 1 ) => 16 ; - ( arg1 ? : number , arg2 ? : number ) => 17 ; - ( arg1 , ... arg2 : number [ ] ) => 18 ; - ( arg1 , arg2 ? : number ) => 19 ; - -// in paren - ( ( ) => 21 ) ; - ( ( arg ) => 22 ) ; - ( ( arg = 1 ) => 23 ) ; - ( ( arg ? ) => 24 ) ; - ( ( arg : number ) => 25 ) ; - ( ( arg : number = 0 ) => 26 ) ; - ( ( arg ? : number ) => 27 ) ; - ( ( ... arg : number [ ] ) => 28 ) ; - -// in multiple paren - ( ( ( ( ( arg ) => { return 32 ; } ) ) ) ) ; - -// in ternary exression - false ? ( ) => 41 : null ; - false ? ( arg ) => 42 : null ; - false ? ( arg = 1 ) => 43 : null ; - false ? ( arg ? ) => 44 : null ; - false ? ( arg : number ) => 45 : null ; - false ? ( arg ? : number ) => 46 : null ; - false ? ( arg ? : number = 0 ) => 47 : null ; - false ? ( ... arg : number [ ] ) => 48 : null ; - -// in ternary exression within paren - false ? ( ( ) => 51 ) : null ; - false ? ( ( arg ) => 52 ) : null ; - false ? ( ( arg = 1 ) => 53 ) : null ; - false ? ( ( arg ? ) => 54 ) : null ; - false ? ( ( arg : number ) => 55 ) : null ; - false ? ( ( arg ? : number ) => 56 ) : null ; - false ? ( ( arg ? : number = 0 ) => 57 ) : null ; - false ? ( ( ... arg : number [ ] ) => 58 ) : null ; - -// ternary exression's else clause - false ? null : ( ) => 61 ; - false ? null : ( arg ) => 62 ; - false ? null : ( arg = 1 ) => 63 ; - false ? null : ( arg ? ) => 64 ; - false ? null : ( arg : number ) => 65 ; - false ? null : ( arg ? : number ) => 66 ; - false ? null : ( arg ? : number = 0 ) => 67 ; - false ? null : ( ... arg : number [ ] ) => 68 ; - - -// nested ternary expressions - ( a ? ) => { return a ; } ? ( b ? ) => { return b ; } : ( c ? ) => { return c ; } ; - -//multiple levels - ( a ? ) => { return a ; } ? ( b ) => ( c ) => 81 : ( c ) => ( d ) => 82 ; - - -// In Expressions - ( ( arg ) => 90 ) instanceof Function ; - ( ( arg = 1 ) => 91 ) instanceof Function ; - ( ( arg ? ) => 92 ) instanceof Function ; - ( ( arg : number ) => 93 ) instanceof Function ; - ( ( arg : number = 1 ) => 94 ) instanceof Function ; - ( ( arg ? : number ) => 95 ) instanceof Function ; - ( ( ... arg : number [ ] ) => 96 ) instanceof Function ; - -'' + ( arg ) => 100 ; - ( ( arg ) => 0 ) + '' + ( arg ) => 101 ; - ( ( arg = 1 ) => 0 ) + '' + ( arg = 2 ) => 102 ; - ( ( arg ? ) => 0 ) + '' + ( arg ? ) => 103 ; - ( ( arg : number ) => 0 ) + '' + ( arg : number ) => 104 ; - ( ( arg : number = 1 ) => 0 ) + '' + ( arg : number = 2 ) => 105 ; - ( ( arg ? : number = 1 ) => 0 ) + '' + ( arg ? : number = 2 ) => 106 ; - ( ( ... arg : number [ ] ) => 0 ) + '' + ( ... arg : number [ ] ) => 107 ; - ( ( arg1 , arg2 ? ) => 0 ) + '' + ( arg1 , arg2 ? ) => 108 ; - ( ( arg1 , ... arg2 : number [ ] ) => 0 ) + '' + ( arg1 , ... arg2 : number [ ] ) => 108 ; - - -// Function Parameters -function foo ( ... arg : any [ ] ) { } - -foo ( - ( a ) => 110 , - ( ( a ) => 111 ) , - ( a ) => { - return 112 ; - } , - ( a ? ) => 113 , - ( a , b ? ) => 114 , - ( a : number ) => 115 , - ( a : number = 0 ) => 116 , - ( a = 0 ) => 117 , - ( a ? : number = 0 ) => 118 , - ( a ? , b ? : number = 0 ) => 118 , - ( ... a : number [ ] ) => 119 , - ( a , b ? = 0 , ... c : number [ ] ) => 120 , - ( a ) => ( b ) => ( c ) => 121 , - false ? ( a ) => 0 : ( b ) => 122 - ) ; \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctionsBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctionsBaseline.ts deleted file mode 100644 index 7a1ef86f5a..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/fatArrowFunctionsBaseline.ts +++ /dev/null @@ -1,112 +0,0 @@ -// valid -() => 1; -(arg) => 2; -arg => 2; -(arg = 1) => 3; -(arg?) => 4; -(arg: number) => 5; -(arg: number = 0) => 6; -(arg?: number) => 7; -(...arg: number[]) => 8; -(arg1, arg2) => 12; -(arg1 = 1, arg2 = 3) => 13; -(arg1?, arg2?) => 14; -(arg1: number, arg2: number) => 15; -(arg1: number = 0, arg2: number = 1) => 16; -(arg1?: number, arg2?: number) => 17; -(arg1, ...arg2: number[]) => 18; -(arg1, arg2?: number) => 19; - -// in paren -(() => 21); -((arg) => 22); -((arg = 1) => 23); -((arg?) => 24); -((arg: number) => 25); -((arg: number = 0) => 26); -((arg?: number) => 27); -((...arg: number[]) => 28); - -// in multiple paren -(((((arg) => { return 32; })))); - -// in ternary exression -false ? () => 41 : null; -false ? (arg) => 42 : null; -false ? (arg = 1) => 43 : null; -false ? (arg?) => 44 : null; -false ? (arg: number) => 45 : null; -false ? (arg?: number) => 46 : null; -false ? (arg?: number = 0) => 47 : null; -false ? (...arg: number[]) => 48 : null; - -// in ternary exression within paren -false ? (() => 51) : null; -false ? ((arg) => 52) : null; -false ? ((arg = 1) => 53) : null; -false ? ((arg?) => 54) : null; -false ? ((arg: number) => 55) : null; -false ? ((arg?: number) => 56) : null; -false ? ((arg?: number = 0) => 57) : null; -false ? ((...arg: number[]) => 58) : null; - -// ternary exression's else clause -false ? null : () => 61; -false ? null : (arg) => 62; -false ? null : (arg = 1) => 63; -false ? null : (arg?) => 64; -false ? null : (arg: number) => 65; -false ? null : (arg?: number) => 66; -false ? null : (arg?: number = 0) => 67; -false ? null : (...arg: number[]) => 68; - - -// nested ternary expressions -(a?) => { return a; } ? (b?) => { return b; } : (c?) => { return c; }; - -//multiple levels -(a?) => { return a; } ? (b) => (c) => 81 : (c) => (d) => 82; - - -// In Expressions -((arg) => 90) instanceof Function; -((arg = 1) => 91) instanceof Function; -((arg?) => 92) instanceof Function; -((arg: number) => 93) instanceof Function; -((arg: number = 1) => 94) instanceof Function; -((arg?: number) => 95) instanceof Function; -((...arg: number[]) => 96) instanceof Function; - -'' + (arg) => 100; -((arg) => 0) + '' + (arg) => 101; -((arg = 1) => 0) + '' + (arg = 2) => 102; -((arg?) => 0) + '' + (arg?) => 103; -((arg: number) => 0) + '' + (arg: number) => 104; -((arg: number = 1) => 0) + '' + (arg: number = 2) => 105; -((arg?: number = 1) => 0) + '' + (arg?: number = 2) => 106; -((...arg: number[]) => 0) + '' + (...arg: number[]) => 107; -((arg1, arg2?) => 0) + '' + (arg1, arg2?) => 108; -((arg1, ...arg2: number[]) => 0) + '' + (arg1, ...arg2: number[]) => 108; - - -// Function Parameters -function foo(...arg: any[]) { } - -foo( - (a) => 110, - ((a) => 111), - (a) => { - return 112; - }, - (a?) => 113, - (a, b?) => 114, - (a: number) => 115, - (a: number = 0) => 116, - (a = 0) => 117, - (a?: number = 0) => 118, - (a?, b?: number = 0) => 118, - (...a: number[]) => 119, - (a, b? = 0, ...c: number[]) => 120, - (a) => (b) => (c) => 121, - false ? (a) => 0 : (b) => 122 - ); \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatement.ts b/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatement.ts deleted file mode 100644 index 314cd416a8..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatement.ts +++ /dev/null @@ -1,2 +0,0 @@ -if(false){debugger;} - if ( false ) { debugger ; } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatementBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatementBaseline.ts deleted file mode 100644 index c03acf91ec..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/formatDebuggerStatementBaseline.ts +++ /dev/null @@ -1,2 +0,0 @@ -if (false) { debugger; } -if (false) { debugger; } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationList.ts b/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationList.ts deleted file mode 100644 index 956309d2c4..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationList.ts +++ /dev/null @@ -1,13 +0,0 @@ -var fun1 = function ( ) { - var x = 'foo' , - z = 'bar' ; - return x ; -}, - -fun2 = ( function ( f ) { - var fun = function ( ) { - console . log ( f ( ) ) ; - }, - x = 'Foo' ; - return fun ; -} ( fun1 ) ) ; diff --git a/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationListBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationListBaseline.ts deleted file mode 100644 index f1d32283fd..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/formatvariableDeclarationListBaseline.ts +++ /dev/null @@ -1,13 +0,0 @@ -var fun1 = function() { - var x = 'foo', - z = 'bar'; - return x; -}, - -fun2 = (function(f) { - var fun = function() { - console.log(f()); - }, - x = 'Foo'; - return fun; -} (fun1)); diff --git a/src/harness/unittests/services/formatting/testCode/formatting/implicitModule.ts b/src/harness/unittests/services/formatting/testCode/formatting/implicitModule.ts deleted file mode 100644 index 352a252593..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/implicitModule.ts +++ /dev/null @@ -1,3 +0,0 @@ - export class A { - - } diff --git a/src/harness/unittests/services/formatting/testCode/formatting/implicitModuleBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/implicitModuleBaseline.ts deleted file mode 100644 index df93540466..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/implicitModuleBaseline.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class A { - -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/importDeclaration.ts b/src/harness/unittests/services/formatting/testCode/formatting/importDeclaration.ts deleted file mode 100644 index afd010fe8b..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/importDeclaration.ts +++ /dev/null @@ -1,6 +0,0 @@ -module Foo { -} - -import bar = Foo; - -import bar2=Foo; diff --git a/src/harness/unittests/services/formatting/testCode/formatting/importDeclarationBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/importDeclarationBaseline.ts deleted file mode 100644 index d0a4e190d9..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/importDeclarationBaseline.ts +++ /dev/null @@ -1,6 +0,0 @@ -module Foo { -} - -import bar = Foo; - -import bar2 = Foo; diff --git a/src/harness/unittests/services/formatting/testCode/formatting/main.ts b/src/harness/unittests/services/formatting/testCode/formatting/main.ts deleted file mode 100644 index 7640013af8..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/main.ts +++ /dev/null @@ -1,95 +0,0 @@ - -var a;var c , b;var $d -var $e -var f -a++;b++; - -function f ( ) { - for (i = 0; i < 10; i++) { - k = abc + 123 ^ d; - a = XYZ[m (a[b[c][d]])]; - break; - - switch ( variable){ - case 1: abc += 425; -break; -case 404 : a [x--/2]%=3 ; - break ; - case vari : v[--x ] *=++y*( m + n / k[z]); - for (a in b){ - for (a = 0; a < 10; ++a) { - a++;--a; - if (a == b) { - a++;b--; - } -else -if (a == c){ -++a; -(--c)+=d; -$c = $a + --$b; -} -if (a == b) -if (a != b) { - if (a !== b) - if (a === b) - --a; - else - --a; - else { - a--;++b; -a++ - } - } - } - for (x in y) { -m-=m; -k=1+2+3+4; -} -} - break; - - } - } - var a ={b:function(){}}; - return {a:1,b:2} -} - -var z = 1; - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) -for (k = 0; k < 10; ++k) { -z++; -} - -for (k = 0; k < 10; k += 2) { -z++; -} - - $(document).ready (); - - - function pageLoad() { - $('#TextBox1' ) . unbind ( ) ; -$('#TextBox1' ) . datepicker ( ) ; -} - - function pageLoad ( ) { - var webclass=[ - { 'student' : - { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' } - } , -{ 'student': -{'id':'2','name':'Adam Davidson','legacySkill':'Cobol,MainFrame'} -} , - { 'student': -{ 'id':'3','name':'Charles Boyer' ,'legacySkill':'HTML, XML'} -} - ]; - -$create(Sys.UI.DataView,{data:webclass},null,null,$get('SList')); - -} - -$( document ).ready(function(){ -alert('hello'); - } ) ; diff --git a/src/harness/unittests/services/formatting/testCode/formatting/mainBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/mainBaseline.ts deleted file mode 100644 index 30756f547c..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/mainBaseline.ts +++ /dev/null @@ -1,98 +0,0 @@ - -var a; var c, b; var $d -var $e -var f -a++; b++; - -function f() { - for (i = 0; i < 10; i++) { - k = abc + 123 ^ d; - a = XYZ[m(a[b[c][d]])]; - break; - - switch (variable) { - case 1: abc += 425; - break; - case 404: a[x-- / 2] %= 3; - break; - case vari: v[--x] *= ++y * (m + n / k[z]); - for (a in b) { - for (a = 0; a < 10; ++a) { - a++; --a; - if (a == b) { - a++; b--; - } - else - if (a == c) { - ++a; - (--c) += d; - $c = $a + --$b; - } - if (a == b) - if (a != b) { - if (a !== b) - if (a === b) - --a; - else - --a; - else { - a--; ++b; - a++ - } - } - } - for (x in y) { - m -= m; - k = 1 + 2 + 3 + 4; - } - } - break; - - } - } - var a = { b: function() { } }; - return { a: 1, b: 2 } -} - -var z = 1; -for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) - for (k = 0; k < 10; ++k) { - z++; - } - -for (k = 0; k < 10; k += 2) { - z++; -} - -$(document).ready(); - - -function pageLoad() { - $('#TextBox1').unbind(); - $('#TextBox1').datepicker(); -} - -function pageLoad() { - var webclass = [ - { - 'student': - { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' } - }, -{ - 'student': - { 'id': '2', 'name': 'Adam Davidson', 'legacySkill': 'Cobol,MainFrame' } -}, - { - 'student': - { 'id': '3', 'name': 'Charles Boyer', 'legacySkill': 'HTML, XML' } - } - ]; - - $create(Sys.UI.DataView, { data: webclass }, null, null, $get('SList')); - -} - -$(document).ready(function() { - alert('hello'); -}); diff --git a/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentation.ts b/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentation.ts deleted file mode 100644 index 3030a36630..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentation.ts +++ /dev/null @@ -1,3 +0,0 @@ - module Foo { - export module A . B . C { } - } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentationBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentationBaseline.ts deleted file mode 100644 index 0013b367dc..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/moduleIndentationBaseline.ts +++ /dev/null @@ -1,3 +0,0 @@ -module Foo { - export module A.B.C { } -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/modules.ts b/src/harness/unittests/services/formatting/testCode/formatting/modules.ts deleted file mode 100644 index 5ce0d19b63..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/modules.ts +++ /dev/null @@ -1,76 +0,0 @@ - module mod1 { - export class b { - } - class d { - } - - - export interface ib { - } -} - - module m2 { - - export module m3 { - export class c extends mod1.b { - } - export class ib2 implements mod1.ib { - } - } -} - - class c extends mod1.b { -} - - class ib2 implements mod1.ib { -} - - declare export module "m4" { - export class d { - } ; - var x : d ; - export function foo ( ) : d ; -} - - import m4 = module ( "m4" ) ; - export var x4 = m4.x ; - export var d4 = m4.d ; - export var f4 = m4.foo ( ) ; - - export module m1 { - declare export module "m2" { - export class d { - } ; - var x: d ; - export function foo ( ) : d ; - } - import m2 = module ( "m2" ) ; - import m3 = module ( "m4" ) ; - - export var x2 = m2.x ; - export var d2 = m2.d ; - export var f2 = m2.foo ( ) ; - - export var x3 = m3.x ; - export var d3 = m3.d ; - export var f3 = m3.foo ( ) ; -} - - export var x2 = m1.m2.x ; - export var d2 = m1.m2.d ; - export var f2 = m1.m2.foo ( ) ; - - export var x3 = m1.m3.x ; - export var d3 = m1.m3.d ; - export var f3 = m1.m3.foo ( ) ; - - export module m5 { - export var x2 = m1.m2.x ; - export var d2 = m1.m2.d ; - export var f2 = m1.m2.foo ( ) ; - - export var x3 = m1.m3.x ; - export var d3 = m1.m3.d ; - export var f3 = m1.m3.foo ( ) ; -} - diff --git a/src/harness/unittests/services/formatting/testCode/formatting/modulesBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/modulesBaseline.ts deleted file mode 100644 index e6f62024fe..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/modulesBaseline.ts +++ /dev/null @@ -1,76 +0,0 @@ -module mod1 { - export class b { - } - class d { - } - - - export interface ib { - } -} - -module m2 { - - export module m3 { - export class c extends mod1.b { - } - export class ib2 implements mod1.ib { - } - } -} - -class c extends mod1.b { -} - -class ib2 implements mod1.ib { -} - -declare export module "m4" { - export class d { - }; - var x: d; - export function foo(): d; -} - -import m4 = module("m4"); -export var x4 = m4.x; -export var d4 = m4.d; -export var f4 = m4.foo(); - -export module m1 { - declare export module "m2" { - export class d { - }; - var x: d; - export function foo(): d; - } - import m2 = module("m2"); - import m3 = module("m4"); - - export var x2 = m2.x; - export var d2 = m2.d; - export var f2 = m2.foo(); - - export var x3 = m3.x; - export var d3 = m3.d; - export var f3 = m3.foo(); -} - -export var x2 = m1.m2.x; -export var d2 = m1.m2.d; -export var f2 = m1.m2.foo(); - -export var x3 = m1.m3.x; -export var d3 = m1.m3.d; -export var f3 = m1.m3.foo(); - -export module m5 { - export var x2 = m1.m2.x; - export var d2 = m1.m2.d; - export var f2 = m1.m2.foo(); - - export var x3 = m1.m3.x; - export var d3 = m1.m3.d; - export var f3 = m1.m3.foo(); -} - diff --git a/src/harness/unittests/services/formatting/testCode/formatting/objectLiteral.ts b/src/harness/unittests/services/formatting/testCode/formatting/objectLiteral.ts deleted file mode 100644 index dbecc4d4fe..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/objectLiteral.ts +++ /dev/null @@ -1,27 +0,0 @@ -var x = {foo: 1, -bar: "tt", -boo: 1 + 5}; - -var x2 = {foo: 1, -bar: "tt",boo:1+5}; - -function Foo() { -var typeICalc = { -clear: { -"()": [1, 2, 3] -} -} -} - -// Rule for object literal members for the "value" of the memebr to follow the indent -// of the member, i.e. the relative position of the value is maintained when the member -// is indented. -var x2 = { - foo: -3, - 'bar': - { a: 1, b : 2} -}; - -var x={ }; -var y = {}; \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/objectLiteralBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/objectLiteralBaseline.ts deleted file mode 100644 index 3a7fa63d92..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/objectLiteralBaseline.ts +++ /dev/null @@ -1,31 +0,0 @@ -var x = { - foo: 1, - bar: "tt", - boo: 1 + 5 -}; - -var x2 = { - foo: 1, - bar: "tt", boo: 1 + 5 -}; - -function Foo() { - var typeICalc = { - clear: { - "()": [1, 2, 3] - } - } -} - -// Rule for object literal members for the "value" of the memebr to follow the indent -// of the member, i.e. the relative position of the value is maintained when the member -// is indented. -var x2 = { - foo: - 3, - 'bar': - { a: 1, b: 2 } -}; - -var x = {}; -var y = {}; \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracket.ts b/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracket.ts deleted file mode 100644 index 0161f04308..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracket.ts +++ /dev/null @@ -1,32 +0,0 @@ -function f( ) { -var x = 3; - var z = 2 ; - a = z ++ - 2 * x ; - for ( ; ; ) { - a+=(g +g)*a%t; - b -- ; -} - - switch ( a ) - { - case 1 : { - a ++ ; - b--; - if(a===a) - return; - else - { - for(a in b) - if(a!=a) - { - for(a in b) - { -a++; - } - } - } - } - default: - break; - } -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracketBaseLine.ts b/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracketBaseLine.ts deleted file mode 100644 index 051a4ebd13..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/onClosingBracketBaseLine.ts +++ /dev/null @@ -1,28 +0,0 @@ -function f() { - var x = 3; - var z = 2; - a = z++ - 2 * x; - for (; ;) { - a += (g + g) * a % t; - b--; - } - - switch (a) { - case 1: { - a++; - b--; - if (a === a) - return; - else { - for (a in b) - if (a != a) { - for (a in b) { - a++; - } - } - } - } - default: - break; - } -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/onSemiColon.ts b/src/harness/unittests/services/formatting/testCode/formatting/onSemiColon.ts deleted file mode 100644 index 3b5b5456a6..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/onSemiColon.ts +++ /dev/null @@ -1 +0,0 @@ -var a=b+c^d-e*++f; \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/onSemiColonBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/onSemiColonBaseline.ts deleted file mode 100644 index 2ba96e4f88..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/onSemiColonBaseline.ts +++ /dev/null @@ -1 +0,0 @@ -var a = b + c ^ d - e * ++f; \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructor.ts b/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructor.ts deleted file mode 100644 index 7d98d5a8f4..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructor.ts +++ /dev/null @@ -1 +0,0 @@ -class test { constructor () { } } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructorBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructorBaseline.ts deleted file mode 100644 index bc124d41ba..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/spaceAfterConstructorBaseline.ts +++ /dev/null @@ -1 +0,0 @@ -class test { constructor() { } } \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurly.ts b/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurly.ts deleted file mode 100644 index ec093e0e37..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurly.ts +++ /dev/null @@ -1,10 +0,0 @@ -module Tools { - export enum NodeType { - Error, - Comment, - } - export enum foob - { - Blah=1, Bleah=2 - } -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurlyBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurlyBaseline.ts deleted file mode 100644 index d0a3db2d51..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/tabAfterCloseCurlyBaseline.ts +++ /dev/null @@ -1,9 +0,0 @@ -module Tools { - export enum NodeType { - Error, - Comment, - } - export enum foob { - Blah = 1, Bleah = 2 - } -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructs.ts b/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructs.ts deleted file mode 100644 index 43ef3710ef..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructs.ts +++ /dev/null @@ -1,65 +0,0 @@ - module MyModule - { - module A.B.C { -module F { -} - } -interface Blah -{ -boo: string; -} - - class Foo - { - -} - -class Foo2 { -public foo():number { -return 5 * 6; -} -public foo2() { -if (1 === 2) - - -{ -var y : number= 76; -return y; -} - - while (2 == 3) { - if ( y == null ) { - -} - } -} - -public foo3() { -if (1 === 2) - -//comment preventing line merging -{ -var y = 76; -return y; -} - -} - } - } - -function foo(a:number, b:number):number -{ -return 0; -} - -function bar(a:number, b:number) :number[] { -return []; -} - -module BugFix3 { -declare var f: { - (): any; - (x: number): string; - foo: number; -}; -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructsBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructsBaseline.ts deleted file mode 100644 index 929334e473..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/typescriptConstructsBaseline.ts +++ /dev/null @@ -1,58 +0,0 @@ -module MyModule { - module A.B.C { - module F { - } - } - interface Blah { - boo: string; - } - - class Foo { - - } - - class Foo2 { - public foo(): number { - return 5 * 6; - } - public foo2() { - if (1 === 2) { - var y: number = 76; - return y; - } - - while (2 == 3) { - if (y == null) { - - } - } - } - - public foo3() { - if (1 === 2) - - //comment preventing line merging - { - var y = 76; - return y; - } - - } - } -} - -function foo(a: number, b: number): number { - return 0; -} - -function bar(a: number, b: number): number[] { - return []; -} - -module BugFix3 { - declare var f: { - (): any; - (x: number): string; - foo: number; - }; -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/various.ts b/src/harness/unittests/services/formatting/testCode/formatting/various.ts deleted file mode 100644 index bd814c2348..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/various.ts +++ /dev/null @@ -1,17 +0,0 @@ -function f(a,b,c,d){ -for(var i=0;i<10;i++){ -var a=0; -var b=a+a+a*a%a/2-1; -b+=a; -++b; -f(a,b,c,d); -if(1===1){ -var m=function(e,f){ -return e^f; -} -} -} -} - -for (var i = 0 ; i < this.foo(); i++) { -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/variousBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/variousBaseline.ts deleted file mode 100644 index a4b5ceeb1c..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/variousBaseline.ts +++ /dev/null @@ -1,17 +0,0 @@ -function f(a, b, c, d) { - for (var i = 0; i < 10; i++) { - var a = 0; - var b = a + a + a * a % a / 2 - 1; - b += a; - ++b; - f(a, b, c, d); - if (1 === 1) { - var m = function(e, f) { - return e ^ f; - } - } - } -} - -for (var i = 0 ; i < this.foo(); i++) { -} \ No newline at end of file diff --git a/src/harness/unittests/services/formatting/testCode/formatting/withStatement.ts b/src/harness/unittests/services/formatting/testCode/formatting/withStatement.ts deleted file mode 100644 index 66ec4bf546..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/withStatement.ts +++ /dev/null @@ -1,9 +0,0 @@ -with (foo.bar) - - { - - } - -with (bar.blah) -{ -} diff --git a/src/harness/unittests/services/formatting/testCode/formatting/withStatementBaseline.ts b/src/harness/unittests/services/formatting/testCode/formatting/withStatementBaseline.ts deleted file mode 100644 index f81378d7f8..0000000000 --- a/src/harness/unittests/services/formatting/testCode/formatting/withStatementBaseline.ts +++ /dev/null @@ -1,6 +0,0 @@ -with (foo.bar) { - -} - -with (bar.blah) { -} diff --git a/src/harness/unittests/textChanges.ts b/src/harness/unittests/textChanges.ts index 8269b6de6b..3625b30a00 100644 --- a/src/harness/unittests/textChanges.ts +++ b/src/harness/unittests/textChanges.ts @@ -2,6 +2,9 @@ /// /// +// Some tests have trailing whitespace +// tslint:disable trim-trailing-whitespace + namespace ts { describe("textChanges", () => { function findChild(name: string, n: Node) { @@ -572,7 +575,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter10", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(createIdentifier("b"), createIdentifier("a"))); - }) + }); } { const text = ` @@ -581,7 +584,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter11", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(createIdentifier("b"), createIdentifier("a"))); - }) + }); } { const text = ` @@ -590,7 +593,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter12", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(undefined, createIdentifier("a"))); - }) + }); } { const text = ` @@ -599,7 +602,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter13", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(undefined, createIdentifier("a"))); - }) + }); } { const text = ` @@ -609,7 +612,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter14", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(createIdentifier("b"), createIdentifier("a"))); - }) + }); } { const text = ` @@ -619,7 +622,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter15", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(createIdentifier("b"), createIdentifier("a"))); - }) + }); } { const text = ` @@ -629,7 +632,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter16", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(undefined, createIdentifier("a"))); - }) + }); } { const text = ` @@ -639,7 +642,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter17", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(undefined, createIdentifier("a"))); - }) + }); } { const text = ` @@ -648,7 +651,7 @@ import { } from "bar"`; runSingleFileTest("insertNodeInListAfter18", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { changeTracker.insertNodeInListAfter(sourceFile, findChild("x", sourceFile), createImportSpecifier(undefined, createIdentifier("a"))); - }) + }); } { const text = ` @@ -656,7 +659,7 @@ class A { x; }`; runSingleFileTest("insertNodeAfterMultipleNodes", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { - let newNodes = []; + const newNodes = []; for (let i = 0; i < 11 /*error doesn't occur with fewer nodes*/; ++i) { newNodes.push( createProperty(undefined, undefined, i + "", undefined, undefined, undefined)); @@ -714,7 +717,7 @@ class A { class A { x = foo } -` +`; runSingleFileTest("insertNodeInClassAfterNodeWithoutSeparator1", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { const newNode = createProperty( /*decorators*/ undefined, @@ -732,7 +735,7 @@ class A { x() { } } -` +`; runSingleFileTest("insertNodeInClassAfterNodeWithoutSeparator2", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { const newNode = createProperty( /*decorators*/ undefined, @@ -749,7 +752,7 @@ class A { interface A { x } -` +`; runSingleFileTest("insertNodeInInterfaceAfterNodeWithoutSeparator1", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { const newNode = createProperty( /*decorators*/ undefined, @@ -766,7 +769,7 @@ interface A { interface A { x() } -` +`; runSingleFileTest("insertNodeInInterfaceAfterNodeWithoutSeparator2", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { const newNode = createProperty( /*decorators*/ undefined, @@ -781,7 +784,7 @@ interface A { { const text = ` let x = foo -` +`; runSingleFileTest("insertNodeInStatementListAfterNodeWithoutSeparator1", noop, text, /*validateNodes*/ false, (sourceFile, changeTracker) => { const newNode = createStatement(createParen(createLiteral(1))); changeTracker.insertNodeAfter(sourceFile, findVariableStatementContaining("x", sourceFile), newNode, { suffix: newLineCharacter }); diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 5d4bb9ce6e..348e52246a 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -1396,6 +1396,7 @@ interface AudioNode extends EventTarget { readonly numberOfInputs: number; readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): AudioNode; + connect(destination: AudioParam, output?: number): void; disconnect(output?: number): void; disconnect(destination: AudioNode, output?: number, input?: number): void; disconnect(destination: AudioParam, output?: number): void; @@ -2152,7 +2153,9 @@ interface CanvasRenderingContext2D extends Object, CanvasPathMethods { createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; drawFocusIfNeeded(element: Element): void; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number, dstW: number, dstH: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number): void; fill(fillRule?: string): void; fillRect(x: number, y: number, w: number, h: number): void; fillText(text: string, x: number, y: number, maxWidth?: number): void; @@ -2449,10 +2452,10 @@ declare var DOMException: { } interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document; createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; createHTMLDocument(title: string): Document; - hasFeature(): boolean; + hasFeature(feature: string | null, version: string | null): boolean; } declare var DOMImplementation: { @@ -3449,6 +3452,7 @@ declare var Document: { } interface DocumentFragment extends Node, NodeSelector, ParentNode { + getElementById(elementId: string): HTMLElement | null; } declare var DocumentFragment: { @@ -11837,7 +11841,7 @@ interface URL { protocol: string; search: string; username: string; - readonly searchparams: URLSearchParams; + readonly searchParams: URLSearchParams; toString(): string; } @@ -12161,12 +12165,12 @@ interface WebGLRenderingContext { stencilMaskSeparate(face: number, mask: number): void; stencilOp(fail: number, zfail: number, zpass: number): void; stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; texParameterf(target: number, pname: number, param: number): void; texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; uniform1f(location: WebGLUniformLocation | null, x: number): void; uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform1i(location: WebGLUniformLocation | null, x: number): void; @@ -13260,6 +13264,8 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; webkitRequestAnimationFrame(callback: FrameRequestCallback): number; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; scroll(options?: ScrollToOptions): void; scrollTo(options?: ScrollToOptions): void; scrollBy(options?: ScrollToOptions): void; @@ -13473,6 +13479,7 @@ interface Body { blob(): Promise; json(): Promise; text(): Promise; + formData(): Promise; } interface CanvasPathMethods { @@ -13835,6 +13842,21 @@ interface Canvas2DContextAttributes { [attribute: string]: boolean | string | undefined; } +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + interface URLSearchParams { /** * Appends a specified key/value pair as a new search parameter. @@ -13879,6 +13901,7 @@ interface NodeListOf extends NodeList { interface HTMLCollectionOf extends HTMLCollection { item(index: number): T; namedItem(name: string): T; + [index: number]: T; } interface BlobPropertyBag { @@ -14840,6 +14863,8 @@ declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare function scroll(options?: ScrollToOptions): void; declare function scrollTo(options?: ScrollToOptions): void; declare function scrollBy(options?: ScrollToOptions): void; diff --git a/src/lib/dom.iterable.d.ts b/src/lib/dom.iterable.d.ts index e4da7a6276..9a04b723ac 100644 --- a/src/lib/dom.iterable.d.ts +++ b/src/lib/dom.iterable.d.ts @@ -5,9 +5,7 @@ interface DOMTokenList { } interface NodeList { - - - /** + /** * Returns an array of key, value pairs for every entry in the list */ entries(): IterableIterator<[number, Node]>; @@ -17,23 +15,23 @@ interface NodeList { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: Node, index: number, listObj: NodeList) => void, thisArg?: any): void; - /** + /** * Returns an list of keys in the list */ keys(): IterableIterator; - /** + /** * Returns an list of values in the list */ values(): IterableIterator; - - [Symbol.iterator](): IterableIterator + + [Symbol.iterator](): IterableIterator; } interface NodeListOf { - /** + /** * Returns an array of key, value pairs for every entry in the list */ entries(): IterableIterator<[number, TNode]>; @@ -44,14 +42,14 @@ interface NodeListOf { * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: TNode, index: number, listObj: NodeListOf) => void, thisArg?: any): void; - /** + /** * Returns an list of keys in the list */ keys(): IterableIterator; - /** + /** * Returns an list of values in the list */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; } diff --git a/src/lib/es2015.collection.d.ts b/src/lib/es2015.collection.d.ts index 5b90333f1d..b2255dab88 100644 --- a/src/lib/es2015.collection.d.ts +++ b/src/lib/es2015.collection.d.ts @@ -17,7 +17,7 @@ declare var Map: MapConstructor; interface ReadonlyMap { forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; - get(key: K): V|undefined; + get(key: K): V | undefined; has(key: K): boolean; readonly size: number; } diff --git a/src/lib/es2015.core.d.ts b/src/lib/es2015.core.d.ts index 88f70758e5..2e56221fe9 100644 --- a/src/lib/es2015.core.d.ts +++ b/src/lib/es2015.core.d.ts @@ -268,7 +268,7 @@ interface Object { * Determines whether an object has a property with the specified name. * @param v A property name. */ - hasOwnProperty(v: PropertyKey): boolean + hasOwnProperty(v: PropertyKey): boolean; /** * Determines whether a specified property is enumerable. @@ -486,10 +486,10 @@ interface String { bold(): string; /** Returns a HTML element */ - fixed(): string + fixed(): string; /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string + fontcolor(color: string): string; /** Returns a HTML element and sets the size attribute value */ fontsize(size: number): string; diff --git a/src/lib/es2015.iterable.d.ts b/src/lib/es2015.iterable.d.ts index fe56c6e8bf..73f0d45cda 100644 --- a/src/lib/es2015.iterable.d.ts +++ b/src/lib/es2015.iterable.d.ts @@ -91,7 +91,7 @@ interface IArguments { } interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; + [Symbol.iterator](): IterableIterator<[K, V]>; entries(): IterableIterator<[K, V]>; keys(): IterableIterator; values(): IterableIterator; diff --git a/src/lib/es2015.proxy.d.ts b/src/lib/es2015.proxy.d.ts index efccfd47cc..89f9ebf55c 100644 --- a/src/lib/es2015.proxy.d.ts +++ b/src/lib/es2015.proxy.d.ts @@ -12,11 +12,11 @@ interface ProxyHandler { enumerate? (target: T): PropertyKey[]; ownKeys? (target: T): PropertyKey[]; apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): object + construct? (target: T, argArray: any, newTarget?: any): object; } interface ProxyConstructor { revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T + new (target: T, handler: ProxyHandler): T; } declare var Proxy: ProxyConstructor; diff --git a/src/lib/es2015.symbol.d.ts b/src/lib/es2015.symbol.d.ts index d7ea4fa032..44a5f17d74 100644 --- a/src/lib/es2015.symbol.d.ts +++ b/src/lib/es2015.symbol.d.ts @@ -7,8 +7,8 @@ interface Symbol { } interface SymbolConstructor { - /** - * A reference to the prototype. + /** + * A reference to the prototype. */ readonly prototype: Symbol; @@ -16,17 +16,17 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): symbol; + (description?: string | number): symbol; /** - * Returns a Symbol object from the global symbol registry matching the given key if found. + * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ for(key: string): symbol; /** - * Returns a key from the global symbol registry matching the given Symbol if found. + * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ diff --git a/src/lib/es2015.symbol.wellknown.d.ts b/src/lib/es2015.symbol.wellknown.d.ts index 7177b78e48..71e4cb7c89 100644 --- a/src/lib/es2015.symbol.wellknown.d.ts +++ b/src/lib/es2015.symbol.wellknown.d.ts @@ -1,55 +1,55 @@ /// interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. */ readonly hasInstance: symbol; - /** + /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ readonly isConcatSpreadable: symbol; /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. */ readonly match: symbol; - /** - * A regular expression method that replaces matched substrings of a string. Called by the + /** + * A regular expression method that replaces matched substrings of a string. Called by the * String.prototype.replace method. */ readonly replace: symbol; /** - * A regular expression method that returns the index within a string that matches the + * A regular expression method that returns the index within a string that matches the * regular expression. Called by the String.prototype.search method. */ readonly search: symbol; - /** - * A function valued property that is the constructor function that is used to create + /** + * A function valued property that is the constructor function that is used to create * derived objects. */ readonly species: symbol; /** - * A regular expression method that splits a string at the indices that match the regular + * A regular expression method that splits a string at the indices that match the regular * expression. Called by the String.prototype.split method. */ readonly split: symbol; - /** + /** * A method that converts an object to a corresponding primitive value. * Called by the ToPrimitive abstract operation. */ readonly toPrimitive: symbol; - /** + /** * A String value that is used in the creation of the default string description of an object. * Called by the built-in method Object.prototype.toString. */ @@ -165,7 +165,7 @@ interface RegExp { * Replaces text in a string, using this regular expression. * @param string A String object or string literal whose contents matching against * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every + * @param replaceValue A String object or string literal containing the text to replace for every * successful match of this regular expression. */ [Symbol.replace](string: string, replaceValue: string): string; @@ -241,10 +241,10 @@ interface String { } /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { readonly [Symbol.toStringTag]: "ArrayBuffer"; @@ -255,7 +255,7 @@ interface DataView { } /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { @@ -263,7 +263,7 @@ interface Int8Array { } /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { @@ -271,7 +271,7 @@ interface Uint8Array { } /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { @@ -279,7 +279,7 @@ interface Uint8ClampedArray { } /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { @@ -287,7 +287,7 @@ interface Int16Array { } /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { @@ -295,7 +295,7 @@ interface Uint16Array { } /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { @@ -303,7 +303,7 @@ interface Int32Array { } /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { @@ -319,7 +319,7 @@ interface Float32Array { } /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { diff --git a/src/lib/es2017.sharedmemory.d.ts b/src/lib/es2017.sharedmemory.d.ts index 440b74ff01..d9f986627c 100644 --- a/src/lib/es2017.sharedmemory.d.ts +++ b/src/lib/es2017.sharedmemory.d.ts @@ -13,8 +13,8 @@ interface SharedArrayBuffer { length: number; /** * Returns a section of an SharedArrayBuffer. - */ - slice(begin:number, end?:number): SharedArrayBuffer; + */ + slice(begin: number, end?: number): SharedArrayBuffer; readonly [Symbol.species]: SharedArrayBuffer; readonly [Symbol.toStringTag]: "SharedArrayBuffer"; } diff --git a/src/lib/es2017.string.d.ts b/src/lib/es2017.string.d.ts index 51f8e410ec..3a440f887e 100644 --- a/src/lib/es2017.string.d.ts +++ b/src/lib/es2017.string.d.ts @@ -1,27 +1,27 @@ -interface String { - /** - * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. - * The padding is applied from the start (left) of the current string. - * - * @param maxLength The length of the resulting string once the current string has been padded. - * If this parameter is smaller than the current string's length, the current string will be returned as it is. - * - * @param fillString The string to pad the current string with. - * If this string is too long, it will be truncated and the left-most part will be applied. - * The default value for this parameter is " " (U+0020). - */ - padStart(maxLength: number, fillString?: string): string; - - /** - * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. - * The padding is applied from the end (right) of the current string. - * - * @param maxLength The length of the resulting string once the current string has been padded. - * If this parameter is smaller than the current string's length, the current string will be returned as it is. - * - * @param fillString The string to pad the current string with. - * If this string is too long, it will be truncated and the left-most part will be applied. - * The default value for this parameter is " " (U+0020). - */ - padEnd(maxLength: number, fillString?: string): string; -} +interface String { + /** + * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. + * The padding is applied from the start (left) of the current string. + * + * @param maxLength The length of the resulting string once the current string has been padded. + * If this parameter is smaller than the current string's length, the current string will be returned as it is. + * + * @param fillString The string to pad the current string with. + * If this string is too long, it will be truncated and the left-most part will be applied. + * The default value for this parameter is " " (U+0020). + */ + padStart(maxLength: number, fillString?: string): string; + + /** + * Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. + * The padding is applied from the end (right) of the current string. + * + * @param maxLength The length of the resulting string once the current string has been padded. + * If this parameter is smaller than the current string's length, the current string will be returned as it is. + * + * @param fillString The string to pad the current string with. + * If this string is too long, it will be truncated and the left-most part will be applied. + * The default value for this parameter is " " (U+0020). + */ + padEnd(maxLength: number, fillString?: string): string; +} diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7d3a2179a3..b92d335457 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -490,7 +490,7 @@ interface NumberConstructor { declare const Number: NumberConstructor; interface TemplateStringsArray extends ReadonlyArray { - readonly raw: ReadonlyArray + readonly raw: ReadonlyArray; } interface Math { @@ -1354,14 +1354,14 @@ type Readonly = { */ type Pick = { [P in K]: T[P]; -} +}; /** * Construct a type with a set of properties K of type T */ type Record = { [P in K]: T; -} +}; /** * Marker for contextual 'this' type @@ -1383,7 +1383,7 @@ interface ArrayBuffer { /** * Returns a section of an ArrayBuffer. */ - slice(begin:number, end?:number): ArrayBuffer; + slice(begin: number, end?: number): ArrayBuffer; } interface ArrayBufferConstructor { @@ -4169,7 +4169,7 @@ declare const Float64Array: Float64ArrayConstructor; /// ECMAScript Internationalization API ///////////////////////////// -declare module Intl { +declare namespace Intl { interface CollatorOptions { usage?: string; localeMatcher?: string; @@ -4197,7 +4197,7 @@ declare module Intl { new (locales?: string | string[], options?: CollatorOptions): Collator; (locales?: string | string[], options?: CollatorOptions): Collator; supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } + }; interface NumberFormatOptions { localeMatcher?: string; @@ -4234,7 +4234,7 @@ declare module Intl { new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } + }; interface DateTimeFormatOptions { localeMatcher?: string; @@ -4277,7 +4277,7 @@ declare module Intl { new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; - } + }; } interface String { diff --git a/src/lib/scripthost.d.ts b/src/lib/scripthost.d.ts index b163a7e515..8f10c631ec 100644 --- a/src/lib/scripthost.d.ts +++ b/src/lib/scripthost.d.ts @@ -29,7 +29,7 @@ interface TextStreamBase { /** * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If + * It is not necessary to close standard streams; they close automatically when the process ends. If * you close a standard stream, be aware that any other pointers to that standard stream become invalid. */ Close(): void; diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index e9563db1bc..326a3a9546 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -1407,6 +1407,8 @@ interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, Glo readonly performance: Performance; readonly self: WorkerGlobalScope; msWriteProfilerMark(profilerMarkName: string): void; + createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -1467,6 +1469,21 @@ interface ErrorEventInit { error?: any; } +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -1697,6 +1714,8 @@ declare var onerror: (this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any; declare var performance: Performance; declare var self: WorkerGlobalScope; declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare function dispatchEvent(evt: Event): boolean; declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; diff --git a/src/lib/webworker.importscripts.d.ts b/src/lib/webworker.importscripts.d.ts index f48f75ee87..1c4c4f4e95 100644 --- a/src/lib/webworker.importscripts.d.ts +++ b/src/lib/webworker.importscripts.d.ts @@ -1,6 +1,6 @@ ///////////////////////////// -/// WorkerGlobalScope APIs +/// WorkerGlobalScope APIs ///////////////////////////// -// These are only available in a Web Worker +// These are only available in a Web Worker declare function importScripts(...urls: string[]): void; diff --git a/src/server/builder.ts b/src/server/builder.ts index e056f0ae8c..108c0a0c64 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -1,4 +1,4 @@ -/// +/// /// /// diff --git a/src/server/client.ts b/src/server/client.ts index 8e81a42383..ce7cef12c1 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -33,7 +33,7 @@ namespace ts.server { } export class SessionClient implements LanguageService { - private sequence: number = 0; + private sequence = 0; private lineMaps: ts.Map = ts.createMap(); private messages: string[] = []; private lastRenameEntry: RenameEntry; diff --git a/src/server/server.ts b/src/server/server.ts index bfd4e42204..4e443add77 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -135,7 +135,7 @@ namespace ts.server { try { this.fd = fs.openSync(this.logFilename, "w"); } - catch(_) { + catch (_) { // swallow the error and keep logging disabled if file cannot be opened } } @@ -315,7 +315,7 @@ namespace ts.server { } const body: protocol.TypesInstallerInitializationFailedEventBody = { message: response.message - } + }; const eventName: protocol.TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; this.eventSender.event(body, eventName); return; @@ -473,14 +473,14 @@ namespace ts.server { const cmdLineVerbosity = getLogLevel(findArgument("--logVerbosity")); const envLogOptions = parseLoggingEnvironmentString(process.env["TSS_LOG"]); - const logFileName = cmdLineLogFileName - ? stripQuotes(cmdLineLogFileName) + const logFileName = cmdLineLogFileName + ? stripQuotes(cmdLineLogFileName) : envLogOptions.logToFile ? envLogOptions.file || (__dirname + "/.log" + process.pid.toString()) : undefined; const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel; - return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity) + return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity); } // This places log file in the directory containing editorServices.js // TODO: check that this location is writable diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 74497504ba..0a9d8ee29f 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -24,7 +24,7 @@ namespace ts.server.typingsInstaller { try { fs.appendFileSync(this.logFile, text + sys.newLine); } - catch(e) { + catch (e) { this.logEnabled = false; } } diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 0000bd97c5..d26edbac17 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -23,7 +23,7 @@ namespace ts.codefix { newText: changes[0].textChanges.reduce((prev, cur) => prev + cur.newText, "") }] - }] + }]; return consolidatedChanges; } @@ -108,7 +108,7 @@ namespace ts.codefix { return signatureDeclaration; } - let signatureDeclarations = []; + const signatureDeclarations = []; for (let i = 0; i < signatures.length; i++) { const signature = signatures[i]; const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, SyntaxKind.MethodDeclaration, enclosingDeclaration); @@ -119,7 +119,7 @@ namespace ts.codefix { } if (declarations.length > signatures.length) { - let signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration); + const signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration); const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, SyntaxKind.MethodDeclaration, enclosingDeclaration); signatureDeclaration.modifiers = modifiers; signatureDeclaration.name = name; @@ -141,7 +141,6 @@ namespace ts.codefix { function createMethodImplementingSignatures(signatures: Signature[], name: PropertyName, optional: boolean, modifiers: Modifier[] | undefined): MethodDeclaration { Debug.assert(signatures && signatures.length > 0); - let maxArgsIndex = 0; /** This is *a* signature with the maximal number of arguments, * such that if there is a "maximal" signature without rest arguments, * this is one of them. @@ -158,7 +157,7 @@ namespace ts.codefix { } } const maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); - const maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(symbol => symbol.getName()); + const maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(symbol => symbol.getName()); const parameters: ParameterDeclaration[] = []; for (let i = 0; i < maxNonRestArgs; i++) { @@ -213,9 +212,9 @@ namespace ts.codefix { return createBlock( [createThrow( createNew( - createIdentifier('Error'), + createIdentifier("Error"), /*typeArguments*/undefined, - [createLiteral('Method not implemented.')]))], + [createLiteral("Method not implemented.")]))], /*multiline*/true); } @@ -230,7 +229,7 @@ namespace ts.codefix { } function stripComments(node: Node): Node { - if(node === undefined) { + if (node === undefined) { return node; } const strippedChildren = visitEachChild(node, stripComments, nullTransformationContext); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 743c13ccf3..0c1511ff1e 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -301,7 +301,6 @@ namespace ts.codefix { } function getTextChangeForImportClause(importClause: ImportClause): FileTextChanges[] { - //const newImportText = isDefault ? `default as ${name}` : name; const importList = importClause.namedBindings; const newImportSpecifier = createImportSpecifier(/*propertyName*/ undefined, createIdentifier(name)); // case 1: @@ -556,7 +555,7 @@ namespace ts.codefix { } function createChangeTracker() { - return textChanges.ChangeTracker.fromCodeFixContext(context);; + return textChanges.ChangeTracker.fromCodeFixContext(context); } function createCodeAction( diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 725b9b9950..5a471fb6f3 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -36,11 +36,11 @@ namespace ts.FindAllReferences { } else if (node.kind === SyntaxKind.ObjectLiteralExpression) { entry.kind = ScriptElementKind.interfaceElement; - entry.displayParts = [punctuationPart(SyntaxKind.OpenParenToken), textPart("object literal"), punctuationPart(SyntaxKind.CloseParenToken)] + entry.displayParts = [punctuationPart(SyntaxKind.OpenParenToken), textPart("object literal"), punctuationPart(SyntaxKind.CloseParenToken)]; } else if (node.kind === SyntaxKind.ClassExpression) { entry.kind = ScriptElementKind.localClassElement; - entry.displayParts = [punctuationPart(SyntaxKind.OpenParenToken), textPart("anonymous local class"), punctuationPart(SyntaxKind.CloseParenToken)] + entry.displayParts = [punctuationPart(SyntaxKind.OpenParenToken), textPart("anonymous local class"), punctuationPart(SyntaxKind.CloseParenToken)]; } else { entry.kind = getNodeKind(node); @@ -335,7 +335,7 @@ namespace ts.FindAllReferences { // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & SymbolFlags.Transient && (symbol).checkFlags & CheckFlags.SyntheticProperty)) { + if (symbol.parent || (symbol.flags & SymbolFlags.Transient && (symbol).checkFlags & CheckFlags.Synthetic)) { return undefined; } diff --git a/src/services/services.ts b/src/services/services.ts index a2931a39ab..d8a4cbeae6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -210,6 +210,10 @@ namespace ts { return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); } + + public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T { + return forEachChild(this, cbNode, cbNodeArray); + } } class TokenOrIdentifierObject implements Node { @@ -283,6 +287,10 @@ namespace ts { public getLastToken(): Node { return undefined; } + + public forEachChild(): T { + return undefined; + } } class SymbolObject implements Symbol { diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index b7b739b424..b457165b67 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -52,7 +52,7 @@ namespace ts.SymbolDisplay { if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement; if (flags & SymbolFlags.Property) { - if (flags & SymbolFlags.Transient && (symbol).checkFlags & CheckFlags.SyntheticProperty) { + if (flags & SymbolFlags.Transient && (symbol).checkFlags & CheckFlags.Synthetic) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property const unionPropertyKind = forEach(typeChecker.getRootSymbols(symbol), rootSymbol => { const rootSymbolFlags = rootSymbol.getFlags(); diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index cc304c0751..f5b0ec678d 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -57,7 +57,7 @@ namespace ts.textChanges { * ^ - pos for the next variable declaration will point here * const y; // this is y * ^ - end for previous variable declaration - * Usually leading trivia of the variable declaration 'y' should not include trailing trivia (whitespace, comment 'this is x' and newline) from the preceding + * Usually leading trivia of the variable declaration 'y' should not include trailing trivia (whitespace, comment 'this is x' and newline) from the preceding * variable declaration and trailing trivia for 'y' should include (whitespace, comment 'this is y', newline). * By default when removing nodes we adjust start and end positions to respect specification of the trivia above. * If pos\end should be interpreted literally 'useNonAdjustedStartPosition' or 'useNonAdjustedEndPosition' should be set to true @@ -265,7 +265,7 @@ namespace ts.textChanges { options: {}, range: { pos: after.end, end: after.end }, node: createToken(SyntaxKind.SemicolonToken) - }) + }); } } const endPosition = getAdjustedEndPosition(sourceFile, after, options); @@ -274,9 +274,9 @@ namespace ts.textChanges { } /** - * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, + * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, * i.e. arguments in arguments lists, parameters in parameter lists etc. - * Separators are treated as part of the node for statements and class elements. + * Note that separators are art of the node in statements and class elements. */ public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node) { const containingList = formatting.SmartIndenter.getContainingList(after, sourceFile); @@ -307,8 +307,8 @@ namespace ts.textChanges { // c, // result - '*' denotes leading trivia that will be inserted after new text (displayed as '#') // a,* - //***insertedtext# - //###b, + // ***insertedtext# + // ###b, // c, // find line and character of the next element const lineAndCharOfNextElement = getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); @@ -317,7 +317,7 @@ namespace ts.textChanges { let prefix: string; let startPos: number; if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { - // next element is located on the same line with separator: + // next element is located on the same line with separator: // a,$$$$b // ^ ^ // | |-next element @@ -393,7 +393,7 @@ namespace ts.textChanges { // insert element before the line break on the line that contains 'after' element let insertPos = skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true, /*stopAtComments*/ false); if (insertPos !== end && isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { - insertPos-- + insertPos--; } this.changes.push({ sourceFile, diff --git a/src/services/types.ts b/src/services/types.ts index 856b03330b..05ec81a419 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -18,6 +18,8 @@ namespace ts { getText(sourceFile?: SourceFile): string; getFirstToken(sourceFile?: SourceFile): Node; getLastToken(sourceFile?: SourceFile): Node; + // See ts.forEachChild for documentation. + forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; } export interface Symbol { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 953a2e7bf5..92b6365657 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1384,7 +1384,7 @@ namespace ts { // First token is the open curly, this is where we want to put the 'super' call. return constructor.body.getFirstToken(sourceFile); } - + export function getOpenBraceOfClassLike(declaration: ClassLikeDeclaration, sourceFile: SourceFile) { return getTokenAtPosition(sourceFile, declaration.members.pos - 1); } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt index b762db8a04..7839958ba5 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2495: Type 'StringIterator' is not an array type or a string type. -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(10,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(15,15): error TS2495: Type 'StringIterator' is not an array type or a string type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2495: Type 'StringIterator' is not an array type or a string type. // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -20,4 +17,8 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6 !!! error TS2304: Cannot find name 'Symbol'. return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2495: Type 'StringIterator' is not an array type or a string type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.js b/tests/baselines/reference/ES5For-ofTypeCheck10.js index 0fe92e289a..9b197c2d20 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.js @@ -1,5 +1,4 @@ //// [ES5For-ofTypeCheck10.ts] -for (var v of new StringIterator) { } // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -12,12 +11,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [ES5For-ofTypeCheck10.js] -for (var _i = 0, _a = new StringIterator; _i < _a.length; _i++) { - var v = _a[_i]; -} // In ES3/5, you cannot for...of over an arbitrary iterable. var StringIterator = (function () { function StringIterator() { @@ -33,3 +31,6 @@ var StringIterator = (function () { }; return StringIterator; }()); +for (var _i = 0, _a = new StringIterator; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt index 2a464e8826..0da61368ee 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(2,31): error TS2449: Class 'A' used before its declaration. ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== @@ -24,11 +25,13 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error } } -==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ==== +==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (2 errors) ==== module A { ~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export var Instance = new A(); + ~ +!!! error TS2449: Class 'A' used before its declaration. } // duplicate identifier diff --git a/tests/baselines/reference/circularImportAlias.errors.txt b/tests/baselines/reference/circularImportAlias.errors.txt index 82c9205ae5..13ff1d8c7c 100644 --- a/tests/baselines/reference/circularImportAlias.errors.txt +++ b/tests/baselines/reference/circularImportAlias.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts(5,28): error TS2690: A class must be declared after its base class. +tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts(5,30): error TS2449: Class 'C' used before its declaration. ==== tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts (1 errors) ==== @@ -7,8 +7,8 @@ tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.t module B { export import a = A; export class D extends a.C { - ~~~ -!!! error TS2690: A class must be declared after its base class. + ~ +!!! error TS2449: Class 'C' used before its declaration. id: number; } } diff --git a/tests/baselines/reference/classAbstractInstantiations2.errors.txt b/tests/baselines/reference/classAbstractInstantiations2.errors.txt index bf4cd851fb..15b63a6d3e 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.errors.txt +++ b/tests/baselines/reference/classAbstractInstantiations2.errors.txt @@ -3,13 +3,14 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst Cannot assign an abstract constructor type to a non-abstract constructor type. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(17,5): error TS2511: Cannot create an instance of the abstract class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(23,15): error TS2449: Class 'C' used before its declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or non-abstract. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1244: Abstract methods can only appear within an abstract class. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (8 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (9 errors) ==== class A { // ... } @@ -42,6 +43,8 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst !!! error TS2511: Cannot create an instance of the abstract class 'B'. var x : any = C; + ~ +!!! error TS2449: Class 'C' used before its declaration. new x; // okay -- undefined behavior at runtime class C extends B { } // error -- not declared abstract diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js new file mode 100644 index 0000000000..195cd78f35 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js @@ -0,0 +1,15 @@ +//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts] +function f() { + new C2(); // OK +} +class C2 { } + +//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js] +function f() { + new C2(); // OK +} +var C2 = (function () { + function C2() { + } + return C2; +}()); diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols new file mode 100644 index 0000000000..19e4620b5c --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts === +function f() { +>f : Symbol(f, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 0, 0)) + + new C2(); // OK +>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1)) +} +class C2 { } +>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1)) + diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types new file mode 100644 index 0000000000..6255006523 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts === +function f() { +>f : () => void + + new C2(); // OK +>new C2() : C2 +>C2 : typeof C2 +} +class C2 { } +>C2 : C2 + diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js new file mode 100644 index 0000000000..b3a3d25a81 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js @@ -0,0 +1,9 @@ +//// [classDeclarationCheckUsedBeforeDefinitionInItself.ts] +class C3 { + static intance = new C3(); // ok +} + +//// [classDeclarationCheckUsedBeforeDefinitionInItself.js] +class C3 { +} +C3.intance = new C3(); // ok diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols new file mode 100644 index 0000000000..f0e6f2a5a7 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts === +class C3 { +>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0)) + + static intance = new C3(); // ok +>intance : Symbol(C3.intance, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 10)) +>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0)) +} diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types new file mode 100644 index 0000000000..e4f36dda38 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts === +class C3 { +>C3 : C3 + + static intance = new C3(); // ok +>intance : C3 +>new C3() : C3 +>C3 : typeof C3 +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index c1642125fe..5b9892b9ab 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -1,16 +1,16 @@ //// [classDoesNotDependOnBaseTypes.ts] -var x: StringTree; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} - type StringTree = string | StringTreeCollection; class StringTreeCollectionBase { [n: number]: StringTree; } -class StringTreeCollection extends StringTreeCollectionBase { } +class StringTreeCollection extends StringTreeCollectionBase { } + +var x: StringTree; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} //// [classDoesNotDependOnBaseTypes.js] var __extends = (this && this.__extends) || (function () { @@ -23,11 +23,6 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var x; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} var StringTreeCollectionBase = (function () { function StringTreeCollectionBase() { } @@ -40,3 +35,8 @@ var StringTreeCollection = (function (_super) { } return StringTreeCollection; }(StringTreeCollectionBase)); +var x; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols b/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols index e45b00f1e8..a7a421ebf5 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols @@ -1,32 +1,31 @@ === tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts === -var x: StringTree; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) - -if (typeof x !== "string") { ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) - - x[0] = ""; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) - - x[0] = new StringTreeCollection; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) -} - type StringTree = string | StringTreeCollection; ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) class StringTreeCollectionBase { ->StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 6, 48)) +>StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 0, 48)) [n: number]: StringTree; ->n : Symbol(n, Decl(classDoesNotDependOnBaseTypes.ts, 8, 5)) ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) +>n : Symbol(n, Decl(classDoesNotDependOnBaseTypes.ts, 2, 5)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) } class StringTreeCollection extends StringTreeCollectionBase { } ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) ->StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 6, 48)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) +>StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 0, 48)) +var x: StringTree; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) + +if (typeof x !== "string") { +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) + + x[0] = ""; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) + + x[0] = new StringTreeCollection; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.types b/tests/baselines/reference/classDoesNotDependOnBaseTypes.types index 54b67dfd6a..16dc984dc8 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.types +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.types @@ -1,4 +1,20 @@ === tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts === +type StringTree = string | StringTreeCollection; +>StringTree : StringTree +>StringTreeCollection : StringTreeCollection + +class StringTreeCollectionBase { +>StringTreeCollectionBase : StringTreeCollectionBase + + [n: number]: StringTree; +>n : number +>StringTree : StringTree +} + +class StringTreeCollection extends StringTreeCollectionBase { } +>StringTreeCollection : StringTreeCollection +>StringTreeCollectionBase : StringTreeCollectionBase + var x: StringTree; >x : StringTree >StringTree : StringTree @@ -24,20 +40,3 @@ if (typeof x !== "string") { >new StringTreeCollection : StringTreeCollection >StringTreeCollection : typeof StringTreeCollection } - -type StringTree = string | StringTreeCollection; ->StringTree : StringTree ->StringTreeCollection : StringTreeCollection - -class StringTreeCollectionBase { ->StringTreeCollectionBase : StringTreeCollectionBase - - [n: number]: StringTree; ->n : number ->StringTree : StringTree -} - -class StringTreeCollection extends StringTreeCollectionBase { } ->StringTreeCollection : StringTreeCollection ->StringTreeCollectionBase : StringTreeCollectionBase - diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt index c0f35f0388..8f54ef1805 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt @@ -1,15 +1,19 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(1,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(1,17): error TS2449: Class 'E' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(3,7): error TS2506: 'D' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(5,7): error TS2506: 'E' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(7,7): error TS2506: 'C2' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(7,21): error TS2449: Class 'E2' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(9,7): error TS2506: 'D2' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(11,7): error TS2506: 'E2' is referenced directly or indirectly in its own base expression. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (8 errors) ==== class C extends E { foo: string; } // error ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'E' used before its declaration. class D extends C { bar: string; } ~ @@ -22,6 +26,8 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C2 extends E2 { foo: T; } // error ~~ !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. + ~~ +!!! error TS2449: Class 'E2' used before its declaration. class D2 extends C2 { bar: T; } ~~ diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt index 061770f9b7..48c787b54d 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt @@ -1,15 +1,19 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(1,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(1,19): error TS2449: Class 'E' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(4,18): error TS2506: 'D' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(9,18): error TS2506: 'E' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(13,11): error TS2506: 'C2' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(13,27): error TS2449: Class 'E2' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(16,22): error TS2506: 'D2' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(20,22): error TS2506: 'E2' is referenced directly or indirectly in its own base expression. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (8 errors) ==== class C extends N.E { foo: string; } // error ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'E' used before its declaration. module M { export class D extends C { bar: string; } @@ -28,6 +32,8 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C2 extends Q.E2 { foo: T; } // error ~~ !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. + ~~ +!!! error TS2449: Class 'E2' used before its declaration. module P { export class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classInheritence.errors.txt b/tests/baselines/reference/classInheritence.errors.txt index cd95dedbfc..3bad3caf3d 100644 --- a/tests/baselines/reference/classInheritence.errors.txt +++ b/tests/baselines/reference/classInheritence.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classInheritence.ts(1,17): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classInheritence.ts(1,17): error TS2449: Class 'A' used before its declaration. tests/cases/compiler/classInheritence.ts(2,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression. ==== tests/cases/compiler/classInheritence.ts (2 errors) ==== class B extends A { } ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'A' used before its declaration. class A extends A { } ~ !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/classOrder2.errors.txt b/tests/baselines/reference/classOrder2.errors.txt index a1b8dc6346..59184e6a5e 100644 --- a/tests/baselines/reference/classOrder2.errors.txt +++ b/tests/baselines/reference/classOrder2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classOrder2.ts(2,17): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classOrder2.ts(2,17): error TS2449: Class 'B' used before its declaration. ==== tests/cases/compiler/classOrder2.ts (1 errors) ==== class A extends B { ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'B' used before its declaration. foo() { this.bar(); } diff --git a/tests/baselines/reference/classSideInheritance2.errors.txt b/tests/baselines/reference/classSideInheritance2.errors.txt index e286594ec2..7b27ee7c0f 100644 --- a/tests/baselines/reference/classSideInheritance2.errors.txt +++ b/tests/baselines/reference/classSideInheritance2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2449: Class 'TextBase' used before its declaration. ==== tests/cases/compiler/classSideInheritance2.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2690: A class must class SubText extends TextBase { ~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'TextBase' used before its declaration. constructor(text: IText, span: TextSpan) { super(); diff --git a/tests/baselines/reference/complexClassRelationships.errors.txt b/tests/baselines/reference/complexClassRelationships.errors.txt index 33413e496d..c978a36c03 100644 --- a/tests/baselines/reference/complexClassRelationships.errors.txt +++ b/tests/baselines/reference/complexClassRelationships.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/complexClassRelationships.ts(2,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/complexClassRelationships.ts(2,23): error TS2449: Class 'Base' used before its declaration. ==== tests/cases/compiler/complexClassRelationships.ts (1 errors) ==== // There should be no errors in this file class Derived extends Base { ~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'Base' used before its declaration. public static createEmpty(): Derived { var item = new Derived(); return item; diff --git a/tests/baselines/reference/deeplyNestedCheck.js b/tests/baselines/reference/deeplyNestedCheck.js new file mode 100644 index 0000000000..466ae94f12 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedCheck.js @@ -0,0 +1,14 @@ +//// [deeplyNestedCheck.ts] +// Repro from #14794 + +interface DataSnapshot { + child(path: string): DataSnapshot; +} + +interface Snapshot extends DataSnapshot { + child(path: U): Snapshot; +} + + +//// [deeplyNestedCheck.js] +// Repro from #14794 diff --git a/tests/baselines/reference/deeplyNestedCheck.symbols b/tests/baselines/reference/deeplyNestedCheck.symbols new file mode 100644 index 0000000000..a8b5af6088 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedCheck.symbols @@ -0,0 +1,29 @@ +=== tests/cases/compiler/deeplyNestedCheck.ts === +// Repro from #14794 + +interface DataSnapshot { +>DataSnapshot : Symbol(DataSnapshot, Decl(deeplyNestedCheck.ts, 0, 0)) +>X : Symbol(X, Decl(deeplyNestedCheck.ts, 2, 23)) + + child(path: string): DataSnapshot; +>child : Symbol(DataSnapshot.child, Decl(deeplyNestedCheck.ts, 2, 32)) +>path : Symbol(path, Decl(deeplyNestedCheck.ts, 3, 8)) +>DataSnapshot : Symbol(DataSnapshot, Decl(deeplyNestedCheck.ts, 0, 0)) +} + +interface Snapshot extends DataSnapshot { +>Snapshot : Symbol(Snapshot, Decl(deeplyNestedCheck.ts, 4, 1)) +>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19)) +>DataSnapshot : Symbol(DataSnapshot, Decl(deeplyNestedCheck.ts, 0, 0)) + + child(path: U): Snapshot; +>child : Symbol(Snapshot.child, Decl(deeplyNestedCheck.ts, 6, 44)) +>U : Symbol(U, Decl(deeplyNestedCheck.ts, 7, 8)) +>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19)) +>path : Symbol(path, Decl(deeplyNestedCheck.ts, 7, 27)) +>U : Symbol(U, Decl(deeplyNestedCheck.ts, 7, 8)) +>Snapshot : Symbol(Snapshot, Decl(deeplyNestedCheck.ts, 4, 1)) +>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19)) +>U : Symbol(U, Decl(deeplyNestedCheck.ts, 7, 8)) +} + diff --git a/tests/baselines/reference/deeplyNestedCheck.types b/tests/baselines/reference/deeplyNestedCheck.types new file mode 100644 index 0000000000..e500fc75ed --- /dev/null +++ b/tests/baselines/reference/deeplyNestedCheck.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/deeplyNestedCheck.ts === +// Repro from #14794 + +interface DataSnapshot { +>DataSnapshot : DataSnapshot +>X : X + + child(path: string): DataSnapshot; +>child : (path: string) => DataSnapshot<{}> +>path : string +>DataSnapshot : DataSnapshot +} + +interface Snapshot extends DataSnapshot { +>Snapshot : Snapshot +>T : T +>DataSnapshot : DataSnapshot + + child(path: U): Snapshot; +>child : (path: U) => Snapshot +>U : U +>T : T +>path : U +>U : U +>Snapshot : Snapshot +>T : T +>U : U +} + diff --git a/tests/baselines/reference/derivedClasses.errors.txt b/tests/baselines/reference/derivedClasses.errors.txt index fdd38d8c06..ff6946df2c 100644 --- a/tests/baselines/reference/derivedClasses.errors.txt +++ b/tests/baselines/reference/derivedClasses.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/derivedClasses.ts(1,19): error TS2690: A class must be declared after its base class. +tests/cases/compiler/derivedClasses.ts(1,19): error TS2449: Class 'Color' used before its declaration. ==== tests/cases/compiler/derivedClasses.ts (1 errors) ==== class Red extends Color { ~~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'Color' used before its declaration. public shade() { var getHue = () => { return this.hue(); }; return getHue() + " red"; diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types index 524f7c9b71..c375fb6f45 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types index c20e0d3501..e4be9f80d4 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types index b5230006f1..1232130a38 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types index 5d57519d14..0e43463990 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types index 2c3063eca5..9ebd2659ef 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types index 5eb09901ac..4e61c90322 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types index ab41ffd9c7..83d65ce524 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator ->async function * () { return 1;} : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> +>async function * () { return 1;} : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types index 424f09cf53..7d736b2327 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator ->async function * () { return 1;} : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> +>async function * () { return 1;} : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types index e4559e3ece..6c40f9cebb 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator ->async function * () { return 1;} : () => AsyncIterableIterator +>f7 : () => AsyncIterableIterator<1> +>async function * () { return 1;} : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types index 0e89d9a1ca..59c5bcfa16 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/es2015/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } +>o7 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types index 4c8ae47b6a..3e7ead2f73 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/es5/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } +>o7 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types index 511cd7ec9e..9e5aad8af2 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } +>o7 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator<1> return 1; >1 : 1 diff --git a/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt new file mode 100644 index 0000000000..aea5366389 --- /dev/null +++ b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/enumUsedBeforeDeclaration.ts(1,18): error TS2450: Enum 'Color' used before its declaration. +tests/cases/compiler/enumUsedBeforeDeclaration.ts(2,24): error TS2450: Enum 'ConstColor' used before its declaration. + + +==== tests/cases/compiler/enumUsedBeforeDeclaration.ts (2 errors) ==== + const v: Color = Color.Green; + ~~~~~ +!!! error TS2450: Enum 'Color' used before its declaration. + const v2: ConstColor = ConstColor.Green; + ~~~~~~~~~~ +!!! error TS2450: Enum 'ConstColor' used before its declaration. + enum Color { Red, Green, Blue } + const enum ConstColor { Red, Green, Blue } + + \ No newline at end of file diff --git a/tests/baselines/reference/enumUsedBeforeDeclaration.js b/tests/baselines/reference/enumUsedBeforeDeclaration.js new file mode 100644 index 0000000000..63fc38471b --- /dev/null +++ b/tests/baselines/reference/enumUsedBeforeDeclaration.js @@ -0,0 +1,17 @@ +//// [enumUsedBeforeDeclaration.ts] +const v: Color = Color.Green; +const v2: ConstColor = ConstColor.Green; +enum Color { Red, Green, Blue } +const enum ConstColor { Red, Green, Blue } + + + +//// [enumUsedBeforeDeclaration.js] +var v = Color.Green; +var v2 = 1 /* Green */; +var Color; +(function (Color) { + Color[Color["Red"] = 0] = "Red"; + Color[Color["Green"] = 1] = "Green"; + Color[Color["Blue"] = 2] = "Blue"; +})(Color || (Color = {})); diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt new file mode 100644 index 0000000000..951e8bbffd --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts(2,21): error TS2449: Class 'C' used before its declaration. + + +==== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts (1 errors) ==== + + var before: C = new C(); + ~ +!!! error TS2449: Class 'C' used before its declaration. + + export default class C { + method(): C { + return new C(); + } + } + + var after: C = new C(); + + var t: typeof C = C; + + \ No newline at end of file diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols deleted file mode 100644 index d5c8243161..0000000000 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols +++ /dev/null @@ -1,30 +0,0 @@ -=== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts === - -var before: C = new C(); ->before : Symbol(before, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - -export default class C { ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - method(): C { ->method : Symbol(C.method, Decl(es5ExportDefaultClassDeclaration3.ts, 3, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - return new C(); ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - } -} - -var after: C = new C(); ->after : Symbol(after, Decl(es5ExportDefaultClassDeclaration3.ts, 9, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - -var t: typeof C = C; ->t : Symbol(t, Decl(es5ExportDefaultClassDeclaration3.ts, 11, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types deleted file mode 100644 index 1ed302ac45..0000000000 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types +++ /dev/null @@ -1,33 +0,0 @@ -=== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts === - -var before: C = new C(); ->before : C ->C : C ->new C() : C ->C : typeof C - -export default class C { ->C : C - - method(): C { ->method : () => C ->C : C - - return new C(); ->new C() : C ->C : typeof C - } -} - -var after: C = new C(); ->after : C ->C : C ->new C() : C ->C : typeof C - -var t: typeof C = C; ->t : typeof C ->C : typeof C ->C : typeof C - - diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt b/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt new file mode 100644 index 0000000000..e484d4096b --- /dev/null +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/exportAssignmentOfGenericType1_0.ts(1,10): error TS2449: Class 'T' used before its declaration. + + +==== tests/cases/compiler/exportAssignmentOfGenericType1_1.ts (0 errors) ==== + /// + import q = require("exportAssignmentOfGenericType1_0"); + + class M extends q { } + var m: M; + var r: string = m.foo; + +==== tests/cases/compiler/exportAssignmentOfGenericType1_0.ts (1 errors) ==== + export = T; + ~ +!!! error TS2449: Class 'T' used before its declaration. + class T { foo: X; } + \ No newline at end of file diff --git a/tests/baselines/reference/exportImport.errors.txt b/tests/baselines/reference/exportImport.errors.txt new file mode 100644 index 0000000000..fb5a41fe1e --- /dev/null +++ b/tests/baselines/reference/exportImport.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/w1.ts(2,1): error TS2449: Class 'Widget1' used before its declaration. +tests/cases/compiler/w1.ts(2,10): error TS2449: Class 'Widget1' used before its declaration. + + +==== tests/cases/compiler/consumer.ts (0 errors) ==== + import e = require('./exporter'); + + export function w(): e.w { // Should be OK + return new e.w(); + } +==== tests/cases/compiler/w1.ts (2 errors) ==== + + export = Widget1 + ~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'Widget1' used before its declaration. + ~~~~~~~ +!!! error TS2449: Class 'Widget1' used before its declaration. + class Widget1 { name = 'one'; } + +==== tests/cases/compiler/exporter.ts (0 errors) ==== + export import w = require('./w1'); + \ No newline at end of file diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt index 2678fdf866..64e5c7d3ef 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts(1,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts(1,23): error TS2449: Class 'base' used before its declaration. ==== tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts (1 errors) ==== class derived extends base { } ~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'base' used before its declaration. class base { constructor (public n: number) { } } \ No newline at end of file diff --git a/tests/baselines/reference/for-of14.errors.txt b/tests/baselines/reference/for-of14.errors.txt index ab95d04268..d4ec79620d 100644 --- a/tests/baselines/reference/for-of14.errors.txt +++ b/tests/baselines/reference/for-of14.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/for-ofStatements/for-of14.ts(2,11): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. +tests/cases/conformance/es6/for-ofStatements/for-of14.ts(8,11): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. ==== tests/cases/conformance/es6/for-ofStatements/for-of14.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail because the iterator is not iterable - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - class StringIterator { next() { return ""; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail because the iterator is not iterable + ~~~~~~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/for-of14.js b/tests/baselines/reference/for-of14.js index 42832f8e58..ac3af1ff1d 100644 --- a/tests/baselines/reference/for-of14.js +++ b/tests/baselines/reference/for-of14.js @@ -1,18 +1,18 @@ //// [for-of14.ts] -var v: string; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable - class StringIterator { next() { return ""; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable //// [for-of14.js] -var v; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable class StringIterator { next() { return ""; } } +var v; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable diff --git a/tests/baselines/reference/for-of15.errors.txt b/tests/baselines/reference/for-of15.errors.txt index 20a4abe4bd..6d990aa01f 100644 --- a/tests/baselines/reference/for-of15.errors.txt +++ b/tests/baselines/reference/for-of15.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/es6/for-ofStatements/for-of15.ts(2,11): error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. +tests/cases/conformance/es6/for-ofStatements/for-of15.ts(11,11): error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. ==== tests/cases/conformance/es6/for-ofStatements/for-of15.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail - ~~~~~~~~~~~~~~~~~~ -!!! error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. - class StringIterator { next() { return ""; @@ -14,4 +9,9 @@ tests/cases/conformance/es6/for-ofStatements/for-of15.ts(2,11): error TS2490: Th [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. \ No newline at end of file diff --git a/tests/baselines/reference/for-of15.js b/tests/baselines/reference/for-of15.js index 62232745c8..f88c864016 100644 --- a/tests/baselines/reference/for-of15.js +++ b/tests/baselines/reference/for-of15.js @@ -1,7 +1,4 @@ //// [for-of15.ts] -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { next() { return ""; @@ -9,11 +6,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail //// [for-of15.js] -var v; -for (v of new StringIterator) { } // Should fail class StringIterator { next() { return ""; @@ -22,3 +20,5 @@ class StringIterator { return this; } } +var v; +for (v of new StringIterator) { } // Should fail diff --git a/tests/baselines/reference/for-of16.errors.txt b/tests/baselines/reference/for-of16.errors.txt index 20e3e87653..7574f98e3d 100644 --- a/tests/baselines/reference/for-of16.errors.txt +++ b/tests/baselines/reference/for-of16.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/for-ofStatements/for-of16.ts(2,11): error TS2489: An iterator must have a 'next()' method. +tests/cases/conformance/es6/for-ofStatements/for-of16.ts(8,11): error TS2489: An iterator must have a 'next()' method. ==== tests/cases/conformance/es6/for-ofStatements/for-of16.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail - ~~~~~~~~~~~~~~~~~~ -!!! error TS2489: An iterator must have a 'next()' method. - class StringIterator { [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2489: An iterator must have a 'next()' method. \ No newline at end of file diff --git a/tests/baselines/reference/for-of16.js b/tests/baselines/reference/for-of16.js index 974be239fd..2219e15a6f 100644 --- a/tests/baselines/reference/for-of16.js +++ b/tests/baselines/reference/for-of16.js @@ -1,18 +1,18 @@ //// [for-of16.ts] -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail //// [for-of16.js] -var v; -for (v of new StringIterator) { } // Should fail class StringIterator { [Symbol.iterator]() { return this; } } +var v; +for (v of new StringIterator) { } // Should fail diff --git a/tests/baselines/reference/for-of17.errors.txt b/tests/baselines/reference/for-of17.errors.txt index dfdeb8db00..5a77815369 100644 --- a/tests/baselines/reference/for-of17.errors.txt +++ b/tests/baselines/reference/for-of17.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/es6/for-ofStatements/for-of17.ts(2,6): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of17.ts(14,6): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/es6/for-ofStatements/for-of17.ts (1 errors) ==== - var v: string; - for (v of new NumberIterator) { } // Should succeed - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - class NumberIterator { next() { return { @@ -17,4 +12,9 @@ tests/cases/conformance/es6/for-ofStatements/for-of17.ts(2,6): error TS2322: Typ [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new NumberIterator) { } // Should succeed + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of17.js b/tests/baselines/reference/for-of17.js index a392764700..2cd6bbe0d2 100644 --- a/tests/baselines/reference/for-of17.js +++ b/tests/baselines/reference/for-of17.js @@ -1,7 +1,4 @@ //// [for-of17.ts] -var v: string; -for (v of new NumberIterator) { } // Should succeed - class NumberIterator { next() { return { @@ -12,11 +9,12 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new NumberIterator) { } // Should succeed //// [for-of17.js] -var v; -for (v of new NumberIterator) { } // Should succeed class NumberIterator { next() { return { @@ -28,3 +26,5 @@ class NumberIterator { return this; } } +var v; +for (v of new NumberIterator) { } // Should succeed diff --git a/tests/baselines/reference/for-of18.js b/tests/baselines/reference/for-of18.js index c31e6b6e8c..fb7a684098 100644 --- a/tests/baselines/reference/for-of18.js +++ b/tests/baselines/reference/for-of18.js @@ -1,7 +1,4 @@ //// [for-of18.ts] -var v: string; -for (v of new StringIterator) { } // Should succeed - class StringIterator { next() { return { @@ -12,11 +9,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should succeed //// [for-of18.js] -var v; -for (v of new StringIterator) { } // Should succeed class StringIterator { next() { return { @@ -28,3 +26,5 @@ class StringIterator { return this; } } +var v; +for (v of new StringIterator) { } // Should succeed diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index b9d3266271..8f552c2757 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -1,23 +1,16 @@ === tests/cases/conformance/es6/for-ofStatements/for-of18.ts === -var v: string; ->v : Symbol(v, Decl(for-of18.ts, 0, 3)) - -for (v of new StringIterator) { } // Should succeed ->v : Symbol(v, Decl(for-of18.ts, 0, 3)) ->StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) +>StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) next() { ->next : Symbol(StringIterator.next, Decl(for-of18.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of18.ts, 0, 22)) return { value: "", ->value : Symbol(value, Decl(for-of18.ts, 5, 16)) +>value : Symbol(value, Decl(for-of18.ts, 2, 16)) done: false ->done : Symbol(done, Decl(for-of18.ts, 6, 22)) +>done : Symbol(done, Decl(for-of18.ts, 3, 22)) }; } @@ -27,6 +20,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) +>this : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) } } + +var v: string; +>v : Symbol(v, Decl(for-of18.ts, 12, 3)) + +for (v of new StringIterator) { } // Should succeed +>v : Symbol(v, Decl(for-of18.ts, 12, 3)) +>StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of18.types b/tests/baselines/reference/for-of18.types index 86978b62cc..8b70c44625 100644 --- a/tests/baselines/reference/for-of18.types +++ b/tests/baselines/reference/for-of18.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of18.ts === -var v: string; ->v : string - -for (v of new StringIterator) { } // Should succeed ->v : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -35,3 +27,12 @@ class StringIterator { >this : this } } + +var v: string; +>v : string + +for (v of new StringIterator) { } // Should succeed +>v : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of19.js b/tests/baselines/reference/for-of19.js index d0f95caa1e..c0000d8d10 100644 --- a/tests/baselines/reference/for-of19.js +++ b/tests/baselines/reference/for-of19.js @@ -1,8 +1,4 @@ //// [for-of19.ts] -for (var v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (var v of new FooIterator) { + v; } //// [for-of19.js] -for (var v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (var v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index e1a129aa32..f36dd74f9b 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of19.ts === -for (var v of new FooIterator) { ->v : Symbol(v, Decl(for-of19.ts, 0, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of19.ts, 0, 8)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of19.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of19.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of19.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of19.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of19.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of19.ts, 2, 1)) +>value : Symbol(value, Decl(for-of19.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of19.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of19.ts, 8, 27)) +>done : Symbol(done, Decl(for-of19.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) } } + +for (var v of new FooIterator) { +>v : Symbol(v, Decl(for-of19.ts, 13, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of19.ts, 13, 8)) +} diff --git a/tests/baselines/reference/for-of19.types b/tests/baselines/reference/for-of19.types index a2882ccf1a..a62b2d64c8 100644 --- a/tests/baselines/reference/for-of19.types +++ b/tests/baselines/reference/for-of19.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of19.ts === -for (var v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of20.js b/tests/baselines/reference/for-of20.js index c098abd2f7..97259778d2 100644 --- a/tests/baselines/reference/for-of20.js +++ b/tests/baselines/reference/for-of20.js @@ -1,8 +1,4 @@ //// [for-of20.ts] -for (let v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (let v of new FooIterator) { + v; } //// [for-of20.js] -for (let v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (let v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 20b444e6bc..5fff9fd787 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of20.ts === -for (let v of new FooIterator) { ->v : Symbol(v, Decl(for-of20.ts, 0, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of20.ts, 0, 8)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of20.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of20.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of20.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of20.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of20.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of20.ts, 2, 1)) +>value : Symbol(value, Decl(for-of20.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of20.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of20.ts, 8, 27)) +>done : Symbol(done, Decl(for-of20.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) } } + +for (let v of new FooIterator) { +>v : Symbol(v, Decl(for-of20.ts, 13, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of20.ts, 13, 8)) +} diff --git a/tests/baselines/reference/for-of20.types b/tests/baselines/reference/for-of20.types index 9274c7f4b9..e620b60310 100644 --- a/tests/baselines/reference/for-of20.types +++ b/tests/baselines/reference/for-of20.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of20.ts === -for (let v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (let v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of21.js b/tests/baselines/reference/for-of21.js index 27da28e3b4..66791de89b 100644 --- a/tests/baselines/reference/for-of21.js +++ b/tests/baselines/reference/for-of21.js @@ -1,8 +1,4 @@ //// [for-of21.ts] -for (const v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + v; } //// [for-of21.js] -for (const v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (const v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 71403edfc9..0068c9ef4a 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of21.ts === -for (const v of new FooIterator) { ->v : Symbol(v, Decl(for-of21.ts, 0, 10)) ->FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of21.ts, 0, 10)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of21.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of21.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of21.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of21.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of21.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of21.ts, 2, 1)) +>value : Symbol(value, Decl(for-of21.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of21.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of21.ts, 8, 27)) +>done : Symbol(done, Decl(for-of21.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) } } + +for (const v of new FooIterator) { +>v : Symbol(v, Decl(for-of21.ts, 13, 10)) +>FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of21.ts, 13, 10)) +} diff --git a/tests/baselines/reference/for-of21.types b/tests/baselines/reference/for-of21.types index 1366cb1a42..59c66b2a41 100644 --- a/tests/baselines/reference/for-of21.types +++ b/tests/baselines/reference/for-of21.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of21.ts === -for (const v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of22.js b/tests/baselines/reference/for-of22.js index 886e8dba7c..767ed1cc15 100644 --- a/tests/baselines/reference/for-of22.js +++ b/tests/baselines/reference/for-of22.js @@ -1,9 +1,4 @@ //// [for-of22.ts] -v; -for (var v of new FooIterator) { - -} - class Foo { } class FooIterator { next() { @@ -15,12 +10,14 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +v; +for (var v of new FooIterator) { + } //// [for-of22.js] -v; -for (var v of new FooIterator) { -} class Foo { } class FooIterator { @@ -34,3 +31,6 @@ class FooIterator { return this; } } +v; +for (var v of new FooIterator) { +} diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 36a522759c..929cae4ed7 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -1,29 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of22.ts === -v; ->v : Symbol(v, Decl(for-of22.ts, 1, 8)) - -for (var v of new FooIterator) { ->v : Symbol(v, Decl(for-of22.ts, 1, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) - -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of22.ts, 3, 1)) +>Foo : Symbol(Foo, Decl(for-of22.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of22.ts, 6, 19)) +>next : Symbol(FooIterator.next, Decl(for-of22.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of22.ts, 8, 16)) ->Foo : Symbol(Foo, Decl(for-of22.ts, 3, 1)) +>value : Symbol(value, Decl(for-of22.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of22.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of22.ts, 9, 27)) +>done : Symbol(done, Decl(for-of22.ts, 4, 27)) }; } @@ -33,6 +24,15 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) +>this : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) } } + +v; +>v : Symbol(v, Decl(for-of22.ts, 14, 8)) + +for (var v of new FooIterator) { +>v : Symbol(v, Decl(for-of22.ts, 14, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) + +} diff --git a/tests/baselines/reference/for-of22.types b/tests/baselines/reference/for-of22.types index 80cd42b2b3..e1449875da 100644 --- a/tests/baselines/reference/for-of22.types +++ b/tests/baselines/reference/for-of22.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of22.ts === -v; ->v : Foo - -for (var v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -} - class Foo { } >Foo : Foo @@ -41,3 +31,13 @@ class FooIterator { >this : this } } + +v; +>v : Foo + +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +} diff --git a/tests/baselines/reference/for-of23.js b/tests/baselines/reference/for-of23.js index f5649128c1..9ad03c0109 100644 --- a/tests/baselines/reference/for-of23.js +++ b/tests/baselines/reference/for-of23.js @@ -1,8 +1,4 @@ //// [for-of23.ts] -for (const v of new FooIterator) { - const v = 0; // new scope -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + const v = 0; // new scope } //// [for-of23.js] -for (const v of new FooIterator) { - const v = 0; // new scope -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (const v of new FooIterator) { + const v = 0; // new scope +} diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index 3be07f4fd4..7a57e38baf 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of23.ts === -for (const v of new FooIterator) { ->v : Symbol(v, Decl(for-of23.ts, 0, 10)) ->FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) - - const v = 0; // new scope ->v : Symbol(v, Decl(for-of23.ts, 1, 9)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of23.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of23.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of23.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of23.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of23.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of23.ts, 2, 1)) +>value : Symbol(value, Decl(for-of23.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of23.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of23.ts, 8, 27)) +>done : Symbol(done, Decl(for-of23.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) } } + +for (const v of new FooIterator) { +>v : Symbol(v, Decl(for-of23.ts, 13, 10)) +>FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) + + const v = 0; // new scope +>v : Symbol(v, Decl(for-of23.ts, 14, 9)) +} diff --git a/tests/baselines/reference/for-of23.types b/tests/baselines/reference/for-of23.types index ed74156f51..427eb57f5a 100644 --- a/tests/baselines/reference/for-of23.types +++ b/tests/baselines/reference/for-of23.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of23.ts === -for (const v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - const v = 0; // new scope ->v : 0 ->0 : 0 -} - class Foo { } >Foo : Foo @@ -41,3 +31,13 @@ class FooIterator { >this : this } } + +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + const v = 0; // new scope +>v : 0 +>0 : 0 +} diff --git a/tests/baselines/reference/for-of25.js b/tests/baselines/reference/for-of25.js index 5715f6e8a3..032efa52ae 100644 --- a/tests/baselines/reference/for-of25.js +++ b/tests/baselines/reference/for-of25.js @@ -1,18 +1,18 @@ //// [for-of25.ts] -var x: any; -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return x; } -} +} + +var x: any; +for (var v of new StringIterator) { } //// [for-of25.js] -var x; -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return x; } } +var x; +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index e21348ba56..e9304e517b 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -1,13 +1,6 @@ === tests/cases/conformance/es6/for-ofStatements/for-of25.ts === -var x: any; ->x : Symbol(x, Decl(for-of25.ts, 0, 3)) - -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of25.ts, 1, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 0, 0)) [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -15,6 +8,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return x; ->x : Symbol(x, Decl(for-of25.ts, 0, 3)) +>x : Symbol(x, Decl(for-of25.ts, 6, 3)) } } + +var x: any; +>x : Symbol(x, Decl(for-of25.ts, 6, 3)) + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of25.ts, 7, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of25.types b/tests/baselines/reference/for-of25.types index c4d6b32aeb..7a11b7acf6 100644 --- a/tests/baselines/reference/for-of25.types +++ b/tests/baselines/reference/for-of25.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of25.ts === -var x: any; ->x : any - -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -19,3 +11,12 @@ class StringIterator { >x : any } } + +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of26.js b/tests/baselines/reference/for-of26.js index 33319f50ef..ab9c4fdca9 100644 --- a/tests/baselines/reference/for-of26.js +++ b/tests/baselines/reference/for-of26.js @@ -1,7 +1,4 @@ //// [for-of26.ts] -var x: any; -for (var v of new StringIterator) { } - class StringIterator { next() { return x; @@ -9,11 +6,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var x: any; +for (var v of new StringIterator) { } //// [for-of26.js] -var x; -for (var v of new StringIterator) { } class StringIterator { next() { return x; @@ -22,3 +20,5 @@ class StringIterator { return this; } } +var x; +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index 947240bf8e..2047389825 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -1,19 +1,12 @@ === tests/cases/conformance/es6/for-ofStatements/for-of26.ts === -var x: any; ->x : Symbol(x, Decl(for-of26.ts, 0, 3)) - -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of26.ts, 1, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) next() { ->next : Symbol(StringIterator.next, Decl(for-of26.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of26.ts, 0, 22)) return x; ->x : Symbol(x, Decl(for-of26.ts, 0, 3)) +>x : Symbol(x, Decl(for-of26.ts, 9, 3)) } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -21,6 +14,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) +>this : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) } } + +var x: any; +>x : Symbol(x, Decl(for-of26.ts, 9, 3)) + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of26.ts, 10, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of26.types b/tests/baselines/reference/for-of26.types index fe930e2e57..b0cfd89174 100644 --- a/tests/baselines/reference/for-of26.types +++ b/tests/baselines/reference/for-of26.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of26.ts === -var x: any; ->x : any - -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -25,3 +17,12 @@ class StringIterator { >this : this } } + +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of27.js b/tests/baselines/reference/for-of27.js index 1ac3a1dfc4..6adc66e241 100644 --- a/tests/baselines/reference/for-of27.js +++ b/tests/baselines/reference/for-of27.js @@ -1,11 +1,11 @@ //// [for-of27.ts] -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]: any; -} +} + +for (var v of new StringIterator) { } //// [for-of27.js] -for (var v of new StringIterator) { } class StringIterator { } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index b2b733ab13..4799a13835 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -1,13 +1,14 @@ === tests/cases/conformance/es6/for-ofStatements/for-of27.ts === -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of27.ts, 0, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 0)) [Symbol.iterator]: any; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of27.ts, 4, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of27.types b/tests/baselines/reference/for-of27.types index 8e9130ce27..f6115ccf8c 100644 --- a/tests/baselines/reference/for-of27.types +++ b/tests/baselines/reference/for-of27.types @@ -1,9 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of27.ts === -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -12,3 +7,9 @@ class StringIterator { >Symbol : SymbolConstructor >iterator : symbol } + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of28.js b/tests/baselines/reference/for-of28.js index 78e8677481..e06e2fc6ab 100644 --- a/tests/baselines/reference/for-of28.js +++ b/tests/baselines/reference/for-of28.js @@ -1,17 +1,17 @@ //// [for-of28.ts] -for (var v of new StringIterator) { } - class StringIterator { next: any; [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of28.js] -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index 52ed4fd745..ad5ea53a80 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -1,13 +1,9 @@ === tests/cases/conformance/es6/for-ofStatements/for-of28.ts === -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of28.ts, 0, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) next: any; ->next : Symbol(StringIterator.next, Decl(for-of28.ts, 2, 22)) +>next : Symbol(StringIterator.next, Decl(for-of28.ts, 0, 22)) [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -15,6 +11,11 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) +>this : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) } } + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of28.ts, 7, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of28.types b/tests/baselines/reference/for-of28.types index 882d2df618..a454a0c448 100644 --- a/tests/baselines/reference/for-of28.types +++ b/tests/baselines/reference/for-of28.types @@ -1,9 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of28.ts === -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -19,3 +14,9 @@ class StringIterator { >this : this } } + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of30.errors.txt b/tests/baselines/reference/for-of30.errors.txt index 6434b5294d..b0091c90b5 100644 --- a/tests/baselines/reference/for-of30.errors.txt +++ b/tests/baselines/reference/for-of30.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/for-ofStatements/for-of30.ts(16,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. @@ -7,15 +7,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty ==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'return' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. - class StringIterator { next() { return { @@ -29,4 +20,13 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'return' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of30.js b/tests/baselines/reference/for-of30.js index 37316774c9..935944db64 100644 --- a/tests/baselines/reference/for-of30.js +++ b/tests/baselines/reference/for-of30.js @@ -1,6 +1,4 @@ //// [for-of30.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -14,10 +12,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of30.js] -for (var v of new StringIterator) { } class StringIterator { constructor() { this.return = 0; @@ -32,3 +31,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of31.errors.txt b/tests/baselines/reference/for-of31.errors.txt index 6d5f6e816b..bf38e0f500 100644 --- a/tests/baselines/reference/for-of31.errors.txt +++ b/tests/baselines/reference/for-of31.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/for-ofStatements/for-of31.ts(14,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. @@ -9,17 +9,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty ==== tests/cases/conformance/es6/for-ofStatements/for-of31.ts (1 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. -!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. -!!! error TS2322: Property 'done' is missing in type '{ value: string; }'. - class StringIterator { next() { return { @@ -31,4 +20,15 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type '{ value: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of31.js b/tests/baselines/reference/for-of31.js index a92e827b91..84e24bed5a 100644 --- a/tests/baselines/reference/for-of31.js +++ b/tests/baselines/reference/for-of31.js @@ -1,6 +1,4 @@ //// [for-of31.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,10 +10,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of31.js] -for (var v of new StringIterator) { } class StringIterator { next() { return { @@ -27,3 +26,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of33.errors.txt b/tests/baselines/reference/for-of33.errors.txt index ff1feacd7b..eba30ce9bf 100644 --- a/tests/baselines/reference/for-of33.errors.txt +++ b/tests/baselines/reference/for-of33.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/es6/for-ofStatements/for-of33.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of33.ts(4,5): error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of33.ts(2,5): error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of33.ts(7,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { [Symbol.iterator]() { ~~~~~~~~~~~~~~~~~ !!! error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. return v; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of33.js b/tests/baselines/reference/for-of33.js index b63aeedf77..e77d3cf5de 100644 --- a/tests/baselines/reference/for-of33.js +++ b/tests/baselines/reference/for-of33.js @@ -1,16 +1,16 @@ //// [for-of33.ts] -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return v; } -} +} + +for (var v of new StringIterator) { } //// [for-of33.js] -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return v; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of34.errors.txt b/tests/baselines/reference/for-of34.errors.txt index c378a8f5bb..2d53ecb0a2 100644 --- a/tests/baselines/reference/for-of34.errors.txt +++ b/tests/baselines/reference/for-of34.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/es6/for-ofStatements/for-of34.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of34.ts(2,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of34.ts(11,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { next() { ~~~~ @@ -17,4 +13,8 @@ tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'ne [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of34.js b/tests/baselines/reference/for-of34.js index f61f04ea95..2d9af61d1a 100644 --- a/tests/baselines/reference/for-of34.js +++ b/tests/baselines/reference/for-of34.js @@ -1,6 +1,4 @@ //// [for-of34.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return v; @@ -9,10 +7,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of34.js] -for (var v of new StringIterator) { } class StringIterator { next() { return v; @@ -21,3 +20,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of35.errors.txt b/tests/baselines/reference/for-of35.errors.txt index 58fb5056fd..6f14a24fb9 100644 --- a/tests/baselines/reference/for-of35.errors.txt +++ b/tests/baselines/reference/for-of35.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/es6/for-ofStatements/for-of35.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of35.ts(2,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of35.ts(14,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { next() { ~~~~ @@ -20,4 +16,8 @@ tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'ne [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of35.js b/tests/baselines/reference/for-of35.js index c7d7c5890d..a73f873d7c 100644 --- a/tests/baselines/reference/for-of35.js +++ b/tests/baselines/reference/for-of35.js @@ -1,6 +1,4 @@ //// [for-of35.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,10 +10,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of35.js] -for (var v of new StringIterator) { } class StringIterator { next() { return { @@ -27,3 +26,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/generatorTypeCheck14.types b/tests/baselines/reference/generatorTypeCheck14.types index 48565fe2be..28401e6856 100644 --- a/tests/baselines/reference/generatorTypeCheck14.types +++ b/tests/baselines/reference/generatorTypeCheck14.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck14.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator<0 | ""> yield 0; >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck15.types b/tests/baselines/reference/generatorTypeCheck15.types index eb14208009..3851d8e56a 100644 --- a/tests/baselines/reference/generatorTypeCheck15.types +++ b/tests/baselines/reference/generatorTypeCheck15.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck15.ts === function* g() { ->g : () => IterableIterator +>g : () => IterableIterator<""> return ""; >"" : "" diff --git a/tests/baselines/reference/generatorTypeCheck34.types b/tests/baselines/reference/generatorTypeCheck34.types index 2ca1117721..239c5ff149 100644 --- a/tests/baselines/reference/generatorTypeCheck34.types +++ b/tests/baselines/reference/generatorTypeCheck34.types @@ -7,7 +7,7 @@ function* g() { >0 : 0 function* g2() { ->g2 : () => IterableIterator +>g2 : () => IterableIterator<""> return ""; >"" : "" diff --git a/tests/baselines/reference/generatorTypeCheck62.js b/tests/baselines/reference/generatorTypeCheck62.js new file mode 100644 index 0000000000..3086472221 --- /dev/null +++ b/tests/baselines/reference/generatorTypeCheck62.js @@ -0,0 +1,63 @@ +//// [generatorTypeCheck62.ts] + +export interface StrategicState { + lastStrategyApplied?: string; +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { + return function*(state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + } +} + +export interface Strategy { + (a: T): IterableIterator; +} + +export interface State extends StrategicState { + foo: number; +} + +export const Nothing1: Strategy = strategy("Nothing", function*(state: State) { + return state; +}); + +export const Nothing2: Strategy = strategy("Nothing", function*(state: State) { + yield state; +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { + yield ; + return state; +}); + + +//// [generatorTypeCheck62.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function strategy(stratName, gen) { + return function* (state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + }; +} +exports.strategy = strategy; +exports.Nothing1 = strategy("Nothing", function* (state) { + return state; +}); +exports.Nothing2 = strategy("Nothing", function* (state) { + yield state; +}); +exports.Nothing3 = strategy("Nothing", function* (state) { + yield; + return state; +}); diff --git a/tests/baselines/reference/generatorTypeCheck62.symbols b/tests/baselines/reference/generatorTypeCheck62.symbols new file mode 100644 index 0000000000..580ab20884 --- /dev/null +++ b/tests/baselines/reference/generatorTypeCheck62.symbols @@ -0,0 +1,106 @@ +=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck62.ts === + +export interface StrategicState { +>StrategicState : Symbol(StrategicState, Decl(generatorTypeCheck62.ts, 0, 0)) + + lastStrategyApplied?: string; +>lastStrategyApplied : Symbol(StrategicState.lastStrategyApplied, Decl(generatorTypeCheck62.ts, 1, 33)) +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { +>strategy : Symbol(strategy, Decl(generatorTypeCheck62.ts, 3, 1)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 5, 25)) +>StrategicState : Symbol(StrategicState, Decl(generatorTypeCheck62.ts, 0, 0)) +>stratName : Symbol(stratName, Decl(generatorTypeCheck62.ts, 5, 51)) +>gen : Symbol(gen, Decl(generatorTypeCheck62.ts, 5, 69)) +>a : Symbol(a, Decl(generatorTypeCheck62.ts, 5, 76)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 5, 25)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 5, 25)) +>a : Symbol(a, Decl(generatorTypeCheck62.ts, 5, 120)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 5, 25)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 5, 25)) + + return function*(state) { +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 6, 21)) + + for (const next of gen(state)) { +>next : Symbol(next, Decl(generatorTypeCheck62.ts, 7, 18)) +>gen : Symbol(gen, Decl(generatorTypeCheck62.ts, 5, 69)) +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 6, 21)) + + if (next) { +>next : Symbol(next, Decl(generatorTypeCheck62.ts, 7, 18)) + + next.lastStrategyApplied = stratName; +>next.lastStrategyApplied : Symbol(StrategicState.lastStrategyApplied, Decl(generatorTypeCheck62.ts, 1, 33)) +>next : Symbol(next, Decl(generatorTypeCheck62.ts, 7, 18)) +>lastStrategyApplied : Symbol(StrategicState.lastStrategyApplied, Decl(generatorTypeCheck62.ts, 1, 33)) +>stratName : Symbol(stratName, Decl(generatorTypeCheck62.ts, 5, 51)) + } + yield next; +>next : Symbol(next, Decl(generatorTypeCheck62.ts, 7, 18)) + } + } +} + +export interface Strategy { +>Strategy : Symbol(Strategy, Decl(generatorTypeCheck62.ts, 14, 1)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 16, 26)) + + (a: T): IterableIterator; +>a : Symbol(a, Decl(generatorTypeCheck62.ts, 17, 5)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 16, 26)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(generatorTypeCheck62.ts, 16, 26)) +} + +export interface State extends StrategicState { +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) +>StrategicState : Symbol(StrategicState, Decl(generatorTypeCheck62.ts, 0, 0)) + + foo: number; +>foo : Symbol(State.foo, Decl(generatorTypeCheck62.ts, 20, 47)) +} + +export const Nothing1: Strategy = strategy("Nothing", function*(state: State) { +>Nothing1 : Symbol(Nothing1, Decl(generatorTypeCheck62.ts, 24, 12)) +>Strategy : Symbol(Strategy, Decl(generatorTypeCheck62.ts, 14, 1)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) +>strategy : Symbol(strategy, Decl(generatorTypeCheck62.ts, 3, 1)) +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 24, 71)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) + + return state; +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 24, 71)) + +}); + +export const Nothing2: Strategy = strategy("Nothing", function*(state: State) { +>Nothing2 : Symbol(Nothing2, Decl(generatorTypeCheck62.ts, 28, 12)) +>Strategy : Symbol(Strategy, Decl(generatorTypeCheck62.ts, 14, 1)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) +>strategy : Symbol(strategy, Decl(generatorTypeCheck62.ts, 3, 1)) +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 28, 71)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) + + yield state; +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 28, 71)) + +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { +>Nothing3 : Symbol(Nothing3, Decl(generatorTypeCheck62.ts, 32, 12)) +>Strategy : Symbol(Strategy, Decl(generatorTypeCheck62.ts, 14, 1)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) +>strategy : Symbol(strategy, Decl(generatorTypeCheck62.ts, 3, 1)) +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 32, 72)) +>State : Symbol(State, Decl(generatorTypeCheck62.ts, 18, 1)) + + yield ; + return state; +>state : Symbol(state, Decl(generatorTypeCheck62.ts, 32, 72)) + +}); + diff --git a/tests/baselines/reference/generatorTypeCheck62.types b/tests/baselines/reference/generatorTypeCheck62.types new file mode 100644 index 0000000000..289d33dc7d --- /dev/null +++ b/tests/baselines/reference/generatorTypeCheck62.types @@ -0,0 +1,122 @@ +=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck62.ts === + +export interface StrategicState { +>StrategicState : StrategicState + + lastStrategyApplied?: string; +>lastStrategyApplied : string +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { +>strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator +>T : T +>StrategicState : StrategicState +>stratName : string +>gen : (a: T) => IterableIterator +>a : T +>T : T +>IterableIterator : IterableIterator +>T : T +>a : T +>T : T +>IterableIterator : IterableIterator +>T : T + + return function*(state) { +>function*(state) { for (const next of gen(state)) { if (next) { next.lastStrategyApplied = stratName; } yield next; } } : (state: T) => IterableIterator +>state : T + + for (const next of gen(state)) { +>next : T +>gen(state) : IterableIterator +>gen : (a: T) => IterableIterator +>state : T + + if (next) { +>next : T + + next.lastStrategyApplied = stratName; +>next.lastStrategyApplied = stratName : string +>next.lastStrategyApplied : string +>next : T +>lastStrategyApplied : string +>stratName : string + } + yield next; +>yield next : any +>next : T + } + } +} + +export interface Strategy { +>Strategy : Strategy +>T : T + + (a: T): IterableIterator; +>a : T +>T : T +>IterableIterator : IterableIterator +>T : T +} + +export interface State extends StrategicState { +>State : State +>StrategicState : StrategicState + + foo: number; +>foo : number +} + +export const Nothing1: Strategy = strategy("Nothing", function*(state: State) { +>Nothing1 : Strategy +>Strategy : Strategy +>State : State +>strategy("Nothing", function*(state: State) { return state;}) : (a: State) => IterableIterator +>strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator +>"Nothing" : "Nothing" +>function*(state: State) { return state;} : (state: State) => IterableIterator +>state : State +>State : State + + return state; +>state : State + +}); + +export const Nothing2: Strategy = strategy("Nothing", function*(state: State) { +>Nothing2 : Strategy +>Strategy : Strategy +>State : State +>strategy("Nothing", function*(state: State) { yield state;}) : (a: State) => IterableIterator +>strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator +>"Nothing" : "Nothing" +>function*(state: State) { yield state;} : (state: State) => IterableIterator +>state : State +>State : State + + yield state; +>yield state : any +>state : State + +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { +>Nothing3 : Strategy +>Strategy : Strategy +>State : State +>strategy("Nothing", function* (state: State) { yield ; return state;}) : (a: State) => IterableIterator +>strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator +>"Nothing" : "Nothing" +>function* (state: State) { yield ; return state;} : (state: State) => IterableIterator +>state : State +>State : State + + yield ; +>yield : any + + return state; +>state : State + +}); + diff --git a/tests/baselines/reference/generatorTypeCheck63.errors.txt b/tests/baselines/reference/generatorTypeCheck63.errors.txt new file mode 100644 index 0000000000..46e722a0dd --- /dev/null +++ b/tests/baselines/reference/generatorTypeCheck63.errors.txt @@ -0,0 +1,63 @@ +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(25,14): error TS2322: Type '(a: State | 1) => IterableIterator' is not assignable to type 'Strategy'. + Type 'IterableIterator' is not assignable to type 'IterableIterator'. + Type 'State | 1' is not assignable to type 'State'. + Type '1' is not assignable to type 'State'. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(30,70): error TS7025: Generator implicitly has type 'IterableIterator' because it does not yield any values. Consider supplying a return type. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(33,42): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. + Type argument candidate 'State' is not a valid type argument because it is not a supertype of candidate '1'. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(37,14): error TS2322: Type '(a: State | 1) => IterableIterator' is not assignable to type 'Strategy'. + + +==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts (4 errors) ==== + + export interface StrategicState { + lastStrategyApplied?: string; + } + + export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { + return function*(state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + } + } + + export interface Strategy { + (a: T): IterableIterator; + } + + export interface State extends StrategicState { + foo: number; + } + + export const Nothing: Strategy = strategy("Nothing", function* (state: State) { + ~~~~~~~ +!!! error TS2322: Type '(a: State | 1) => IterableIterator' is not assignable to type 'Strategy'. +!!! error TS2322: Type 'IterableIterator' is not assignable to type 'IterableIterator'. +!!! error TS2322: Type 'State | 1' is not assignable to type 'State'. +!!! error TS2322: Type '1' is not assignable to type 'State'. + yield 1; + return state; + }); + + export const Nothing1: Strategy = strategy("Nothing", function* (state: State) { + ~ +!!! error TS7025: Generator implicitly has type 'IterableIterator' because it does not yield any values. Consider supplying a return type. + }); + + export const Nothing2: Strategy = strategy("Nothing", function* (state: State) { + ~~~~~~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'State' is not a valid type argument because it is not a supertype of candidate '1'. + return 1; + }); + + export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { + ~~~~~~~~ +!!! error TS2322: Type '(a: State | 1) => IterableIterator' is not assignable to type 'Strategy'. + yield state; + return 1; + }); \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck63.js b/tests/baselines/reference/generatorTypeCheck63.js new file mode 100644 index 0000000000..92cf2f867f --- /dev/null +++ b/tests/baselines/reference/generatorTypeCheck63.js @@ -0,0 +1,69 @@ +//// [generatorTypeCheck63.ts] + +export interface StrategicState { + lastStrategyApplied?: string; +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { + return function*(state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + } +} + +export interface Strategy { + (a: T): IterableIterator; +} + +export interface State extends StrategicState { + foo: number; +} + +export const Nothing: Strategy = strategy("Nothing", function* (state: State) { + yield 1; + return state; +}); + +export const Nothing1: Strategy = strategy("Nothing", function* (state: State) { +}); + +export const Nothing2: Strategy = strategy("Nothing", function* (state: State) { + return 1; +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { + yield state; + return 1; +}); + +//// [generatorTypeCheck63.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function strategy(stratName, gen) { + return function* (state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + }; +} +exports.strategy = strategy; +exports.Nothing = strategy("Nothing", function* (state) { + yield 1; + return state; +}); +exports.Nothing1 = strategy("Nothing", function* (state) { +}); +exports.Nothing2 = strategy("Nothing", function* (state) { + return 1; +}); +exports.Nothing3 = strategy("Nothing", function* (state) { + yield state; + return 1; +}); diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt index 1962576abc..d259a2d2e2 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(1,17): error TS2690: A class must be declared after its base class. -tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(2,20): error TS2690: A class must be declared after its base class. +tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(1,17): error TS2449: Class 'B' used before its declaration. +tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(2,20): error TS2449: Class 'C' used before its declaration. ==== tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts (2 errors) ==== class A extends B { } - ~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~ +!!! error TS2449: Class 'B' used before its declaration. class B extends C { } ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C' used before its declaration. class C { constructor(p: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReference.errors.txt b/tests/baselines/reference/indirectSelfReference.errors.txt index 3f7d3d47f1..0339dd8ed0 100644 --- a/tests/baselines/reference/indirectSelfReference.errors.txt +++ b/tests/baselines/reference/indirectSelfReference.errors.txt @@ -1,11 +1,14 @@ tests/cases/compiler/indirectSelfReference.ts(1,7): error TS2506: 'a' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/indirectSelfReference.ts(1,17): error TS2449: Class 'b' used before its declaration. tests/cases/compiler/indirectSelfReference.ts(2,7): error TS2506: 'b' is referenced directly or indirectly in its own base expression. -==== tests/cases/compiler/indirectSelfReference.ts (2 errors) ==== +==== tests/cases/compiler/indirectSelfReference.ts (3 errors) ==== class a extends b{ } ~ !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'b' used before its declaration. class b extends a{ } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt index 5a6aeed5de..d1cdbf1da5 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt @@ -1,11 +1,14 @@ tests/cases/compiler/indirectSelfReferenceGeneric.ts(1,7): error TS2506: 'a' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/indirectSelfReferenceGeneric.ts(1,20): error TS2449: Class 'b' used before its declaration. tests/cases/compiler/indirectSelfReferenceGeneric.ts(2,7): error TS2506: 'b' is referenced directly or indirectly in its own base expression. -==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (2 errors) ==== +==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (3 errors) ==== class a extends b { } ~ !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'b' used before its declaration. class b extends a { } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern1.js b/tests/baselines/reference/iterableArrayPattern1.js index b45ac92d1f..6061b9950d 100644 --- a/tests/baselines/reference/iterableArrayPattern1.js +++ b/tests/baselines/reference/iterableArrayPattern1.js @@ -1,5 +1,4 @@ //// [iterableArrayPattern1.ts] -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var [a, b] = new SymbolIterator; //// [iterableArrayPattern1.js] -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -26,3 +26,4 @@ class SymbolIterator { return this; } } +var [a, b] = new SymbolIterator; diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index 4921fc8ec9..b901b43b7b 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts === -var [a, b] = new SymbolIterator; ->a : Symbol(a, Decl(iterableArrayPattern1.ts, 0, 5)) ->b : Symbol(b, Decl(iterableArrayPattern1.ts, 0, 7)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern1.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern1.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) +>value : Symbol(value, Decl(iterableArrayPattern1.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) +>done : Symbol(done, Decl(iterableArrayPattern1.ts, 3, 28)) }; } @@ -27,6 +22,12 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) +>this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) } } + +var [a, b] = new SymbolIterator; +>a : Symbol(a, Decl(iterableArrayPattern1.ts, 13, 5)) +>b : Symbol(b, Decl(iterableArrayPattern1.ts, 13, 7)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) + diff --git a/tests/baselines/reference/iterableArrayPattern1.types b/tests/baselines/reference/iterableArrayPattern1.types index 816ce7ac6c..e7d307b2cb 100644 --- a/tests/baselines/reference/iterableArrayPattern1.types +++ b/tests/baselines/reference/iterableArrayPattern1.types @@ -1,10 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts === -var [a, b] = new SymbolIterator; ->a : symbol ->b : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -35,3 +29,10 @@ class SymbolIterator { >this : this } } + +var [a, b] = new SymbolIterator; +>a : symbol +>b : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iterableArrayPattern10.errors.txt b/tests/baselines/reference/iterableArrayPattern10.errors.txt index f06c4d7de1..f0b3e14c9f 100644 --- a/tests/baselines/reference/iterableArrayPattern10.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern10.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. Property '0' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts (1 errors) ==== - function fun([a, b]) { } - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. -!!! error TS2345: Property '0' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([a, b]) { } + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. +!!! error TS2345: Property '0' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern10.js b/tests/baselines/reference/iterableArrayPattern10.js index c8d37e3f89..530a21d6a1 100644 --- a/tests/baselines/reference/iterableArrayPattern10.js +++ b/tests/baselines/reference/iterableArrayPattern10.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern10.ts] -function fun([a, b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b]) { } +fun(new FooIterator); //// [iterableArrayPattern10.js] -function fun([a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern11.js b/tests/baselines/reference/iterableArrayPattern11.js index 85ed4ab971..92a9d9e200 100644 --- a/tests/baselines/reference/iterableArrayPattern11.js +++ b/tests/baselines/reference/iterableArrayPattern11.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern11.ts] -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,13 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); + //// [iterableArrayPattern11.js] -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +34,5 @@ class FooIterator { return this; } } +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index e1b3713f9d..36871283fb 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -1,36 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts === -function fun([a, b] = new FooIterator) { } ->fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern11.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern11.ts, 0, 16)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern11.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern11.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern11.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern11.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern11.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern11.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern11.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern11.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern11.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern11.ts, 5, 27)) }; } @@ -41,6 +31,17 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) } } + +function fun([a, b] = new FooIterator) { } +>fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern11.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern11.ts, 15, 16)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern11.types b/tests/baselines/reference/iterableArrayPattern11.types index 0acadd7cfc..d3fa43d2f1 100644 --- a/tests/baselines/reference/iterableArrayPattern11.types +++ b/tests/baselines/reference/iterableArrayPattern11.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts === -function fun([a, b] = new FooIterator) { } ->fun : ([a, b]?: FooIterator) => void ->a : Foo ->b : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, b]?: FooIterator) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -51,3 +38,17 @@ class FooIterator { >this : this } } + +function fun([a, b] = new FooIterator) { } +>fun : ([a, b]?: FooIterator) => void +>a : Foo +>b : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, b]?: FooIterator) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern12.js b/tests/baselines/reference/iterableArrayPattern12.js index 4856af9cb4..89694ffa0c 100644 --- a/tests/baselines/reference/iterableArrayPattern12.js +++ b/tests/baselines/reference/iterableArrayPattern12.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern12.ts] -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); //// [iterableArrayPattern12.js] -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index 4044544d17..cb87637087 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -1,36 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts === -function fun([a, ...b] = new FooIterator) { } ->fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern12.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern12.ts, 0, 16)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern12.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern12.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern12.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern12.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern12.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern12.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern12.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern12.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern12.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern12.ts, 5, 27)) }; } @@ -41,6 +31,17 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) } } + +function fun([a, ...b] = new FooIterator) { } +>fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern12.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern12.ts, 15, 16)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern12.types b/tests/baselines/reference/iterableArrayPattern12.types index c00e1daae8..3c50058b3e 100644 --- a/tests/baselines/reference/iterableArrayPattern12.types +++ b/tests/baselines/reference/iterableArrayPattern12.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts === -function fun([a, ...b] = new FooIterator) { } ->fun : ([a, ...b]?: FooIterator) => void ->a : Foo ->b : Foo[] ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, ...b]?: FooIterator) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -51,3 +38,17 @@ class FooIterator { >this : this } } + +function fun([a, ...b] = new FooIterator) { } +>fun : ([a, ...b]?: FooIterator) => void +>a : Foo +>b : Foo[] +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, ...b]?: FooIterator) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern13.js b/tests/baselines/reference/iterableArrayPattern13.js index 06f9901a85..efbce2bfd1 100644 --- a/tests/baselines/reference/iterableArrayPattern13.js +++ b/tests/baselines/reference/iterableArrayPattern13.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern13.ts] -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, ...b]) { } +fun(new FooIterator); //// [iterableArrayPattern13.js] -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, ...b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index c04d66fa6d..25241ab24b 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -1,35 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts === -function fun([a, ...b]) { } ->fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern13.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern13.ts, 0, 16)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern13.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern13.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern13.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern13.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern13.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern13.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern13.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern13.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern13.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern13.ts, 5, 27)) }; } @@ -40,6 +31,16 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) } } + +function fun([a, ...b]) { } +>fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern13.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern13.ts, 15, 16)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern13.types b/tests/baselines/reference/iterableArrayPattern13.types index 04dab57748..724a0795ef 100644 --- a/tests/baselines/reference/iterableArrayPattern13.types +++ b/tests/baselines/reference/iterableArrayPattern13.types @@ -1,15 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts === -function fun([a, ...b]) { } ->fun : ([a, ...b]: Iterable) => void ->a : any ->b : any[] - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, ...b]: Iterable) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -49,3 +38,15 @@ class FooIterator { >this : this } } + +function fun([a, ...b]) { } +>fun : ([a, ...b]: Iterable) => void +>a : any +>b : any[] + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, ...b]: Iterable) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern14.errors.txt b/tests/baselines/reference/iterableArrayPattern14.errors.txt index a14ddc4502..664f73e13a 100644 --- a/tests/baselines/reference/iterableArrayPattern14.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern14.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts (1 errors) ==== - function fun(...[a, ...b]) { } - ~~~~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, ...b]) { } + ~~~~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(new FooIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern14.js b/tests/baselines/reference/iterableArrayPattern14.js index a3595b0df0..bb1d416f4f 100644 --- a/tests/baselines/reference/iterableArrayPattern14.js +++ b/tests/baselines/reference/iterableArrayPattern14.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern14.ts] -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, ...b]) { } +fun(new FooIterator); //// [iterableArrayPattern14.js] -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, ...b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern15.errors.txt b/tests/baselines/reference/iterableArrayPattern15.errors.txt index bb2d1eb096..ce7559de94 100644 --- a/tests/baselines/reference/iterableArrayPattern15.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern15.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts (1 errors) ==== - function fun(...[a, b]: Bar[]) { } - ~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, b]: Bar[]) { } + ~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(...new FooIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern15.js b/tests/baselines/reference/iterableArrayPattern15.js index 1c2050129c..d14fd1b364 100644 --- a/tests/baselines/reference/iterableArrayPattern15.js +++ b/tests/baselines/reference/iterableArrayPattern15.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern15.ts] -function fun(...[a, b]: Bar[]) { } -fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, b]: Bar[]) { } +fun(...new FooIterator); //// [iterableArrayPattern15.js] -function fun(...[a, b]) { } -fun(...new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, b]) { } +fun(...new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern16.errors.txt b/tests/baselines/reference/iterableArrayPattern16.errors.txt index e03d0a799d..ba5531a0a5 100644 --- a/tests/baselines/reference/iterableArrayPattern16.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern16.errors.txt @@ -1,9 +1,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[Bar, Bar]'. Property '0' is missing in type 'FooIterator'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,12): error TS2449: Class 'FooIteratorIterator' used before its declaration. -==== tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts (2 errors) ==== +==== tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts (3 errors) ==== function fun(...[a, b]: [Bar, Bar][]) { } ~~~~~~ !!! error TS2501: A rest element cannot contain a binding pattern. @@ -11,6 +12,8 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,5): error ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[Bar, Bar]'. !!! error TS2345: Property '0' is missing in type 'FooIterator'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'FooIteratorIterator' used before its declaration. class Bar { x } class Foo extends Bar { y } class FooIterator { diff --git a/tests/baselines/reference/iterableArrayPattern17.errors.txt b/tests/baselines/reference/iterableArrayPattern17.errors.txt index 3cc04fadd1..d22d8580c7 100644 --- a/tests/baselines/reference/iterableArrayPattern17.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern17.errors.txt @@ -1,16 +1,9 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. -tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. Property 'x' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts (2 errors) ==== - function fun(...[a, b]: Bar[]) { } - ~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. -!!! error TS2345: Property 'x' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -24,4 +17,12 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, b]: Bar[]) { } + ~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. +!!! error TS2345: Property 'x' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern17.js b/tests/baselines/reference/iterableArrayPattern17.js index c6274aabcd..e9979380af 100644 --- a/tests/baselines/reference/iterableArrayPattern17.js +++ b/tests/baselines/reference/iterableArrayPattern17.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern17.ts] -function fun(...[a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, b]: Bar[]) { } +fun(new FooIterator); //// [iterableArrayPattern17.js] -function fun(...[a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern18.errors.txt b/tests/baselines/reference/iterableArrayPattern18.errors.txt index c6f8c5e28b..a3f8b6f840 100644 --- a/tests/baselines/reference/iterableArrayPattern18.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern18.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. Property 'length' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts (1 errors) ==== - function fun([a, b]: Bar[]) { } - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. -!!! error TS2345: Property 'length' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([a, b]: Bar[]) { } + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. +!!! error TS2345: Property 'length' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern18.js b/tests/baselines/reference/iterableArrayPattern18.js index e2016c4769..93b038cd32 100644 --- a/tests/baselines/reference/iterableArrayPattern18.js +++ b/tests/baselines/reference/iterableArrayPattern18.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern18.ts] -function fun([a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b]: Bar[]) { } +fun(new FooIterator); //// [iterableArrayPattern18.js] -function fun([a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern19.errors.txt b/tests/baselines/reference/iterableArrayPattern19.errors.txt index 3f8b550d28..f4a9fac0a0 100644 --- a/tests/baselines/reference/iterableArrayPattern19.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern19.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(2,5): error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(17,5): error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. Property 'length' is missing in type 'FooArrayIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts (1 errors) ==== - function fun([[a], b]: Bar[][]) { } - fun(new FooArrayIterator); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. -!!! error TS2345: Property 'length' is missing in type 'FooArrayIterator'. class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([[a], b]: Bar[][]) { } + fun(new FooArrayIterator); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. +!!! error TS2345: Property 'length' is missing in type 'FooArrayIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern19.js b/tests/baselines/reference/iterableArrayPattern19.js index bc3cf33afc..3c930957f4 100644 --- a/tests/baselines/reference/iterableArrayPattern19.js +++ b/tests/baselines/reference/iterableArrayPattern19.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern19.ts] -function fun([[a], b]: Bar[][]) { } -fun(new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,11 +12,12 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([[a], b]: Bar[][]) { } +fun(new FooArrayIterator); //// [iterableArrayPattern19.js] -function fun([[a], b]) { } -fun(new FooArrayIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooArrayIterator { return this; } } +function fun([[a], b]) { } +fun(new FooArrayIterator); diff --git a/tests/baselines/reference/iterableArrayPattern2.js b/tests/baselines/reference/iterableArrayPattern2.js index 7392db7d6b..aab7ad9ec6 100644 --- a/tests/baselines/reference/iterableArrayPattern2.js +++ b/tests/baselines/reference/iterableArrayPattern2.js @@ -1,5 +1,4 @@ //// [iterableArrayPattern2.ts] -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var [a, ...b] = new SymbolIterator; //// [iterableArrayPattern2.js] -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -26,3 +26,4 @@ class SymbolIterator { return this; } } +var [a, ...b] = new SymbolIterator; diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index 50d3352b9e..db700cdd57 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts === -var [a, ...b] = new SymbolIterator; ->a : Symbol(a, Decl(iterableArrayPattern2.ts, 0, 5)) ->b : Symbol(b, Decl(iterableArrayPattern2.ts, 0, 7)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern2.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern2.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) +>value : Symbol(value, Decl(iterableArrayPattern2.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) +>done : Symbol(done, Decl(iterableArrayPattern2.ts, 3, 28)) }; } @@ -27,6 +22,12 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) +>this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) } } + +var [a, ...b] = new SymbolIterator; +>a : Symbol(a, Decl(iterableArrayPattern2.ts, 13, 5)) +>b : Symbol(b, Decl(iterableArrayPattern2.ts, 13, 7)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) + diff --git a/tests/baselines/reference/iterableArrayPattern2.types b/tests/baselines/reference/iterableArrayPattern2.types index 63786a1d35..6a1bc9eb6f 100644 --- a/tests/baselines/reference/iterableArrayPattern2.types +++ b/tests/baselines/reference/iterableArrayPattern2.types @@ -1,10 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts === -var [a, ...b] = new SymbolIterator; ->a : symbol ->b : symbol[] ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -35,3 +29,10 @@ class SymbolIterator { >this : this } } + +var [a, ...b] = new SymbolIterator; +>a : symbol +>b : symbol[] +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iterableArrayPattern20.errors.txt b/tests/baselines/reference/iterableArrayPattern20.errors.txt index 4451a814bd..23f133238c 100644 --- a/tests/baselines/reference/iterableArrayPattern20.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern20.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts (1 errors) ==== - function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(...new FooArrayIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern20.js b/tests/baselines/reference/iterableArrayPattern20.js index 489f97a29f..a327cb3e47 100644 --- a/tests/baselines/reference/iterableArrayPattern20.js +++ b/tests/baselines/reference/iterableArrayPattern20.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern20.ts] -function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } -fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,11 +12,12 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } +fun(...new FooArrayIterator); //// [iterableArrayPattern20.js] -function fun(...[[a = new Foo], b = [new Foo]]) { } -fun(...new FooArrayIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooArrayIterator { return this; } } +function fun(...[[a = new Foo], b = [new Foo]]) { } +fun(...new FooArrayIterator); diff --git a/tests/baselines/reference/iterableArrayPattern3.js b/tests/baselines/reference/iterableArrayPattern3.js index 7136c6ab20..e29a67af73 100644 --- a/tests/baselines/reference/iterableArrayPattern3.js +++ b/tests/baselines/reference/iterableArrayPattern3.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern3.ts] -var a: Bar, b: Bar; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: Bar; +[a, b] = new FooIterator; //// [iterableArrayPattern3.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index 6cf0980138..a82c5f5e02 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -1,37 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts === -var a: Bar, b: Bar; ->a : Symbol(a, Decl(iterableArrayPattern3.ts, 0, 3)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->b : Symbol(b, Decl(iterableArrayPattern3.ts, 0, 11)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) - -[a, b] = new FooIterator; ->a : Symbol(a, Decl(iterableArrayPattern3.ts, 0, 3)) ->b : Symbol(b, Decl(iterableArrayPattern3.ts, 0, 11)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern3.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern3.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern3.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern3.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern3.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern3.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern3.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern3.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern3.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern3.ts, 5, 27)) }; } @@ -42,6 +31,18 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) } } + +var a: Bar, b: Bar; +>a : Symbol(a, Decl(iterableArrayPattern3.ts, 15, 3)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>b : Symbol(b, Decl(iterableArrayPattern3.ts, 15, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) + +[a, b] = new FooIterator; +>a : Symbol(a, Decl(iterableArrayPattern3.ts, 15, 3)) +>b : Symbol(b, Decl(iterableArrayPattern3.ts, 15, 11)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern3.types b/tests/baselines/reference/iterableArrayPattern3.types index a21e702526..b138c8629d 100644 --- a/tests/baselines/reference/iterableArrayPattern3.types +++ b/tests/baselines/reference/iterableArrayPattern3.types @@ -1,18 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts === -var a: Bar, b: Bar; ->a : Bar ->Bar : Bar ->b : Bar ->Bar : Bar - -[a, b] = new FooIterator; ->[a, b] = new FooIterator : FooIterator ->[a, b] : [Bar, Bar] ->a : Bar ->b : Bar ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -52,3 +38,18 @@ class FooIterator { >this : this } } + +var a: Bar, b: Bar; +>a : Bar +>Bar : Bar +>b : Bar +>Bar : Bar + +[a, b] = new FooIterator; +>[a, b] = new FooIterator : FooIterator +>[a, b] : [Bar, Bar] +>a : Bar +>b : Bar +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern4.js b/tests/baselines/reference/iterableArrayPattern4.js index 6e60dadbd7..c53b6ef416 100644 --- a/tests/baselines/reference/iterableArrayPattern4.js +++ b/tests/baselines/reference/iterableArrayPattern4.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern4.ts] -var a: Bar, b: Bar[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: Bar[]; +[a, ...b] = new FooIterator //// [iterableArrayPattern4.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index 651c60cf08..6a3526a348 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -1,37 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts === -var a: Bar, b: Bar[]; ->a : Symbol(a, Decl(iterableArrayPattern4.ts, 0, 3)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->b : Symbol(b, Decl(iterableArrayPattern4.ts, 0, 11)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) - -[a, ...b] = new FooIterator; ->a : Symbol(a, Decl(iterableArrayPattern4.ts, 0, 3)) ->b : Symbol(b, Decl(iterableArrayPattern4.ts, 0, 11)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern4.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern4.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern4.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern4.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern4.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern4.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern4.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern4.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern4.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern4.ts, 5, 27)) }; } @@ -42,6 +31,18 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) } } + +var a: Bar, b: Bar[]; +>a : Symbol(a, Decl(iterableArrayPattern4.ts, 15, 3)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>b : Symbol(b, Decl(iterableArrayPattern4.ts, 15, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) + +[a, ...b] = new FooIterator +>a : Symbol(a, Decl(iterableArrayPattern4.ts, 15, 3)) +>b : Symbol(b, Decl(iterableArrayPattern4.ts, 15, 11)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern4.types b/tests/baselines/reference/iterableArrayPattern4.types index a3be411449..1024f4c967 100644 --- a/tests/baselines/reference/iterableArrayPattern4.types +++ b/tests/baselines/reference/iterableArrayPattern4.types @@ -1,19 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts === -var a: Bar, b: Bar[]; ->a : Bar ->Bar : Bar ->b : Bar[] ->Bar : Bar - -[a, ...b] = new FooIterator; ->[a, ...b] = new FooIterator : FooIterator ->[a, ...b] : Bar[] ->a : Bar ->...b : Bar ->b : Bar[] ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -53,3 +38,19 @@ class FooIterator { >this : this } } + +var a: Bar, b: Bar[]; +>a : Bar +>Bar : Bar +>b : Bar[] +>Bar : Bar + +[a, ...b] = new FooIterator +>[a, ...b] = new FooIterator : FooIterator +>[a, ...b] : Bar[] +>a : Bar +>...b : Bar +>b : Bar[] +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern5.errors.txt b/tests/baselines/reference/iterableArrayPattern5.errors.txt index ca540d805b..1bbbe268e6 100644 --- a/tests/baselines/reference/iterableArrayPattern5.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern5.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(2,5): error TS2322: Type 'Foo' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(17,5): error TS2322: Type 'Foo' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts (1 errors) ==== - var a: Bar, b: string; - [a, b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(2,5): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string; + [a, b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern5.js b/tests/baselines/reference/iterableArrayPattern5.js index 77e71cac6d..56ed70b137 100644 --- a/tests/baselines/reference/iterableArrayPattern5.js +++ b/tests/baselines/reference/iterableArrayPattern5.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern5.ts] -var a: Bar, b: string; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string; +[a, b] = new FooIterator; //// [iterableArrayPattern5.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern6.errors.txt b/tests/baselines/reference/iterableArrayPattern6.errors.txt index e0a546d154..3a20f1f52c 100644 --- a/tests/baselines/reference/iterableArrayPattern6.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern6.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(2,8): error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(17,8): error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. Type 'Foo' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts (1 errors) ==== - var a: Bar, b: string[]; - [a, ...b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. -!!! error TS2322: Type 'Foo' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(2,8): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string[]; + [a, ...b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. +!!! error TS2322: Type 'Foo' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern6.js b/tests/baselines/reference/iterableArrayPattern6.js index 8c797e819f..1053cced9c 100644 --- a/tests/baselines/reference/iterableArrayPattern6.js +++ b/tests/baselines/reference/iterableArrayPattern6.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern6.ts] -var a: Bar, b: string[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string[]; +[a, ...b] = new FooIterator; //// [iterableArrayPattern6.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern7.errors.txt b/tests/baselines/reference/iterableArrayPattern7.errors.txt index 997cc21f38..972de74039 100644 --- a/tests/baselines/reference/iterableArrayPattern7.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern7.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(2,5): error TS2322: Type 'Foo' is not assignable to type 'string[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(17,5): error TS2322: Type 'Foo' is not assignable to type 'string[]'. Property 'length' is missing in type 'Foo'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts (1 errors) ==== - var a: Bar, b: string[]; - [a, b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo' is not assignable to type 'string[]'. -!!! error TS2322: Property 'length' is missing in type 'Foo'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(2,5): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string[]; + [a, b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo' is not assignable to type 'string[]'. +!!! error TS2322: Property 'length' is missing in type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern7.js b/tests/baselines/reference/iterableArrayPattern7.js index 3f79e6bfba..74b25f1ec6 100644 --- a/tests/baselines/reference/iterableArrayPattern7.js +++ b/tests/baselines/reference/iterableArrayPattern7.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern7.ts] -var a: Bar, b: string[]; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string[]; +[a, b] = new FooIterator; //// [iterableArrayPattern7.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern8.errors.txt b/tests/baselines/reference/iterableArrayPattern8.errors.txt index c06e0c9543..94c6e9593e 100644 --- a/tests/baselines/reference/iterableArrayPattern8.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern8.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(2,8): error TS2322: Type 'Foo[]' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(17,8): error TS2322: Type 'Foo[]' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts (1 errors) ==== - var a: Bar, b: string; - [a, ...b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo[]' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(2,8): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string; + [a, ...b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo[]' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern8.js b/tests/baselines/reference/iterableArrayPattern8.js index dd1c76c1f5..b943953b15 100644 --- a/tests/baselines/reference/iterableArrayPattern8.js +++ b/tests/baselines/reference/iterableArrayPattern8.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern8.ts] -var a: Bar, b: string; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string; +[a, ...b] = new FooIterator; //// [iterableArrayPattern8.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iteratorSpreadInArray.js b/tests/baselines/reference/iteratorSpreadInArray.js index 8e25a2e7ec..0b64eb4b40 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.js +++ b/tests/baselines/reference/iteratorSpreadInArray.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; + //// [iteratorSpreadInArray.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +27,4 @@ class SymbolIterator { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index 7fc2d469ea..6d6656f0f7 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts === -var array = [...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) } } + +var array = [...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray.types b/tests/baselines/reference/iteratorSpreadInArray.types index 4b5a63e5d5..9d43fa57b0 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.types +++ b/tests/baselines/reference/iteratorSpreadInArray.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts === -var array = [...new SymbolIterator]; ->array : symbol[] ->[...new SymbolIterator] : symbol[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -36,3 +29,11 @@ class SymbolIterator { >this : this } } + +var array = [...new SymbolIterator]; +>array : symbol[] +>[...new SymbolIterator] : symbol[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray10.errors.txt b/tests/baselines/reference/iteratorSpreadInArray10.errors.txt index 90cde7d03b..28a878ac43 100644 --- a/tests/baselines/reference/iteratorSpreadInArray10.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray10.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts(1,17): error TS2489: An iterator must have a 'next()' method. +tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts(7,17): error TS2489: An iterator must have a 'next()' method. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2489: An iterator must have a 'next()' method. - class SymbolIterator { [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2489: An iterator must have a 'next()' method. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray10.js b/tests/baselines/reference/iteratorSpreadInArray10.js index 1004dbd7b3..196ca7c714 100644 --- a/tests/baselines/reference/iteratorSpreadInArray10.js +++ b/tests/baselines/reference/iteratorSpreadInArray10.js @@ -1,16 +1,16 @@ //// [iteratorSpreadInArray10.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray10.js] -var array = [...new SymbolIterator]; class SymbolIterator { [Symbol.iterator]() { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray2.js b/tests/baselines/reference/iteratorSpreadInArray2.js index aa4a1099a4..e766016389 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.js +++ b/tests/baselines/reference/iteratorSpreadInArray2.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray2.ts] -var array = [...new NumberIterator, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -25,10 +23,12 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new NumberIterator, ...new SymbolIterator]; + //// [iteratorSpreadInArray2.js] -var array = [...new NumberIterator, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -51,3 +51,4 @@ class NumberIterator { return this; } } +var array = [...new NumberIterator, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index 8d39834c17..6fd22547ee 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts === -var array = [...new NumberIterator, ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray2.ts, 0, 3)) ->NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray2.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray2.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 3, 28)) }; } @@ -27,22 +22,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) } } class NumberIterator { ->NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) +>NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) next() { ->next : Symbol(NumberIterator.next, Decl(iteratorSpreadInArray2.ts, 15, 22)) +>next : Symbol(NumberIterator.next, Decl(iteratorSpreadInArray2.ts, 13, 22)) return { value: 0, ->value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 17, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 15, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 18, 21)) +>done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 16, 21)) }; } @@ -53,6 +48,12 @@ class NumberIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) +>this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) } } + +var array = [...new NumberIterator, ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray2.ts, 26, 3)) +>NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray2.types b/tests/baselines/reference/iteratorSpreadInArray2.types index 19bf5eab00..440a2bebcf 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.types +++ b/tests/baselines/reference/iteratorSpreadInArray2.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts === -var array = [...new NumberIterator, ...new SymbolIterator]; ->array : (number | symbol)[] ->[...new NumberIterator, ...new SymbolIterator] : (number | symbol)[] ->...new NumberIterator : number ->new NumberIterator : NumberIterator ->NumberIterator : typeof NumberIterator ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -69,3 +59,14 @@ class NumberIterator { >this : this } } + +var array = [...new NumberIterator, ...new SymbolIterator]; +>array : (number | symbol)[] +>[...new NumberIterator, ...new SymbolIterator] : (number | symbol)[] +>...new NumberIterator : number +>new NumberIterator : NumberIterator +>NumberIterator : typeof NumberIterator +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray3.js b/tests/baselines/reference/iteratorSpreadInArray3.js index 1d468e4483..239a95020f 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.js +++ b/tests/baselines/reference/iteratorSpreadInArray3.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray3.ts] -var array = [...[0, 1], ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...[0, 1], ...new SymbolIterator]; //// [iteratorSpreadInArray3.js] -var array = [...[0, 1], ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [...[0, 1], ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index c110733dd6..ff6bc66e9d 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts === -var array = [...[0, 1], ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray3.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray3.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray3.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) } } + +var array = [...[0, 1], ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray3.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray3.types b/tests/baselines/reference/iteratorSpreadInArray3.types index 1fd29bb238..b4c8f36f6d 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.types +++ b/tests/baselines/reference/iteratorSpreadInArray3.types @@ -1,15 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts === -var array = [...[0, 1], ...new SymbolIterator]; ->array : (number | symbol)[] ->[...[0, 1], ...new SymbolIterator] : (number | symbol)[] ->...[0, 1] : number ->[0, 1] : number[] ->0 : 0 ->1 : 1 ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -40,3 +29,15 @@ class SymbolIterator { >this : this } } + +var array = [...[0, 1], ...new SymbolIterator]; +>array : (number | symbol)[] +>[...[0, 1], ...new SymbolIterator] : (number | symbol)[] +>...[0, 1] : number +>[0, 1] : number[] +>0 : 0 +>1 : 1 +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray4.js b/tests/baselines/reference/iteratorSpreadInArray4.js index 82a08bfa96..95443f760c 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.js +++ b/tests/baselines/reference/iteratorSpreadInArray4.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray4.ts] -var array = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [0, 1, ...new SymbolIterator]; //// [iteratorSpreadInArray4.js] -var array = [0, 1, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [0, 1, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index e1159ee0e9..16fa1c62c6 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts === -var array = [0, 1, ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray4.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray4.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray4.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) } } + +var array = [0, 1, ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray4.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray4.types b/tests/baselines/reference/iteratorSpreadInArray4.types index 6024e79dee..d473416113 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.types +++ b/tests/baselines/reference/iteratorSpreadInArray4.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts === -var array = [0, 1, ...new SymbolIterator]; ->array : (number | symbol)[] ->[0, 1, ...new SymbolIterator] : (number | symbol)[] ->0 : 0 ->1 : 1 ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -38,3 +29,13 @@ class SymbolIterator { >this : this } } + +var array = [0, 1, ...new SymbolIterator]; +>array : (number | symbol)[] +>[0, 1, ...new SymbolIterator] : (number | symbol)[] +>0 : 0 +>1 : 1 +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray5.errors.txt b/tests/baselines/reference/iteratorSpreadInArray5.errors.txt index 498cc7d48e..02049824c4 100644 --- a/tests/baselines/reference/iteratorSpreadInArray5.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray5.errors.txt @@ -1,15 +1,9 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(1,5): error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(14,5): error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. Type 'number | symbol' is not assignable to type 'number'. Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts (1 errors) ==== - var array: number[] = [0, 1, ...new SymbolIterator]; - ~~~~~ -!!! error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. -!!! error TS2322: Type 'number | symbol' is not assignable to type 'number'. -!!! error TS2322: Type 'symbol' is not assignable to type 'number'. - class SymbolIterator { next() { return { @@ -21,4 +15,10 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(1,5): error TS2322: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array: number[] = [0, 1, ...new SymbolIterator]; + ~~~~~ +!!! error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'number | symbol' is not assignable to type 'number'. +!!! error TS2322: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray5.js b/tests/baselines/reference/iteratorSpreadInArray5.js index 0aa158a5dc..ee0bf11676 100644 --- a/tests/baselines/reference/iteratorSpreadInArray5.js +++ b/tests/baselines/reference/iteratorSpreadInArray5.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray5.ts] -var array: number[] = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: number[] = [0, 1, ...new SymbolIterator]; //// [iteratorSpreadInArray5.js] -var array = [0, 1, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [0, 1, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 8148ce43de..e9b6954e6e 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,16 +1,9 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. Type 'symbol[]' is not assignable to type 'number[]'. Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts (1 errors) ==== - var array: number[] = [0, 1]; - array.concat([...new SymbolIterator]); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. -!!! error TS2345: Type 'symbol' is not assignable to type 'number'. - class SymbolIterator { next() { return { @@ -22,4 +15,11 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345 [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array: number[] = [0, 1]; + array.concat([...new SymbolIterator]); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. +!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2345: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray6.js b/tests/baselines/reference/iteratorSpreadInArray6.js index 02d1c435b8..36b5fcf5cf 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.js +++ b/tests/baselines/reference/iteratorSpreadInArray6.js @@ -1,7 +1,4 @@ //// [iteratorSpreadInArray6.ts] -var array: number[] = [0, 1]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,11 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: number[] = [0, 1]; +array.concat([...new SymbolIterator]); //// [iteratorSpreadInArray6.js] -var array = [0, 1]; -array.concat([...new SymbolIterator]); class SymbolIterator { next() { return { @@ -29,3 +27,5 @@ class SymbolIterator { return this; } } +var array = [0, 1]; +array.concat([...new SymbolIterator]); diff --git a/tests/baselines/reference/iteratorSpreadInArray7.js b/tests/baselines/reference/iteratorSpreadInArray7.js index 72a614ae4e..aa209609b2 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.js +++ b/tests/baselines/reference/iteratorSpreadInArray7.js @@ -1,7 +1,4 @@ //// [iteratorSpreadInArray7.ts] -var array: symbol[]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,11 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: symbol[]; +array.concat([...new SymbolIterator]); //// [iteratorSpreadInArray7.js] -var array; -array.concat([...new SymbolIterator]); class SymbolIterator { next() { return { @@ -29,3 +27,5 @@ class SymbolIterator { return this; } } +var array; +array.concat([...new SymbolIterator]); diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index 57774bcd7e..534741a62a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -1,26 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts === -var array: symbol[]; ->array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) - -array.concat([...new SymbolIterator]); ->array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray7.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray7.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 3, 28)) }; } @@ -31,6 +22,16 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) } } + +var array: symbol[]; +>array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 13, 3)) + +array.concat([...new SymbolIterator]); +>array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 13, 3)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray7.types b/tests/baselines/reference/iteratorSpreadInArray7.types index ef0e3898e0..b102c72486 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.types +++ b/tests/baselines/reference/iteratorSpreadInArray7.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts === -var array: symbol[]; ->array : symbol[] - -array.concat([...new SymbolIterator]); ->array.concat([...new SymbolIterator]) : symbol[] ->array.concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } ->array : symbol[] ->concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } ->[...new SymbolIterator] : symbol[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -42,3 +29,17 @@ class SymbolIterator { >this : this } } + +var array: symbol[]; +>array : symbol[] + +array.concat([...new SymbolIterator]); +>array.concat([...new SymbolIterator]) : symbol[] +>array.concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } +>array : symbol[] +>concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } +>[...new SymbolIterator] : symbol[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray8.errors.txt b/tests/baselines/reference/iteratorSpreadInArray8.errors.txt index 365bc8db9c..1f8c962942 100644 --- a/tests/baselines/reference/iteratorSpreadInArray8.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray8.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(1,17): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. +tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(10,17): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - class SymbolIterator { next() { return { @@ -13,4 +9,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(1,17): error TS2488 done: false }; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray8.js b/tests/baselines/reference/iteratorSpreadInArray8.js index 0837869912..c2a0becb0d 100644 --- a/tests/baselines/reference/iteratorSpreadInArray8.js +++ b/tests/baselines/reference/iteratorSpreadInArray8.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray8.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -8,10 +6,11 @@ class SymbolIterator { done: false }; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray8.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -20,3 +19,4 @@ class SymbolIterator { }; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt index 90b8bdbeb4..5f43bb4f5a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(13,17): error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => SymbolIterator' is not assignable to type '() => Iterator'. Type 'SymbolIterator' is not assignable to type 'Iterator'. @@ -9,17 +9,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. -!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. -!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'. - class SymbolIterator { next() { return { @@ -30,4 +19,15 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray9.js b/tests/baselines/reference/iteratorSpreadInArray9.js index ed0a9b4ebe..8b3a02e5e1 100644 --- a/tests/baselines/reference/iteratorSpreadInArray9.js +++ b/tests/baselines/reference/iteratorSpreadInArray9.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray9.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -11,10 +9,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray9.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -25,3 +24,4 @@ class SymbolIterator { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInCall.errors.txt b/tests/baselines/reference/iteratorSpreadInCall.errors.txt index 614153192d..d26f9ab644 100644 --- a/tests/baselines/reference/iteratorSpreadInCall.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: symbol) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(1,1): error TS2346: S [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall.js b/tests/baselines/reference/iteratorSpreadInCall.js index f3bf17c032..a4b17cfb5e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall.js +++ b/tests/baselines/reference/iteratorSpreadInCall.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall.ts] -foo(...new SymbolIterator); - function foo(s: symbol) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall.js] -foo(...new SymbolIterator); function foo(s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall10.errors.txt b/tests/baselines/reference/iteratorSpreadInCall10.errors.txt index 04d9045e86..bf478012c5 100644 --- a/tests/baselines/reference/iteratorSpreadInCall10.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall10.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -19,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall10.js b/tests/baselines/reference/iteratorSpreadInCall10.js index 14a08c9700..9fb1cf20a6 100644 --- a/tests/baselines/reference/iteratorSpreadInCall10.js +++ b/tests/baselines/reference/iteratorSpreadInCall10.js @@ -1,8 +1,5 @@ //// [iteratorSpreadInCall10.ts] -foo(...new SymbolIterator); - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall10.js] -foo(...new SymbolIterator); function foo(s) { return s[0]; } class SymbolIterator { next() { @@ -30,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall11.js b/tests/baselines/reference/iteratorSpreadInCall11.js index d01eb259ef..adfbb03d71 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.js +++ b/tests/baselines/reference/iteratorSpreadInCall11.js @@ -1,8 +1,5 @@ //// [iteratorSpreadInCall11.ts] -foo(...new SymbolIterator); - function foo(...s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall11.js] -foo(...new SymbolIterator); function foo(...s) { return s[0]; } class SymbolIterator { next() { @@ -30,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index 098a7b9b9c..b6db07942d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -1,28 +1,24 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts === -foo(...new SymbolIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 27)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) - function foo(...s: T[]) { return s[0] } ->foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 27)) ->T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 2, 13)) ->s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 2, 16)) ->T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 2, 13)) ->s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 2, 16)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 0)) +>T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 0, 13)) +>s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 0, 16)) +>T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 0, 13)) +>s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 0, 16)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall11.ts, 4, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall11.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 4, 28)) }; } @@ -33,6 +29,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) } } + +foo(...new SymbolIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall11.types b/tests/baselines/reference/iteratorSpreadInCall11.types index 5990b26df6..4a3d73d36d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.types +++ b/tests/baselines/reference/iteratorSpreadInCall11.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts === -foo(...new SymbolIterator); ->foo(...new SymbolIterator) : symbol ->foo : (...s: T[]) => T ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - function foo(...s: T[]) { return s[0] } >foo : (...s: T[]) => T >T : T @@ -45,3 +38,11 @@ class SymbolIterator { >this : this } } + +foo(...new SymbolIterator); +>foo(...new SymbolIterator) : symbol +>foo : (...s: T[]) => T +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall12.js b/tests/baselines/reference/iteratorSpreadInCall12.js index b138192826..ba8149e29d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.js +++ b/tests/baselines/reference/iteratorSpreadInCall12.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall12.ts] -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); //// [iteratorSpreadInCall12.js] -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); class Foo { constructor(...s) { } } @@ -58,3 +57,4 @@ class StringIterator { return this; } } +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index f989860f04..983ab8fcd9 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -1,31 +1,26 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 64)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) - class Foo { ->Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 64)) ->T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 2, 10)) +>Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 0)) +>T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 0, 10)) constructor(...s: T[]) { } ->s : Symbol(s, Decl(iteratorSpreadInCall12.ts, 3, 16)) ->T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 2, 10)) +>s : Symbol(s, Decl(iteratorSpreadInCall12.ts, 1, 16)) +>T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 0, 10)) } class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall12.ts, 6, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall12.ts, 4, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 6, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 7, 28)) }; } @@ -36,22 +31,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) } } class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) next() { ->next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall12.ts, 19, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall12.ts, 17, 22)) return { value: "", ->value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 21, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 19, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 22, 22)) +>done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 20, 22)) }; } @@ -62,6 +57,12 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) +>this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) } } + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); +>Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall12.types b/tests/baselines/reference/iteratorSpreadInCall12.types index b614fdde16..55986b5764 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.types +++ b/tests/baselines/reference/iteratorSpreadInCall12.types @@ -1,18 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo ->Foo : typeof Foo ->...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol ->[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator ->...[...new StringIterator] : string ->[...new StringIterator] : string[] ->...new StringIterator : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class Foo { >Foo : Foo >T : T @@ -82,3 +68,18 @@ class StringIterator { >this : this } } + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); +>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo +>Foo : typeof Foo +>...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol +>[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator +>...[...new StringIterator] : string +>[...new StringIterator] : string[] +>...new StringIterator : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall2.errors.txt b/tests/baselines/reference/iteratorSpreadInCall2.errors.txt index bd994ab37b..abf8fc71ed 100644 --- a/tests/baselines/reference/iteratorSpreadInCall2.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall2.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall2.js b/tests/baselines/reference/iteratorSpreadInCall2.js index 6c3517857d..e858a7cd72 100644 --- a/tests/baselines/reference/iteratorSpreadInCall2.js +++ b/tests/baselines/reference/iteratorSpreadInCall2.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall2.ts] -foo(...new SymbolIterator); - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall2.js] -foo(...new SymbolIterator); function foo(s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall3.js b/tests/baselines/reference/iteratorSpreadInCall3.js index b33ceae7bf..9dd0c23add 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.js +++ b/tests/baselines/reference/iteratorSpreadInCall3.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall3.ts] -foo(...new SymbolIterator); - function foo(...s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall3.js] -foo(...new SymbolIterator); function foo(...s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 8557b6c831..d8f414bcd7 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -1,25 +1,21 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts === -foo(...new SymbolIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 27)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) - function foo(...s: symbol[]) { } ->foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 27)) ->s : Symbol(s, Decl(iteratorSpreadInCall3.ts, 2, 13)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 0)) +>s : Symbol(s, Decl(iteratorSpreadInCall3.ts, 0, 13)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall3.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall3.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 4, 28)) }; } @@ -30,6 +26,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) } } + +foo(...new SymbolIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall3.types b/tests/baselines/reference/iteratorSpreadInCall3.types index 56b7f6db6d..fef9f7dcab 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.types +++ b/tests/baselines/reference/iteratorSpreadInCall3.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts === -foo(...new SymbolIterator); ->foo(...new SymbolIterator) : void ->foo : (...s: symbol[]) => void ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - function foo(...s: symbol[]) { } >foo : (...s: symbol[]) => void >s : symbol[] @@ -40,3 +33,11 @@ class SymbolIterator { >this : this } } + +foo(...new SymbolIterator); +>foo(...new SymbolIterator) : void +>foo : (...s: symbol[]) => void +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall4.errors.txt b/tests/baselines/reference/iteratorSpreadInCall4.errors.txt index 0e0a40a512..3beaf2ce65 100644 --- a/tests/baselines/reference/iteratorSpreadInCall4.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall4.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall4.js b/tests/baselines/reference/iteratorSpreadInCall4.js index 7819a1ba6f..a0d655c25a 100644 --- a/tests/baselines/reference/iteratorSpreadInCall4.js +++ b/tests/baselines/reference/iteratorSpreadInCall4.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall4.ts] -foo(...new SymbolIterator); - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall4.js] -foo(...new SymbolIterator); function foo(s1, ...s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall5.js b/tests/baselines/reference/iteratorSpreadInCall5.js index a4a30ee016..b17054363e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.js +++ b/tests/baselines/reference/iteratorSpreadInCall5.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall5.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | string)[]) { } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall5.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index 0ed608e058..81143b79f2 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -1,26 +1,21 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === -foo(...new SymbolIterator, ...new StringIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 50)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) - function foo(...s: (symbol | string)[]) { } ->foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 50)) ->s : Symbol(s, Decl(iteratorSpreadInCall5.ts, 2, 13)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 0)) +>s : Symbol(s, Decl(iteratorSpreadInCall5.ts, 0, 13)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall5.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall5.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 4, 28)) }; } @@ -31,22 +26,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) } } class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) next() { ->next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall5.ts, 16, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall5.ts, 14, 22)) return { value: "", ->value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 18, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 16, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 19, 22)) +>done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 17, 22)) }; } @@ -57,6 +52,12 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) +>this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) } } + +foo(...new SymbolIterator, ...new StringIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall5.types b/tests/baselines/reference/iteratorSpreadInCall5.types index 9542a76daf..a4f16829d5 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.types +++ b/tests/baselines/reference/iteratorSpreadInCall5.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === -foo(...new SymbolIterator, ...new StringIterator); ->foo(...new SymbolIterator, ...new StringIterator) : void ->foo : (...s: (string | symbol)[]) => void ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator ->...new StringIterator : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - function foo(...s: (symbol | string)[]) { } >foo : (...s: (string | symbol)[]) => void >s : (string | symbol)[] @@ -73,3 +63,14 @@ class StringIterator { >this : this } } + +foo(...new SymbolIterator, ...new StringIterator); +>foo(...new SymbolIterator, ...new StringIterator) : void +>foo : (...s: (string | symbol)[]) => void +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator +>...new StringIterator : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index 93aaec8c33..2c89c7bb49 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. +tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(28,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ==== - foo(...new SymbolIterator, ...new StringIterator); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -31,4 +27,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator, ...new StringIterator); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall6.js b/tests/baselines/reference/iteratorSpreadInCall6.js index 8ad60be911..161f420ce0 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.js +++ b/tests/baselines/reference/iteratorSpreadInCall6.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall6.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall6.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall7.errors.txt b/tests/baselines/reference/iteratorSpreadInCall7.errors.txt index 51cae1d72b..30096c90db 100644 --- a/tests/baselines/reference/iteratorSpreadInCall7.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall7.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(1,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(28,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts (1 errors) ==== - foo(...new SymbolIterator, ...new StringIterator); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -33,4 +28,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(1,1): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator, ...new StringIterator); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall7.js b/tests/baselines/reference/iteratorSpreadInCall7.js index 4a56b75d23..e7c354413d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall7.js +++ b/tests/baselines/reference/iteratorSpreadInCall7.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall7.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall7.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { return s[0]; } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall8.errors.txt b/tests/baselines/reference/iteratorSpreadInCall8.errors.txt index d7913458b6..5fd0b43ce5 100644 --- a/tests/baselines/reference/iteratorSpreadInCall8.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall8.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(1,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(31,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts (1 errors) ==== - new Foo(...new SymbolIterator, ...new StringIterator); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - class Foo { constructor(...s: T[]) { } } @@ -36,4 +31,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(1,5): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + new Foo(...new SymbolIterator, ...new StringIterator); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall8.js b/tests/baselines/reference/iteratorSpreadInCall8.js index 3871ff83bc..a591fd363a 100644 --- a/tests/baselines/reference/iteratorSpreadInCall8.js +++ b/tests/baselines/reference/iteratorSpreadInCall8.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall8.ts] -new Foo(...new SymbolIterator, ...new StringIterator); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall8.js] -new Foo(...new SymbolIterator, ...new StringIterator); class Foo { constructor(...s) { } } @@ -58,3 +57,4 @@ class StringIterator { return this; } } +new Foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall9.errors.txt b/tests/baselines/reference/iteratorSpreadInCall9.errors.txt index da2ee7f8ef..59854bd36a 100644 --- a/tests/baselines/reference/iteratorSpreadInCall9.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall9.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(1,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(31,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts (1 errors) ==== - new Foo(...new SymbolIterator, ...[...new StringIterator]); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - class Foo { constructor(...s: T[]) { } } @@ -36,4 +31,10 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(1,5): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + new Foo(...new SymbolIterator, ...[...new StringIterator]); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall9.js b/tests/baselines/reference/iteratorSpreadInCall9.js index da80c461b1..3f54728fd8 100644 --- a/tests/baselines/reference/iteratorSpreadInCall9.js +++ b/tests/baselines/reference/iteratorSpreadInCall9.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall9.ts] -new Foo(...new SymbolIterator, ...[...new StringIterator]); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...new SymbolIterator, ...[...new StringIterator]); + //// [iteratorSpreadInCall9.js] -new Foo(...new SymbolIterator, ...[...new StringIterator]); class Foo { constructor(...s) { } } @@ -58,3 +58,4 @@ class StringIterator { return this; } } +new Foo(...new SymbolIterator, ...[...new StringIterator]); diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForIn.js b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.js new file mode 100644 index 0000000000..c5f4319c74 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.js @@ -0,0 +1,13 @@ +//// [nonPrimitiveIndexingWithForIn.ts] +var a: object; + +for (var key in a) { + var value = a[key]; +} + + +//// [nonPrimitiveIndexingWithForIn.js] +var a; +for (var key in a) { + var value = a[key]; +} diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForIn.symbols b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.symbols new file mode 100644 index 0000000000..3cb4126954 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts === +var a: object; +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForIn.ts, 0, 3)) + +for (var key in a) { +>key : Symbol(key, Decl(nonPrimitiveIndexingWithForIn.ts, 2, 8)) +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForIn.ts, 0, 3)) + + var value = a[key]; +>value : Symbol(value, Decl(nonPrimitiveIndexingWithForIn.ts, 3, 7)) +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForIn.ts, 0, 3)) +>key : Symbol(key, Decl(nonPrimitiveIndexingWithForIn.ts, 2, 8)) +} + diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForIn.types b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.types new file mode 100644 index 0000000000..44e2b3f4d5 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForIn.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts === +var a: object; +>a : object + +for (var key in a) { +>key : string +>a : object + + var value = a[key]; +>value : any +>a[key] : any +>a : object +>key : string +} + diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt new file mode 100644 index 0000000000..f7f2ee3db1 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts(4,17): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts (1 errors) ==== + var a: object; + + for (var key in a) { + var value = a[key]; // error + ~~~~~~ +!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. + } + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.js b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.js new file mode 100644 index 0000000000..e105e5ba9b --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.js @@ -0,0 +1,13 @@ +//// [nonPrimitiveIndexingWithForInNoImplicitAny.ts] +var a: object; + +for (var key in a) { + var value = a[key]; // error +} + + +//// [nonPrimitiveIndexingWithForInNoImplicitAny.js] +var a; +for (var key in a) { + var value = a[key]; // error +} diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.js b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.js new file mode 100644 index 0000000000..ce575b2a4d --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.js @@ -0,0 +1,13 @@ +//// [nonPrimitiveIndexingWithForInSupressError.ts] +var a: object; + +for (var key in a) { + var value = a[key]; +} + + +//// [nonPrimitiveIndexingWithForInSupressError.js] +var a; +for (var key in a) { + var value = a[key]; +} diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.symbols b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.symbols new file mode 100644 index 0000000000..4e52e66b1c --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts === +var a: object; +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 0, 3)) + +for (var key in a) { +>key : Symbol(key, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 2, 8)) +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 0, 3)) + + var value = a[key]; +>value : Symbol(value, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 3, 7)) +>a : Symbol(a, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 0, 3)) +>key : Symbol(key, Decl(nonPrimitiveIndexingWithForInSupressError.ts, 2, 8)) +} + diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.types b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.types new file mode 100644 index 0000000000..3fafa40b59 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInSupressError.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts === +var a: object; +>a : object + +for (var key in a) { +>key : string +>a : object + + var value = a[key]; +>value : any +>a[key] : any +>a : object +>key : string +} + diff --git a/tests/baselines/reference/overrideBaseIntersectionMethod.js b/tests/baselines/reference/overrideBaseIntersectionMethod.js new file mode 100644 index 0000000000..26613f0746 --- /dev/null +++ b/tests/baselines/reference/overrideBaseIntersectionMethod.js @@ -0,0 +1,83 @@ +//// [overrideBaseIntersectionMethod.ts] + +// Repro from #14615 + +type Constructor = new (...args: any[]) => T; + +const WithLocation = >(Base: T) => class extends Base { + getLocation(): [number, number] { + const [x,y] = super.getLocation(); + return [this.x | x, this.y | y]; + } +} + +class Point { + constructor(public x: number, public y: number) { } + getLocation(): [number, number] { + return [0,0]; + } +} + +class Foo extends WithLocation(Point) { + calculate() { + return this.x + this.y; + } + getLocation() { + return super.getLocation() + } + whereAmI() { + return this.getLocation(); + } +} + + +//// [overrideBaseIntersectionMethod.js] +// Repro from #14615 +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var WithLocation = function (Base) { return (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + class_1.prototype.getLocation = function () { + var _a = _super.prototype.getLocation.call(this), x = _a[0], y = _a[1]; + return [this.x | x, this.y | y]; + }; + return class_1; +}(Base)); }; +var Point = (function () { + function Point(x, y) { + this.x = x; + this.y = y; + } + Point.prototype.getLocation = function () { + return [0, 0]; + }; + return Point; +}()); +var Foo = (function (_super) { + __extends(Foo, _super); + function Foo() { + return _super !== null && _super.apply(this, arguments) || this; + } + Foo.prototype.calculate = function () { + return this.x + this.y; + }; + Foo.prototype.getLocation = function () { + return _super.prototype.getLocation.call(this); + }; + Foo.prototype.whereAmI = function () { + return this.getLocation(); + }; + return Foo; +}(WithLocation(Point))); diff --git a/tests/baselines/reference/overrideBaseIntersectionMethod.symbols b/tests/baselines/reference/overrideBaseIntersectionMethod.symbols new file mode 100644 index 0000000000..45a8454340 --- /dev/null +++ b/tests/baselines/reference/overrideBaseIntersectionMethod.symbols @@ -0,0 +1,88 @@ +=== tests/cases/compiler/overrideBaseIntersectionMethod.ts === + +// Repro from #14615 + +type Constructor = new (...args: any[]) => T; +>Constructor : Symbol(Constructor, Decl(overrideBaseIntersectionMethod.ts, 0, 0)) +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 3, 17)) +>args : Symbol(args, Decl(overrideBaseIntersectionMethod.ts, 3, 27)) +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 3, 17)) + +const WithLocation = >(Base: T) => class extends Base { +>WithLocation : Symbol(WithLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 5)) +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 5, 22)) +>Constructor : Symbol(Constructor, Decl(overrideBaseIntersectionMethod.ts, 0, 0)) +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) +>Base : Symbol(Base, Decl(overrideBaseIntersectionMethod.ts, 5, 52)) +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 5, 22)) +>Base : Symbol(Base, Decl(overrideBaseIntersectionMethod.ts, 5, 52)) + + getLocation(): [number, number] { +>getLocation : Symbol((Anonymous class).getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84)) + + const [x,y] = super.getLocation(); +>x : Symbol(x, Decl(overrideBaseIntersectionMethod.ts, 7, 11)) +>y : Symbol(y, Decl(overrideBaseIntersectionMethod.ts, 7, 13)) +>super.getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) +>super : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) +>getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) + + return [this.x | x, this.y | y]; +>this.x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) +>this : Symbol((Anonymous class), Decl(overrideBaseIntersectionMethod.ts, 5, 63)) +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) +>x : Symbol(x, Decl(overrideBaseIntersectionMethod.ts, 7, 11)) +>this.y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) +>this : Symbol((Anonymous class), Decl(overrideBaseIntersectionMethod.ts, 5, 63)) +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) +>y : Symbol(y, Decl(overrideBaseIntersectionMethod.ts, 7, 13)) + } +} + +class Point { +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) + + constructor(public x: number, public y: number) { } +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) + + getLocation(): [number, number] { +>getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) + + return [0,0]; + } +} + +class Foo extends WithLocation(Point) { +>Foo : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) +>WithLocation : Symbol(WithLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 5)) +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) + + calculate() { +>calculate : Symbol(Foo.calculate, Decl(overrideBaseIntersectionMethod.ts, 19, 39)) + + return this.x + this.y; +>this.x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) +>this.y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) + } + getLocation() { +>getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) + + return super.getLocation() +>super.getLocation : Symbol(getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84), Decl(overrideBaseIntersectionMethod.ts, 13, 53)) +>getLocation : Symbol(getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84), Decl(overrideBaseIntersectionMethod.ts, 13, 53)) + } + whereAmI() { +>whereAmI : Symbol(Foo.whereAmI, Decl(overrideBaseIntersectionMethod.ts, 25, 3)) + + return this.getLocation(); +>this.getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) +>getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) + } +} + diff --git a/tests/baselines/reference/overrideBaseIntersectionMethod.types b/tests/baselines/reference/overrideBaseIntersectionMethod.types new file mode 100644 index 0000000000..3e31211bdb --- /dev/null +++ b/tests/baselines/reference/overrideBaseIntersectionMethod.types @@ -0,0 +1,102 @@ +=== tests/cases/compiler/overrideBaseIntersectionMethod.ts === + +// Repro from #14615 + +type Constructor = new (...args: any[]) => T; +>Constructor : Constructor +>T : T +>args : any[] +>T : T + +const WithLocation = >(Base: T) => class extends Base { +>WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>>(Base: T) => class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>T : T +>Constructor : Constructor +>Point : Point +>Base : T +>T : T +>class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>Base : Point + + getLocation(): [number, number] { +>getLocation : () => [number, number] + + const [x,y] = super.getLocation(); +>x : number +>y : number +>super.getLocation() : [number, number] +>super.getLocation : () => [number, number] +>super : Point +>getLocation : () => [number, number] + + return [this.x | x, this.y | y]; +>[this.x | x, this.y | y] : [number, number] +>this.x | x : number +>this.x : number +>this : this +>x : number +>x : number +>this.y | y : number +>this.y : number +>this : this +>y : number +>y : number + } +} + +class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + + getLocation(): [number, number] { +>getLocation : () => [number, number] + + return [0,0]; +>[0,0] : [number, number] +>0 : 0 +>0 : 0 + } +} + +class Foo extends WithLocation(Point) { +>Foo : Foo +>WithLocation(Point) : .(Anonymous class) & Point +>WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>Point : typeof Point + + calculate() { +>calculate : () => number + + return this.x + this.y; +>this.x + this.y : number +>this.x : number +>this : this +>x : number +>this.y : number +>this : this +>y : number + } + getLocation() { +>getLocation : () => [number, number] + + return super.getLocation() +>super.getLocation() : [number, number] +>super.getLocation : () => [number, number] +>super : .(Anonymous class) & Point +>getLocation : () => [number, number] + } + whereAmI() { +>whereAmI : () => [number, number] + + return this.getLocation(); +>this.getLocation() : [number, number] +>this.getLocation : () => [number, number] +>this : this +>getLocation : () => [number, number] + } +} + diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index d6199636e6..ae48cd79b5 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,33): error TS2449: Class 'TokenInfo' used before its declaration. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,36): error TS2304: Cannot find name 'string'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. @@ -342,7 +343,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -==== tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts (342 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts (343 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -472,6 +473,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error } export var tokenTable = new TokenInfo[]; + ~~~~~~~~~ +!!! error TS2449: Class 'TokenInfo' used before its declaration. ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. export var nodeTypeTable = new string[]; diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt new file mode 100644 index 0000000000..2945950068 --- /dev/null +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,1): error TS2449: Class 'Foo' used before its declaration. +tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,10): error TS2449: Class 'Foo' used before its declaration. + + +==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts (0 errors) ==== + import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); + export = Bar; + interface Bar { + foo: Foo; + } +==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts (2 errors) ==== + export = Foo; + ~~~~~~~~~~~~~ +!!! error TS2449: Class 'Foo' used before its declaration. + ~~~ +!!! error TS2449: Class 'Foo' used before its declaration. + class Foo { + constructor(public a: A) { } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt index dd44005047..95378c4c69 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_GlobalFile.ts(16,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(17,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(20,63): error TS2690: A class must be declared after its base class. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(20,77): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS2690: A class must be declared after its base class. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,83): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(64,55): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. @@ -30,14 +30,14 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } class privateClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. } export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error ~~~~~~~~~~~~~ !!! error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. } } diff --git a/tests/baselines/reference/recursiveBaseCheck3.errors.txt b/tests/baselines/reference/recursiveBaseCheck3.errors.txt index 97f7cadc3d..ba0ea669c5 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck3.errors.txt @@ -1,12 +1,15 @@ tests/cases/compiler/recursiveBaseCheck3.ts(1,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/recursiveBaseCheck3.ts(1,20): error TS2449: Class 'C' used before its declaration. tests/cases/compiler/recursiveBaseCheck3.ts(2,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' does not exist on type 'C<{}>'. -==== tests/cases/compiler/recursiveBaseCheck3.ts (3 errors) ==== +==== tests/cases/compiler/recursiveBaseCheck3.ts (4 errors) ==== class A extends C { } ~ !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'C' used before its declaration. class C extends A { } ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 704c39891e..616d5392c8 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -1,13 +1,13 @@ //// [recursiveClassInstantiationsWithDefaultConstructors.ts] -var a = new TypeScript2.MemberNameArray() module TypeScript2 { -export class MemberName { -public prefix: string = ""; + export class MemberName { + public prefix: string = ""; + } + export class MemberNameArray extends MemberName { + } } -export class MemberNameArray extends MemberName { -} -} - + +var a = new TypeScript2.MemberNameArray() //// [recursiveClassInstantiationsWithDefaultConstructors.js] var __extends = (this && this.__extends) || (function () { @@ -20,7 +20,6 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var a = new TypeScript2.MemberNameArray(); var TypeScript2; (function (TypeScript2) { var MemberName = (function () { @@ -39,3 +38,4 @@ var TypeScript2; }(MemberName)); TypeScript2.MemberNameArray = MemberNameArray; })(TypeScript2 || (TypeScript2 = {})); +var a = new TypeScript2.MemberNameArray(); diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols index c722d8ef8f..7d87f5ec91 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols @@ -1,22 +1,22 @@ === tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts === -var a = new TypeScript2.MemberNameArray() ->a : Symbol(a, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 3)) ->TypeScript2.MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) ->TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 41)) ->MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) - module TypeScript2 { ->TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 41)) +>TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 0)) -export class MemberName { ->MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 20)) + export class MemberName { +>MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 20)) -public prefix: string = ""; ->prefix : Symbol(MemberName.prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 2, 25)) -} -export class MemberNameArray extends MemberName { ->MemberNameArray : Symbol(MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) ->MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 20)) -} + public prefix: string = ""; +>prefix : Symbol(MemberName.prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 29)) + } + export class MemberNameArray extends MemberName { +>MemberNameArray : Symbol(MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) +>MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 20)) + } } +var a = new TypeScript2.MemberNameArray() +>a : Symbol(a, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 8, 3)) +>TypeScript2.MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) +>TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 0)) +>MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) + diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types index 3e74ba7f57..f1cf5894cd 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types @@ -1,4 +1,20 @@ === tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts === +module TypeScript2 { +>TypeScript2 : typeof TypeScript2 + + export class MemberName { +>MemberName : MemberName + + public prefix: string = ""; +>prefix : string +>"" : "" + } + export class MemberNameArray extends MemberName { +>MemberNameArray : MemberNameArray +>MemberName : MemberName + } +} + var a = new TypeScript2.MemberNameArray() >a : TypeScript2.MemberNameArray >new TypeScript2.MemberNameArray() : TypeScript2.MemberNameArray @@ -6,19 +22,3 @@ var a = new TypeScript2.MemberNameArray() >TypeScript2 : typeof TypeScript2 >MemberNameArray : typeof TypeScript2.MemberNameArray -module TypeScript2 { ->TypeScript2 : typeof TypeScript2 - -export class MemberName { ->MemberName : MemberName - -public prefix: string = ""; ->prefix : string ->"" : "" -} -export class MemberNameArray extends MemberName { ->MemberNameArray : MemberNameArray ->MemberName : MemberName -} -} - diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt index b9e650b644..bfb9a5127f 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(2,35): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(9,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(45,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(60,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(96,33): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(114,40): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(126,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(182,42): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(199,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(247,35): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(272,30): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(301,33): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(403,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(436,45): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(469,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(490,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(495,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(500,38): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(534,42): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(549,41): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(580,45): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(589,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(605,46): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42): error TS2690: A class must be declared after its base class. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(2,45): error TS2449: Class 'nitidus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(9,56): error TS2449: Class 'mixtus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(45,48): error TS2449: Class 'psilurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(60,44): error TS2449: Class 'jugularis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(96,44): error TS2449: Class 'aurata' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(114,48): error TS2449: Class 'gilbertii' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(126,43): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(182,54): error TS2449: Class 'falconeri' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(199,47): error TS2449: Class 'pygmaea' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(247,46): error TS2449: Class 'ciliolabrum' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(272,35): error TS2449: Class 'coludo' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(301,41): error TS2449: Class 'oreas' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(403,53): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(436,55): error TS2449: Class 'punicus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(469,52): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(490,42): error TS2449: Class 'portoricensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(495,50): error TS2449: Class 'pelurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(500,49): error TS2449: Class 'lasiurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(534,50): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(549,53): error TS2449: Class 'daphaenodon' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(580,54): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(589,52): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(605,55): error TS2449: Class 'psilurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Class 'lasiurus' used before its declaration. ==== tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts (24 errors) ==== module rionegrensis { export class caniventer extends Lanthanum.nitidus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'nitidus' used before its declaration. salomonseni() : caniventer { var x : caniventer; () => { var y = this; }; return x; } uchidai() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } raffrayana() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } @@ -36,8 +36,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 nayaur() : gabriellae.amicus { var x : gabriellae.amicus; () => { var y = this; }; return x; } } export class veraecrucis extends trivirgatus.mixtus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'mixtus' used before its declaration. naso() : panamensis.setulosus> { var x : panamensis.setulosus>; () => { var y = this; }; return x; } vancouverensis() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } africana() : argurus.gilbertii, sagitta.cinereus> { var x : argurus.gilbertii, sagitta.cinereus>; () => { var y = this; }; return x; } @@ -74,8 +74,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 porcellus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } } export class oralis extends caurinus.psilurus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'psilurus' used before its declaration. cepapi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } porteri() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } bindi() : caurinus.mahaganus> { var x : caurinus.mahaganus>; () => { var y = this; }; return x; } @@ -91,8 +91,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 eisentrauti() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } } export class sumatrana extends Lanthanum.jugularis { - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'jugularis' used before its declaration. wolffsohni() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } geata() : ruatanica.hector { var x : ruatanica.hector; () => { var y = this; }; return x; } awashensis() : petrophilus.minutilla { var x : petrophilus.minutilla; () => { var y = this; }; return x; } @@ -129,8 +129,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 olchonensis() : rendalli.crenulata { var x : rendalli.crenulata; () => { var y = this; }; return x; } } export class durangae extends dogramacii.aurata { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'aurata' used before its declaration. Californium() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } Flerovium() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } phrudus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } @@ -149,8 +149,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 anatolicus() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } } export class nitidus extends argurus.gilbertii { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'gilbertii' used before its declaration. granatensis() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } negligens() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } lewisi() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } @@ -163,8 +163,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 bicornis() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } } export class megalonyx extends caurinus.johorensis { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. phillipsii() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } melanogaster() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } elaphus() : nitidus { var x : nitidus; () => { var y = this; }; return x; } @@ -221,8 +221,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 biacensis() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } } export class crenulata extends trivirgatus.falconeri { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'falconeri' used before its declaration. salvanius() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } maritimus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } edax() : lutreolus.cor>, rionegrensis.caniventer> { var x : lutreolus.cor>, rionegrensis.caniventer>; () => { var y = this; }; return x; } @@ -240,8 +240,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 vallinus() : sagitta.sicarius { var x : sagitta.sicarius; () => { var y = this; }; return x; } } export class mixtus extends argurus.pygmaea> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'pygmaea' used before its declaration. ochrogaster() : dogramacii.aurata { var x : dogramacii.aurata; () => { var y = this; }; return x; } bryophilus() : macrorhinos.marmosurus>> { var x : macrorhinos.marmosurus>>; () => { var y = this; }; return x; } liechtensteini() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } @@ -290,8 +290,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module ruatanica { export class americanus extends imperfecta.ciliolabrum { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~ +!!! error TS2449: Class 'ciliolabrum' used before its declaration. nasoloi() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } mystacalis() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } fardoulisi() : trivirgatus.oconnelli { var x : trivirgatus.oconnelli; () => { var y = this; }; return x; } @@ -317,8 +317,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 export class beisa { } export class otion extends howi.coludo { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'coludo' used before its declaration. bonaerensis() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } dussumieri() : nigra.gracilis { var x : nigra.gracilis; () => { var y = this; }; return x; } osvaldoreigi() : julianae.albidens { var x : julianae.albidens; () => { var y = this; }; return x; } @@ -348,8 +348,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 coyhaiquensis() : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus> { var x : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus>; () => { var y = this; }; return x; } } export class thaeleri extends argurus.oreas { - ~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~ +!!! error TS2449: Class 'oreas' used before its declaration. coromandra() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } parvipes() : nigra.dolichurus { var x : nigra.dolichurus; () => { var y = this; }; return x; } sponsorius() : rionegrensis.veraecrucis, julianae.steerii> { var x : rionegrensis.veraecrucis, julianae.steerii>; () => { var y = this; }; return x; } @@ -452,8 +452,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module panglima { export class amphibius extends caurinus.johorensis, Lanthanum.jugularis> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. bottegi(): macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni> { var x: macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>; () => { var y = this; }; return x; } jerdoni(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } camtschatica(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } @@ -487,8 +487,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module minutus { export class himalayana extends lutreolus.punicus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'punicus' used before its declaration. simoni(): argurus.netscheri> { var x: argurus.netscheri>; () => { var y = this; }; return x; } lobata(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } rusticus(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } @@ -522,8 +522,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module howi { export class angulatus extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. pennatus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } } } @@ -545,22 +545,22 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module sagitta { export class walkeri extends minutus.portoricensis { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~ +!!! error TS2449: Class 'portoricensis' used before its declaration. maracajuensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } module minutus { export class inez extends samarensis.pelurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'pelurus' used before its declaration. vexillaris(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } module macrorhinos { export class konganensis extends imperfecta.lasiurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'lasiurus' used before its declaration. } } module panamensis { @@ -595,8 +595,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module samarensis { export class pelurus extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. Palladium(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } castanea(): argurus.netscheri, julianae.oralis> { var x: argurus.netscheri, julianae.oralis>; () => { var y = this; }; return x; } chamek(): argurus.pygmaea { var x: argurus.pygmaea; () => { var y = this; }; return x; } @@ -612,8 +612,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 olitor(): rionegrensis.veraecrucis { var x: rionegrensis.veraecrucis; () => { var y = this; }; return x; } } export class fuscus extends macrorhinos.daphaenodon { - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~ +!!! error TS2449: Class 'daphaenodon' used before its declaration. planifrons(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } badia(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } prymnolopha(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } @@ -645,8 +645,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module sagitta { export class leptoceros extends caurinus.johorensis> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. victus(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } hoplomyoides(): panglima.fundatus, nigra.gracilis> { var x: panglima.fundatus, nigra.gracilis>; () => { var y = this; }; return x; } gratiosus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } @@ -656,8 +656,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module daubentonii { export class nigricans extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. woosnami(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } } } @@ -674,8 +674,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module chrysaeolus { export class sarasinorum extends caurinus.psilurus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'psilurus' used before its declaration. belzebul(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } hinpoon(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } kandti(): quasiater.wattsi { var x: quasiater.wattsi; () => { var y = this; }; return x; } @@ -840,8 +840,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module gabriellae { export class klossii extends imperfecta.lasiurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'lasiurus' used before its declaration. } export class amicus { pirrensis(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt index b1dab90db3..a8e95fc5bd 100644 --- a/tests/baselines/reference/symbolProperty33.errors.txt +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/Symbols/symbolProperty33.ts(1,18): error TS2690: A class must be declared after its base class. +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(1,18): error TS2449: Class 'C2' used before its declaration. tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (2 errors) ==== class C1 extends C2 { ~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C2' used before its declaration. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt index 98a9875bd5..3ff62c12ad 100644 --- a/tests/baselines/reference/symbolProperty34.errors.txt +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/Symbols/symbolProperty34.ts(1,18): error TS2690: A class must be declared after its base class. +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(1,18): error TS2449: Class 'C2' used before its declaration. tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (2 errors) ==== class C1 extends C2 { ~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C2' used before its declaration. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index a4c1c44909..5918c273ce 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -1,8 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 23061360bc..38c4542b40 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -1,9 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false, - "noUnusedLocals": true - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + "noUnusedLocals": true /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 16535c7960..d948b64815 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -1,9 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false, - "jsx": "react" - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 133de87dc1..70870f296e 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -1,13 +1,57 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false - }, - "files": [ - "file0.st", - "file1.ts", - "file2.ts" - ] + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + }, + "files": [ + "file0.st", + "file1.ts", + "file2.ts" + ] } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 2ab8d9412e..3eabb0894f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -1,12 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false, - "lib": [ - "es5", - "es2015.promise" - ] - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index a4c1c44909..5918c273ce 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -1,8 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 5716902e02..b88ac604c1 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -1,12 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false, - "lib": [ - "es5", - "es2015.core" - ] - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 4fc209f9b9..db838e21d2 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -1,12 +1,52 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "sourceMap": false, - "types": [ - "jquery", - "mocha" - ] - } + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ + // "lib": [], /* Specify library files to be included in the compilation: */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + "types": ["jquery","mocha"] /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } } \ No newline at end of file diff --git a/tests/baselines/reference/tsxSfcReturnNull.js b/tests/baselines/reference/tsxSfcReturnNull.js new file mode 100644 index 0000000000..8a332a7057 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNull.js @@ -0,0 +1,24 @@ +//// [file.tsx] + +import React = require('react'); + +const Foo = (props: any) => null; + +function Greet(x: {name?: string}) { + return null; +} + +const foo = ; +const G = ; + +//// [file.jsx] +define(["require", "exports", "react"], function (require, exports, React) { + "use strict"; + exports.__esModule = true; + var Foo = function (props) { return null; }; + function Greet(x) { + return null; + } + var foo = ; + var G = ; +}); diff --git a/tests/baselines/reference/tsxSfcReturnNull.symbols b/tests/baselines/reference/tsxSfcReturnNull.symbols new file mode 100644 index 0000000000..483b7db6c5 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNull.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +const Foo = (props: any) => null; +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) +>props : Symbol(props, Decl(file.tsx, 3, 13)) + +function Greet(x: {name?: string}) { +>Greet : Symbol(Greet, Decl(file.tsx, 3, 33)) +>x : Symbol(x, Decl(file.tsx, 5, 15)) +>name : Symbol(name, Decl(file.tsx, 5, 19)) + + return null; +} + +const foo = ; +>foo : Symbol(foo, Decl(file.tsx, 9, 5)) +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) + +const G = ; +>G : Symbol(G, Decl(file.tsx, 10, 5)) +>Greet : Symbol(Greet, Decl(file.tsx, 3, 33)) + diff --git a/tests/baselines/reference/tsxSfcReturnNull.types b/tests/baselines/reference/tsxSfcReturnNull.types new file mode 100644 index 0000000000..edc346b03e --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNull.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +const Foo = (props: any) => null; +>Foo : (props: any) => any +>(props: any) => null : (props: any) => any +>props : any +>null : null + +function Greet(x: {name?: string}) { +>Greet : (x: { name?: string; }) => any +>x : { name?: string; } +>name : string + + return null; +>null : null +} + +const foo = ; +>foo : JSX.Element +> : JSX.Element +>Foo : (props: any) => any + +const G = ; +>G : JSX.Element +> : JSX.Element +>Greet : (x: { name?: string; }) => any + diff --git a/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.js b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.js new file mode 100644 index 0000000000..8a332a7057 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.js @@ -0,0 +1,24 @@ +//// [file.tsx] + +import React = require('react'); + +const Foo = (props: any) => null; + +function Greet(x: {name?: string}) { + return null; +} + +const foo = ; +const G = ; + +//// [file.jsx] +define(["require", "exports", "react"], function (require, exports, React) { + "use strict"; + exports.__esModule = true; + var Foo = function (props) { return null; }; + function Greet(x) { + return null; + } + var foo = ; + var G = ; +}); diff --git a/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.symbols b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.symbols new file mode 100644 index 0000000000..483b7db6c5 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +const Foo = (props: any) => null; +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) +>props : Symbol(props, Decl(file.tsx, 3, 13)) + +function Greet(x: {name?: string}) { +>Greet : Symbol(Greet, Decl(file.tsx, 3, 33)) +>x : Symbol(x, Decl(file.tsx, 5, 15)) +>name : Symbol(name, Decl(file.tsx, 5, 19)) + + return null; +} + +const foo = ; +>foo : Symbol(foo, Decl(file.tsx, 9, 5)) +>Foo : Symbol(Foo, Decl(file.tsx, 3, 5)) + +const G = ; +>G : Symbol(G, Decl(file.tsx, 10, 5)) +>Greet : Symbol(Greet, Decl(file.tsx, 3, 33)) + diff --git a/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.types b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.types new file mode 100644 index 0000000000..5268592b8d --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnNullStrictNullChecks.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +const Foo = (props: any) => null; +>Foo : (props: any) => null +>(props: any) => null : (props: any) => null +>props : any +>null : null + +function Greet(x: {name?: string}) { +>Greet : (x: { name?: string | undefined; }) => null +>x : { name?: string | undefined; } +>name : string | undefined + + return null; +>null : null +} + +const foo = ; +>foo : JSX.Element +> : JSX.Element +>Foo : (props: any) => null + +const G = ; +>G : JSX.Element +> : JSX.Element +>Greet : (x: { name?: string | undefined; }) => null + diff --git a/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.errors.txt b/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.errors.txt new file mode 100644 index 0000000000..127eb4b0d4 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/jsx/file.tsx(10,13): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements. +tests/cases/conformance/jsx/file.tsx(11,11): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements. + + +==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== + + import React = require('react'); + + const Foo = (props: any) => undefined; + function Greet(x: {name?: string}) { + return undefined; + } + + // Error + const foo = ; + ~~~~~~~ +!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements. + const G = ; + ~~~~~~~~~ +!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements. \ No newline at end of file diff --git a/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.js b/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.js new file mode 100644 index 0000000000..0fcaa2f168 --- /dev/null +++ b/tests/baselines/reference/tsxSfcReturnUndefinedStrictNullChecks.js @@ -0,0 +1,25 @@ +//// [file.tsx] + +import React = require('react'); + +const Foo = (props: any) => undefined; +function Greet(x: {name?: string}) { + return undefined; +} + +// Error +const foo = ; +const G = ; + +//// [file.jsx] +define(["require", "exports", "react"], function (require, exports, React) { + "use strict"; + exports.__esModule = true; + var Foo = function (props) { return undefined; }; + function Greet(x) { + return undefined; + } + // Error + var foo = ; + var G = ; +}); diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index d6e5666b55..f7a46c8438 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -1,7 +1,4 @@ //// [typeArgumentInferenceOrdering.ts] -function foo(f: { y: T }): T { return null } -var x = foo(new C()).x; // was Error that property x does not exist on type {} - class C { y: I; } @@ -13,13 +10,15 @@ interface I { interface Goo { p: string; } - + +function foo(f: { y: T }): T { return null } +var x = foo(new C()).x; // was Error that property x does not exist on type {} //// [typeArgumentInferenceOrdering.js] -function foo(f) { return null; } -var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { } return C; }()); +function foo(f) { return null; } +var x = foo(new C()).x; // was Error that property x does not exist on type {} diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols index 630aebcf18..0c01b4d8a5 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols @@ -1,39 +1,39 @@ === tests/cases/compiler/typeArgumentInferenceOrdering.ts === -function foo(f: { y: T }): T { return null } ->foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) ->f : Symbol(f, Decl(typeArgumentInferenceOrdering.ts, 0, 16)) ->y : Symbol(y, Decl(typeArgumentInferenceOrdering.ts, 0, 20)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) - -var x = foo(new C()).x; // was Error that property x does not exist on type {} ->x : Symbol(x, Decl(typeArgumentInferenceOrdering.ts, 1, 3)) ->foo(new C()).x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) ->foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) ->C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 1, 23)) ->x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) - class C { ->C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 1, 23)) +>C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) y: I; ->y : Symbol(C.y, Decl(typeArgumentInferenceOrdering.ts, 3, 9)) ->I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) +>y : Symbol(C.y, Decl(typeArgumentInferenceOrdering.ts, 0, 9)) +>I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 2, 1)) } interface I { ->I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) +>I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 2, 1)) x(): Goo; ->x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) ->Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) +>x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) +>Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 6, 1)) } interface Goo { ->Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) +>Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 6, 1)) p: string; ->p : Symbol(Goo.p, Decl(typeArgumentInferenceOrdering.ts, 11, 15)) +>p : Symbol(Goo.p, Decl(typeArgumentInferenceOrdering.ts, 8, 15)) } +function foo(f: { y: T }): T { return null } +>foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 10, 1)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) +>f : Symbol(f, Decl(typeArgumentInferenceOrdering.ts, 12, 16)) +>y : Symbol(y, Decl(typeArgumentInferenceOrdering.ts, 12, 20)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) + +var x = foo(new C()).x; // was Error that property x does not exist on type {} +>x : Symbol(x, Decl(typeArgumentInferenceOrdering.ts, 13, 3)) +>foo(new C()).x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) +>foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 10, 1)) +>C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) +>x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) + diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.types b/tests/baselines/reference/typeArgumentInferenceOrdering.types index 1bbeadcf4d..788ab2285a 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.types +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.types @@ -1,22 +1,4 @@ === tests/cases/compiler/typeArgumentInferenceOrdering.ts === -function foo(f: { y: T }): T { return null } ->foo : (f: { y: T; }) => T ->T : T ->f : { y: T; } ->y : T ->T : T ->T : T ->null : null - -var x = foo(new C()).x; // was Error that property x does not exist on type {} ->x : () => Goo ->foo(new C()).x : () => Goo ->foo(new C()) : I ->foo : (f: { y: T; }) => T ->new C() : C ->C : typeof C ->x : () => Goo - class C { >C : C @@ -40,3 +22,21 @@ interface Goo { >p : string } +function foo(f: { y: T }): T { return null } +>foo : (f: { y: T; }) => T +>T : T +>f : { y: T; } +>y : T +>T : T +>T : T +>null : null + +var x = foo(new C()).x; // was Error that property x does not exist on type {} +>x : () => Goo +>foo(new C()).x : () => Goo +>foo(new C()) : I +>foo : (f: { y: T; }) => T +>new C() : C +>C : typeof C +>x : () => Goo + diff --git a/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts new file mode 100644 index 0000000000..cf09163ed5 --- /dev/null +++ b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts @@ -0,0 +1,4 @@ +function f() { + new C2(); // OK +} +class C2 { } \ No newline at end of file diff --git a/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts new file mode 100644 index 0000000000..389c669e74 --- /dev/null +++ b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts @@ -0,0 +1,4 @@ +// @target: es6 +class C3 { + static intance = new C3(); // ok +} \ No newline at end of file diff --git a/tests/cases/compiler/deeplyNestedCheck.ts b/tests/cases/compiler/deeplyNestedCheck.ts new file mode 100644 index 0000000000..e95233af98 --- /dev/null +++ b/tests/cases/compiler/deeplyNestedCheck.ts @@ -0,0 +1,9 @@ +// Repro from #14794 + +interface DataSnapshot { + child(path: string): DataSnapshot; +} + +interface Snapshot extends DataSnapshot { + child(path: U): Snapshot; +} diff --git a/tests/cases/compiler/enumUsedBeforeDeclaration.ts b/tests/cases/compiler/enumUsedBeforeDeclaration.ts new file mode 100644 index 0000000000..98f5fca86f --- /dev/null +++ b/tests/cases/compiler/enumUsedBeforeDeclaration.ts @@ -0,0 +1,5 @@ +const v: Color = Color.Green; +const v2: ConstColor = ConstColor.Green; +enum Color { Red, Green, Blue } +const enum ConstColor { Red, Green, Blue } + diff --git a/tests/cases/compiler/overrideBaseIntersectionMethod.ts b/tests/cases/compiler/overrideBaseIntersectionMethod.ts new file mode 100644 index 0000000000..99cd4664bc --- /dev/null +++ b/tests/cases/compiler/overrideBaseIntersectionMethod.ts @@ -0,0 +1,31 @@ +// @strict: true + +// Repro from #14615 + +type Constructor = new (...args: any[]) => T; + +const WithLocation = >(Base: T) => class extends Base { + getLocation(): [number, number] { + const [x,y] = super.getLocation(); + return [this.x | x, this.y | y]; + } +} + +class Point { + constructor(public x: number, public y: number) { } + getLocation(): [number, number] { + return [0,0]; + } +} + +class Foo extends WithLocation(Point) { + calculate() { + return this.x + this.y; + } + getLocation() { + return super.getLocation() + } + whereAmI() { + return this.getLocation(); + } +} diff --git a/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts b/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts index 1f76e4e6b5..9f008cd2b1 100644 --- a/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts +++ b/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts @@ -1,8 +1,9 @@ -var a = new TypeScript2.MemberNameArray() module TypeScript2 { -export class MemberName { -public prefix: string = ""; -} -export class MemberNameArray extends MemberName { -} + export class MemberName { + public prefix: string = ""; + } + export class MemberNameArray extends MemberName { + } } + +var a = new TypeScript2.MemberNameArray() \ No newline at end of file diff --git a/tests/cases/compiler/typeArgumentInferenceOrdering.ts b/tests/cases/compiler/typeArgumentInferenceOrdering.ts index 6887f7455d..faa7b45a4a 100644 --- a/tests/cases/compiler/typeArgumentInferenceOrdering.ts +++ b/tests/cases/compiler/typeArgumentInferenceOrdering.ts @@ -1,6 +1,3 @@ -function foo(f: { y: T }): T { return null } -var x = foo(new C()).x; // was Error that property x does not exist on type {} - class C { y: I; } @@ -12,3 +9,6 @@ interface I { interface Goo { p: string; } + +function foo(f: { y: T }): T { return null } +var x = foo(new C()).x; // was Error that property x does not exist on type {} \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts index 7b3be0365e..7a4cd1a2e4 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts @@ -1,5 +1,4 @@ //@target: ES6 -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var [a, b] = new SymbolIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts index 35d05ef1f9..591cdd2b6a 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts index ed93b5175d..83ab94dece 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts index b7e763694e..079eb25df4 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts index f0b9b142f4..f4909547e2 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, ...b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts index c327efa3ec..976c514823 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, ...b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts index 21d632fd54..ecc686b634 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, b]: Bar[]) { } -fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, b]: Bar[]) { } +fun(...new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts index 90db0e5edb..b81114cab2 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, b]: Bar[]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts index e6e5ad617b..a03713037d 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b]: Bar[]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts index 8513dd0764..32024e83b1 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([[a], b]: Bar[][]) { } -fun(new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,4 +12,7 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([[a], b]: Bar[][]) { } +fun(new FooArrayIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts index 587f1f0b05..d5543c0aed 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts @@ -1,5 +1,4 @@ //@target: ES6 -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var [a, ...b] = new SymbolIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts index b5be67b393..6a0e912673 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } -fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,4 +12,7 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } +fun(...new FooArrayIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts index 31656b5661..ff63aa7417 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: Bar; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: Bar; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts index edd95be159..b5aef9003b 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: Bar[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: Bar[]; +[a, ...b] = new FooIterator \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts index b51d0f09d0..a3911b1f5e 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts index fc9395ed6a..057b9aeaff 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string[]; +[a, ...b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts index 85b2f2e54e..965b715767 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string[]; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string[]; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts index dd49205d6e..5638b4c49c 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string; +[a, ...b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of14.ts b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts index 84fbda4825..f79794d59d 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of14.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts @@ -1,9 +1,9 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable - class StringIterator { next() { return ""; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of15.ts b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts index 1973e7ff95..b2e788bdef 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of15.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { next() { return ""; @@ -9,4 +6,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of16.ts b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts index 8f7bd6d848..fe78bae2ae 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of16.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts @@ -1,9 +1,9 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of17.ts b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts index 431f066d47..b7270cbb81 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of17.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new NumberIterator) { } // Should succeed - class NumberIterator { next() { return { @@ -12,4 +9,7 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new NumberIterator) { } // Should succeed \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of18.ts b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts index 407ad7f0ed..647ae314b4 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of18.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should succeed - class StringIterator { next() { return { @@ -12,4 +9,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should succeed \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of19.ts b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts index ff80b2690e..be51d219dc 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of19.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (var v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (var v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of20.ts b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts index 615f514937..3aa537a9f6 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of20.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (let v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (let v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of21.ts b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts index 4e4621034e..ab1e6fff26 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of21.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (const v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of22.ts b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts index 10a96502cd..c9a8834079 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of22.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts @@ -1,9 +1,4 @@ //@target: ES6 -v; -for (var v of new FooIterator) { - -} - class Foo { } class FooIterator { next() { @@ -15,4 +10,9 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +v; +for (var v of new FooIterator) { + } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of23.ts b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts index 81227cd066..df73418107 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of23.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (const v of new FooIterator) { - const v = 0; // new scope -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + const v = 0; // new scope } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of25.ts b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts index a1698bd282..61e6a58ce3 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of25.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts @@ -1,9 +1,9 @@ //@target: ES6 -var x: any; -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return x; } -} \ No newline at end of file +} + +var x: any; +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of26.ts b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts index 0ab564a4f5..4414fdc159 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of26.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts @@ -1,7 +1,4 @@ //@target: ES6 -var x: any; -for (var v of new StringIterator) { } - class StringIterator { next() { return x; @@ -9,4 +6,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var x: any; +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of27.ts b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts index 8f2b84cbe1..f7244eed34 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of27.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts @@ -1,6 +1,6 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]: any; -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of28.ts b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts index 8c693193b0..e1b86f6135 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of28.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts @@ -1,9 +1,9 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next: any; [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of30.ts b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts index 03b97c2313..67e1e3da70 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of30.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts @@ -1,6 +1,4 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -14,4 +12,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of31.ts b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts index 307f9b7cd4..701fcb50ed 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of31.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts @@ -1,6 +1,4 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,4 +10,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of33.ts b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts index b73d2daee8..f0af5c4a40 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of33.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts @@ -1,9 +1,9 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return v; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of34.ts b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts index d00f5ccde2..63b8822399 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of34.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts @@ -1,7 +1,5 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { next() { return v; @@ -10,4 +8,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of35.ts b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts index 0d66ce39ed..ab6e26d6d6 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of35.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts @@ -1,7 +1,5 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -13,4 +11,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts index 4b4f3e8cc1..88a85a4b88 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts index f8549b82b7..56ff08e79f 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts @@ -1,8 +1,8 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts index 9db5d01087..e267386a50 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new NumberIterator, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -25,4 +23,6 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new NumberIterator, ...new SymbolIterator]; diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts index 174c97de7c..8ef12250ce 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...[0, 1], ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...[0, 1], ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts index 47c2e63370..ec9faa78fe 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [0, 1, ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts index e6a8041a96..d4df51739c 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array: number[] = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: number[] = [0, 1, ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts index 7495ca6aac..1d021ca612 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts @@ -1,7 +1,4 @@ //@target: ES6 -var array: number[] = [0, 1]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,4 +10,7 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: number[] = [0, 1]; +array.concat([...new SymbolIterator]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts index 12ca478c73..2f96507c09 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts @@ -1,7 +1,4 @@ //@target: ES6 -var array: symbol[]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,4 +10,7 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: symbol[]; +array.concat([...new SymbolIterator]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts index 0e2258aa5e..8cc56068f8 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -8,4 +6,6 @@ class SymbolIterator { done: false }; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts index 2b8d93c9cc..5bb80fd0c7 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -11,4 +9,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts index 85d07e5699..34f6a7eb8f 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: symbol) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts index bf8ad336fb..aeb9aabde5 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts @@ -1,8 +1,5 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts index 182e454cfc..795e9603be 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts @@ -1,8 +1,5 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(...s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts index a0bd1ede19..06bceec84f 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts index 4a8fd9ff38..e6d7277594 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts index b6e8fe0c86..0391dfdad0 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(...s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts index 2a73fd6f3c..f3747f2586 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts index c17c4156e6..53b0e66037 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | string)[]) { } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts index 2c6150f804..c48260e97e 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts index 56fb7936eb..6893cd9d8a 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts index e5b969456b..c81a475d7d 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...new SymbolIterator, ...new StringIterator); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts index 470f99844b..41ee21a564 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...new SymbolIterator, ...[...new StringIterator]); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...new SymbolIterator, ...[...new StringIterator]); diff --git a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck62.ts b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck62.ts new file mode 100644 index 0000000000..2f30fe9d90 --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck62.ts @@ -0,0 +1,40 @@ +// @module: commonjs +// @target: es6 +// @noImplicitAny: true + +export interface StrategicState { + lastStrategyApplied?: string; +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { + return function*(state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + } +} + +export interface Strategy { + (a: T): IterableIterator; +} + +export interface State extends StrategicState { + foo: number; +} + +export const Nothing1: Strategy = strategy("Nothing", function*(state: State) { + return state; +}); + +export const Nothing2: Strategy = strategy("Nothing", function*(state: State) { + yield state; +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { + yield ; + return state; +}); + \ No newline at end of file diff --git a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts new file mode 100644 index 0000000000..58411e409b --- /dev/null +++ b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts @@ -0,0 +1,43 @@ +// @module: commonjs +// @target: es6 +// @noImplicitAny: true + +export interface StrategicState { + lastStrategyApplied?: string; +} + +export function strategy(stratName: string, gen: (a: T) => IterableIterator): (a: T) => IterableIterator { + return function*(state) { + for (const next of gen(state)) { + if (next) { + next.lastStrategyApplied = stratName; + } + yield next; + } + } +} + +export interface Strategy { + (a: T): IterableIterator; +} + +export interface State extends StrategicState { + foo: number; +} + +export const Nothing: Strategy = strategy("Nothing", function* (state: State) { + yield 1; + return state; +}); + +export const Nothing1: Strategy = strategy("Nothing", function* (state: State) { +}); + +export const Nothing2: Strategy = strategy("Nothing", function* (state: State) { + return 1; +}); + +export const Nothing3: Strategy = strategy("Nothing", function* (state: State) { + yield state; + return 1; +}); \ No newline at end of file diff --git a/tests/cases/conformance/jsx/tsxSfcReturnNull.tsx b/tests/cases/conformance/jsx/tsxSfcReturnNull.tsx new file mode 100644 index 0000000000..436b361eaf --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSfcReturnNull.tsx @@ -0,0 +1,16 @@ +// @filename: file.tsx +// @jsx: preserve +// @module: amd +// @noLib: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +const Foo = (props: any) => null; + +function Greet(x: {name?: string}) { + return null; +} + +const foo = ; +const G = ; \ No newline at end of file diff --git a/tests/cases/conformance/jsx/tsxSfcReturnNullStrictNullChecks.tsx b/tests/cases/conformance/jsx/tsxSfcReturnNullStrictNullChecks.tsx new file mode 100644 index 0000000000..cbc7218698 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSfcReturnNullStrictNullChecks.tsx @@ -0,0 +1,17 @@ +// @filename: file.tsx +// @jsx: preserve +// @module: amd +// @noLib: true +// @strictNullChecks: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +const Foo = (props: any) => null; + +function Greet(x: {name?: string}) { + return null; +} + +const foo = ; +const G = ; \ No newline at end of file diff --git a/tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx b/tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx new file mode 100644 index 0000000000..cb0c6444e7 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx @@ -0,0 +1,17 @@ +// @filename: file.tsx +// @jsx: preserve +// @module: amd +// @noLib: true +// @strictNullChecks: true +// @libFiles: react.d.ts,lib.d.ts + +import React = require('react'); + +const Foo = (props: any) => undefined; +function Greet(x: {name?: string}) { + return undefined; +} + +// Error +const foo = ; +const G = ; \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts index 185641d080..b832d57855 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts @@ -1,5 +1,4 @@ //@target: ES5 -for (var v of new StringIterator) { } // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -12,4 +11,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts new file mode 100644 index 0000000000..2ec8cf83cb --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts @@ -0,0 +1,5 @@ +var a: object; + +for (var key in a) { + var value = a[key]; +} diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts new file mode 100644 index 0000000000..1050cdea49 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts @@ -0,0 +1,6 @@ +// @noImplicitAny: true +var a: object; + +for (var key in a) { + var value = a[key]; // error +} diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts new file mode 100644 index 0000000000..3f63faee60 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInSupressError.ts @@ -0,0 +1,7 @@ +// @noImplicitAny: true +// @suppressImplicitAnyIndexErrors: true +var a: object; + +for (var key in a) { + var value = a[key]; +} diff --git a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts index 98f94718f3..4cc3a72395 100644 --- a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts +++ b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts @@ -1,12 +1,12 @@ -var x: StringTree; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} - type StringTree = string | StringTreeCollection; class StringTreeCollectionBase { [n: number]: StringTree; } -class StringTreeCollection extends StringTreeCollectionBase { } \ No newline at end of file +class StringTreeCollection extends StringTreeCollectionBase { } + +var x: StringTree; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} \ No newline at end of file diff --git a/tests/cases/fourslash_old/callOrderDependence.ts b/tests/cases/fourslash_old/callOrderDependence.ts deleted file mode 100644 index 3e7100068f..0000000000 --- a/tests/cases/fourslash_old/callOrderDependence.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -/////**/ - -diagnostics.setEditValidation(IncrementalEditValidation.None); -edit.replace(0, 0, "function foo(bar) {\n b\n}\n"); -goTo.position(27); -FourSlash.currentTestState.getCompletionListAtCaret().entries - .forEach(entry => FourSlash.currentTestState.getCompletionEntryDetails(entry.name)); diff --git a/tests/cases/fourslash_old/chainedFunctionCallsErrorSpan.ts b/tests/cases/fourslash_old/chainedFunctionCallsErrorSpan.ts deleted file mode 100644 index e4a56c546b..0000000000 --- a/tests/cases/fourslash_old/chainedFunctionCallsErrorSpan.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// - -////'foo'.replace('o', '3')./*1*/replace/*2*/('f', 5); - -verify.errorExistsBetweenMarkers('1', '2'); diff --git a/tests/cases/fourslash_old/completionListGenericConstraintsNames.ts b/tests/cases/fourslash_old/completionListGenericConstraintsNames.ts deleted file mode 100644 index 92d288dcb2..0000000000 --- a/tests/cases/fourslash_old/completionListGenericConstraintsNames.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -////interface IBar { -////} -//// -////class BarWrapper { -//// private value: /*1*/; -//// public getValue(v: /*2*/T): /*3*/ { -//// } -////} -////function foo(p1: T, p2: /*21*/U) : /*22*/ { -//// var x : /*23*/ -////} -////class MethodTest { -//// public method(p1: T, p2: U, p3:/*31*/ M): Array { -//// return null; -//// } -////} - -goTo.eachMarker(() => { - verify.memberListContains("T"); - verify.memberListContains("U"); - verify.memberListContains("M"); - }); diff --git a/tests/cases/fourslash_old/completionListInTypedObjectLiterals.ts b/tests/cases/fourslash_old/completionListInTypedObjectLiterals.ts deleted file mode 100644 index ce9c34df64..0000000000 --- a/tests/cases/fourslash_old/completionListInTypedObjectLiterals.ts +++ /dev/null @@ -1,142 +0,0 @@ -/// - -////interface MyPoint { -//// x1: number; -//// y1: number; -////} -////var p1: MyPoint = { -//// /*1*/ -////}; -////var p2: MyPoint = { -//// /*2*/x1: 5, -//// /*3*/ -////}; -////var p3: MyPoint = { -//// x1: /*4*/ -////}; -////var p4: any = { -//// /*5*/ -////} -/////// Cast expressions -////var x = ({ -//// /*6*/x1: 0, -////}); -////// Call expression -////function bar(e: MyPoint) { } -////bar({ -//// /*7*/ -////}); -////// New Expression -////class bar2 { -//// constructor(e: MyPoint) { } -////} -//// -////new bar2({ -//// x1: 0, -//// /*8*/ -////}); -////interface Foo { -//// x: { a: number }; -////} -////var aaa: Foo; -////aaa = {/*9*/ -////aaa.x = { /*10*/ -////var bbb = { /*11*/ -////var bbb = { x: { /*12*/ -////var ccc: Foo = { func: () => ({ /*13*/ }) -////var ddd: Foo = { -//// -//// /*14*/ -////var p15: MyPoint = { -//// "x1": 5, -//// /*15*/ -////}; -////// return statements -////function foo(): MyPoint { -//// return { -//// /*16*/ }; -////} -////interface MyPointCreator { -//// create(): MyPoint; -////} -//// -////function getMyPointCreator(): MyPointCreator { -//// return { -//// create: () => { -//// return { -//// x1: 5, -//// /*17*/ -//// }; -//// }, -//// } -////} -//// var eee:Foo = { /*18*/ - -////interface Foo { -//// x: { a: number }; -////} -//// var fff:Foo = { x: { /*19*/ - -goTo.marker("1"); -verify.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("2"); -verify.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("3"); -verify.not.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("4"); -verify.not.memberListContains("x1"); -verify.not.memberListContains("y1"); - -goTo.marker("5"); -verify.completionListIsEmpty(); - -goTo.marker("6"); -verify.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("7"); -verify.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("8"); -verify.not.memberListContains("x1"); -verify.memberListContains("y1"); - -goTo.marker("11"); -verify.memberListContains("x"); -verify.memberListCount(1); - -goTo.marker("12"); -verify.memberListContains("a"); -verify.memberListCount(1); - -goTo.marker("13"); -verify.memberListCount(0); - -goTo.marker("14"); -verify.memberListContains("x"); -verify.memberListCount(1); - -goTo.marker("16"); -verify.memberListContains("x1"); -verify.memberListContains("y1"); -verify.memberListCount(2); - -goTo.marker("17"); -verify.not.memberListContains("x1"); -verify.memberListContains("y1"); -verify.memberListCount(1); - -goTo.marker("18"); -verify.memberListContains("x"); -verify.memberListCount(1); - -goTo.marker("19"); -verify.memberListContains("a"); -verify.memberListCount(1); \ No newline at end of file diff --git a/tests/cases/fourslash_old/constructorOverloadWithoutImplementation.ts b/tests/cases/fourslash_old/constructorOverloadWithoutImplementation.ts deleted file mode 100644 index 79af7af77b..0000000000 --- a/tests/cases/fourslash_old/constructorOverloadWithoutImplementation.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -////class C { -//// constructor(); -//// constructor(x); -//// /*1*/constructor/*2*/(x, y); -////} - -verify.errorExistsBetweenMarkers('1', '2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/constructorOverloadWithoutImplementation2.ts b/tests/cases/fourslash_old/constructorOverloadWithoutImplementation2.ts deleted file mode 100644 index 22ec5dd79c..0000000000 --- a/tests/cases/fourslash_old/constructorOverloadWithoutImplementation2.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -////class C { -//// constructor(); -//// constructor(x); -//// /*1*/foo/*2*/(x, y) { } -////} - -verify.errorExistsBetweenMarkers('1', '2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/exportEqualIncremental.ts b/tests/cases/fourslash_old/exportEqualIncremental.ts deleted file mode 100644 index ee6ed886a4..0000000000 --- a/tests/cases/fourslash_old/exportEqualIncremental.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////interface IPoint { -//// getDist(): number; -////} -////module Shapes { -//// export class Point implements /*1*/IPoint/*2*/ { -//// constructor (public x: number, public y: number) { } -//// getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } -//// static origin = new Point(0, 0); -//// } -////} -////var p: IPoint = new Shapes.Point(3, 4); -////var dist = p.getDist(); - -verify.numberOfErrorsInCurrentFile(0); -goTo.eof(); -edit.insertLine("export = Shapes"); -verify.numberOfErrorsInCurrentFile(1); -verify.errorExistsBetweenMarkers("1", "2"); diff --git a/tests/cases/fourslash_old/findReferences.ts b/tests/cases/fourslash_old/findReferences.ts deleted file mode 100644 index 71efcf1d14..0000000000 --- a/tests/cases/fourslash_old/findReferences.ts +++ /dev/null @@ -1,62 +0,0 @@ -/// - -////class [|{| "name" : "className" |}foo|] { -//// constructor() { -//// } -//// public get [|{| "name" : "barMethodName" |}bar|]() { -//// return 0; -//// } -//// static [|{| "name" : "staticMethodName" |}method|]() { } -////} -////var n: [|{| "name" : "varTypeName" |}foo|] = new [|{| "name" : "ctorInvocation" |}foo|](); -////var x = n.[|{| "name" : "barMethodInvocation" |}bar|](); -////[|{| "name" : "classNameMethodInvocation" |}foo|].[|{| "name" : "staticMethodInvocation" |}method|](); - -var foo1: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "className")[0]; -var bar1: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "barMethodName")[0]; -var method1: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "staticMethodName")[0]; -var foo2: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "varTypeName")[0]; -var foo3: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "ctorInvocation")[0]; -var bar2: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "barMethodInvocation")[0]; -var foo4: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "classNameMethodInvocation")[0]; -var method2: FourSlashInterface.Range = test.ranges().filter((range)=> range.marker.data.name === "staticMethodInvocation")[0]; - -goTo.marker('className'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); -verify.occurrencesAtPositionContains(foo4); - -goTo.marker('barMethodName'); -verify.occurrencesAtPositionContains(bar1); -verify.occurrencesAtPositionContains(bar2); - -goTo.marker('staticMethodName'); -verify.occurrencesAtPositionContains(method1); -verify.occurrencesAtPositionContains(method2); - -goTo.marker('varTypeName'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); -verify.occurrencesAtPositionContains(foo4); - -goTo.marker('ctorInvocation'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); -verify.occurrencesAtPositionContains(foo4); - -goTo.marker('barMethodInvocation'); -verify.occurrencesAtPositionContains(bar1); -verify.occurrencesAtPositionContains(bar2); - -goTo.marker('classNameMethodInvocation'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); -verify.occurrencesAtPositionContains(foo4); - -goTo.marker('staticMethodInvocation'); -verify.occurrencesAtPositionContains(method1); -verify.occurrencesAtPositionContains(method2); \ No newline at end of file diff --git a/tests/cases/fourslash_old/findReferences1.ts b/tests/cases/fourslash_old/findReferences1.ts deleted file mode 100644 index 3d06cacee2..0000000000 --- a/tests/cases/fourslash_old/findReferences1.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -//// interface I { -//// (): void; -//// } -//// -//// var i: I; -//// var [|{| "name" : "varName" |}o|]: Object; -//// [|{| "name" : "varName1" |}o|] = i; -//// i = [|{| "name" : "varName2" |}o|]; -//// -//// var a: { -//// (): void -//// } -//// [|{| "name" : "varName3" |}o|] = a; -//// a = [|{| "name" : "varName4" |}o|]; - -var varName: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "varName")[0]; -var varName1: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "varName1")[0]; -var varName2: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "varName2")[0]; -var varName3: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "varName3")[0]; -var varName4: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "varName4")[0]; - -goTo.marker('varName'); -verify.occurrencesAtPositionContains(varName1); -verify.occurrencesAtPositionContains(varName2); -verify.occurrencesAtPositionContains(varName3); -verify.occurrencesAtPositionContains(varName4); diff --git a/tests/cases/fourslash_old/findReferencesAliases1.ts b/tests/cases/fourslash_old/findReferencesAliases1.ts deleted file mode 100644 index 0bee382e2b..0000000000 --- a/tests/cases/fourslash_old/findReferencesAliases1.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////declare module mod { -//// class Customer { -//// constructor(name: string); -//// } -////} -////import [|{| "name" : "aliasName1" |}c|] = mod.Customer; -////[|{| "name" : "aliasName2" |}c|].prototype; - -var name1: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "aliasName1")[0]; -var name2: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "aliasName2")[0]; - -goTo.marker('aliasName1'); -verify.occurrencesAtPositionContains(name1); -verify.occurrencesAtPositionContains(name2); - -goTo.marker('aliasName2'); -verify.occurrencesAtPositionContains(name1); -verify.occurrencesAtPositionContains(name2); \ No newline at end of file diff --git a/tests/cases/fourslash_old/findReferencesModules1.ts b/tests/cases/fourslash_old/findReferencesModules1.ts deleted file mode 100644 index 5956bd3693..0000000000 --- a/tests/cases/fourslash_old/findReferencesModules1.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -////module [|{| "name" : "moduleName1" |}foo|] { -//// export class Point { -//// constructor(public x: number, public y: number) { } -//// } -////} -////var p: [|{| "name" : "moduleName2" |}foo|].Point = new [|{| "name" : "moduleName3" |}foo|].Point(1, 1); - -var foo1: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "moduleName1")[0]; -var foo2: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "moduleName2")[0]; -var foo3: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "moduleName3")[0]; - -goTo.marker('moduleName1'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); - -goTo.marker('moduleName2'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); - -goTo.marker('moduleName3'); -verify.occurrencesAtPositionContains(foo1); -verify.occurrencesAtPositionContains(foo2); -verify.occurrencesAtPositionContains(foo3); \ No newline at end of file diff --git a/tests/cases/fourslash_old/funduleDefinedInADifferentFile.ts b/tests/cases/fourslash_old/funduleDefinedInADifferentFile.ts deleted file mode 100644 index c605ca0077..0000000000 --- a/tests/cases/fourslash_old/funduleDefinedInADifferentFile.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -////function E() { } -////module E { -//// export interface I {} -//// export var value = 1; -////} - -////var x: E.I; -////var y/**/ = E.value; -goTo.marker(); -verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash_old/funduleDefinedInADifferentFile2.ts b/tests/cases/fourslash_old/funduleDefinedInADifferentFile2.ts deleted file mode 100644 index 5c7aff2bfc..0000000000 --- a/tests/cases/fourslash_old/funduleDefinedInADifferentFile2.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -// @Filename: f1.ts -////declare module "q" { -//// export = Q; -////} -////declare function Q(value: T): void; -////declare module Q { -//// -//// interface Deferred { -//// // promise: Promise; -//// resolve(value: T): void; -//// reject(reason: any): void; -//// notify(value: any): void; -//// makeNodeResolver(): (reason: any, value: T) => void; -//// } -//// -////export function defer(): Deferred; -////} - -// @Filename: f2.ts -/////// -////import q = require('q'); -////Q.defer/**/(); - - -goTo.marker(); -verify.completionListContains('defer'); -verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/genericIncrementalParse.ts b/tests/cases/fourslash_old/genericIncrementalParse.ts deleted file mode 100644 index 73c4c888b1..0000000000 --- a/tests/cases/fourslash_old/genericIncrementalParse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - - -//// class C { // it is error to reference T in constraint -//// constructor() { } -//// foo(a: T) { -//// } -//// } -//// -//// interface I1 { -//// a: number; -//// }; -//// -//// interface I2 { -//// a: number; -//// b: string; -//// } -//// -//// var x = new C< { a: number; }, { a: number; b: string; }>(); -//// var y = new C(); -//// /*1*/ - -verify.numberOfErrorsInCurrentFile(1); - -goTo.marker("1"); -edit.insert("var z = new C < I2"); -verify.numberOfErrorsInCurrentFile(2); - -edit.insert(",I1>()"); -verify.numberOfErrorsInCurrentFile(2); diff --git a/tests/cases/fourslash_old/genericStructuralTypeConstraint.ts b/tests/cases/fourslash_old/genericStructuralTypeConstraint.ts deleted file mode 100644 index 458aaaa580..0000000000 --- a/tests/cases/fourslash_old/genericStructuralTypeConstraint.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// - - -//// class C { // it is error to reference T in constraint -//// constructor() { } -//// foo(a: T) { -//// } -//// } -//// -//// interface I1 { -//// a: string;/*1*/ -//// }; -//// -//// interface I2 { -//// a: number; -//// b: string; -//// } -//// -//// var x = new C< { a: number; }, { a: number; b: string; }>(); -//// var y = new C(); -//// var z = new C() -//// /*2*/ - -goTo.marker("2"); -edit.insertLine(""); -// y fails due to a: string in I1, z fails due to I1 not being assignment compatible to I2 -verify.numberOfErrorsInCurrentFile(3); - -goTo.marker("1"); -edit.backspace(10); -edit.insertLine(""); -verify.numberOfErrorsInCurrentFile(2); -// y should be OK now member a is gone, z fails due to I1 not being assignment compatible to I2 - -edit.insert("a: number;"); -// y should be OK with member a the correct type, z still fails due to I1 not being assignment compatible to I2 -verify.numberOfErrorsInCurrentFile(2); diff --git a/tests/cases/fourslash_old/getTypeOfUnresolvedGenericExtension.ts b/tests/cases/fourslash_old/getTypeOfUnresolvedGenericExtension.ts deleted file mode 100644 index 0faf4cbb95..0000000000 --- a/tests/cases/fourslash_old/getTypeOfUnresolvedGenericExtension.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -//// class S18 extends S18< A[], { }[] > -//// { -//// } -//// (new S18(123))./**/S18 ; -//// - -goTo.marker(); -diagnostics.validateTypeAtCurrentPosition(); diff --git a/tests/cases/fourslash_old/overloadResolutionErrors.ts b/tests/cases/fourslash_old/overloadResolutionErrors.ts deleted file mode 100644 index ac3a4def8c..0000000000 --- a/tests/cases/fourslash_old/overloadResolutionErrors.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// - -// Tests that the error spans are correct for a signature mismatch - -/////*1*/'foo'.replace('o', '3')./*2*/replace/*3*/('f', 5)/*4*/; -//// -/////*5*/('foo'.replace('o', '3')./*55*/replace/*6*/)/*65*/('f', 5); -////var foo = { -//// fun: () => false, -//// fun2: function () { return true; } -////}; -/////*7*/foo./*8*/fun/*9*/(1); -/////*10*/foo./*11*/fun2/*12*/(1); -//// -////module M { -//// export class C { -//// constructor(x: number) { } -//// public method(x: string); -//// public method(x: number); -//// public method(x) { } -//// } -////} -////var c: M.C = new /*13*/M./*14*/C/*15*/(""); -/////*16*/c./*17*/method/*18*/(c); -/////*19*/(c./*195*/method/*20*/)/*21*/(c); - - -verify.errorExistsBetweenMarkers('2', '3'); -verify.errorExistsBetweenMarkers('8', '9'); -verify.errorExistsBetweenMarkers('11', '12'); -verify.errorExistsBetweenMarkers('14', '15'); -verify.errorExistsBetweenMarkers('17', '18'); -verify.not.errorExistsBetweenMarkers('1', '2'); -verify.not.errorExistsBetweenMarkers('3', '4'); -verify.not.errorExistsBetweenMarkers('7', '8'); -verify.not.errorExistsBetweenMarkers('10', '11'); -verify.not.errorExistsBetweenMarkers('13', '14'); -verify.not.errorExistsBetweenMarkers('16', '17'); diff --git a/tests/cases/fourslash_old/thisRefGotoDef.ts b/tests/cases/fourslash_old/thisRefGotoDef.ts deleted file mode 100644 index ba16a6aa31..0000000000 --- a/tests/cases/fourslash_old/thisRefGotoDef.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -//// class Greeter { -//// /*def*/element: HTMLElement; -//// span: HTMLElement; -//// timerToken: number; -//// constructor(element: HTMLElement) { -//// this.element/*ref*/ = element; -//// } -//// } - -verify.goToDefinition("ref", "def"); diff --git a/tslint.json b/tslint.json index 5e72aedf06..920f608790 100644 --- a/tslint.json +++ b/tslint.json @@ -1,4 +1,5 @@ { + "rulesDirectory": "built/local/tslint", "rules": { "no-bom": true, "class-name": true, @@ -49,5 +50,5 @@ "object-literal-surrounding-space": true, "no-type-assertion-whitespace": true, "no-in-operator": true - } + } }