diff --git a/Jakefile b/Jakefile index ca1ee20a3ce..7ac94edd2c1 100644 --- a/Jakefile +++ b/Jakefile @@ -574,7 +574,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { } colors = process.env.colors || process.env.color - colors = colors ? ' --no-colors ' : '' + colors = colors ? ' --no-colors ' : ' --colors '; tests = tests ? ' -g ' + tests : ''; reporter = process.env.reporter || process.env.r || 'dot'; // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3330003f681..3247b5ff1d1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3899,7 +3899,9 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineEmptyBlock(node.body) || !node.body) { + if (!node.body) { + // There can be no body when there are parse errors. Just emit an empty block + // in that case. write(" { }"); } else if (node.body.kind === SyntaxKind.Block) { @@ -3932,6 +3934,17 @@ module ts { } function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { + if (languageVersion < ScriptTarget.ES6) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + + // For es6 and higher we can emit the expression as is. + write(" "); + emit(body); + } + + function emitDownLevelExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { write(" {"); scopeEmitStart(node); @@ -3979,15 +3992,57 @@ module ts { } function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { + // If the body has no statements, and we know there's no code that would cause any + // prologue to be emitted, then just do a simple emit if the empty block. + if (body.statements.length === 0 && !anyParameterHasBindingPatternOrInitializer(node)) { + emitFunctionBodyWithNoStatements(node, body); + } + else { + emitFunctionBodyWithStatements(node, body); + } + } + + function anyParameterHasBindingPatternOrInitializer(func: FunctionLikeDeclaration) { + return forEach(func.parameters, hasBindingPatternOrInitializer); + } + + function hasBindingPatternOrInitializer(parameter: ParameterDeclaration) { + return parameter.initializer || isBindingPattern(parameter.name); + } + + function emitFunctionBodyWithNoStatements(node: FunctionLikeDeclaration, body: Block) { + var singleLine = isSingleLineEmptyBlock(node.body); + + write(" {"); + if (singleLine) { + write(" "); + } + else { + increaseIndent(); + writeLine(); + } + + emitLeadingCommentsOfPosition(body.statements.end); + + if (!singleLine) { + decreaseIndent(); + } + + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + } + + function emitFunctionBodyWithStatements(node: FunctionLikeDeclaration, body: Block) { write(" {"); scopeEmitStart(node); var outPos = writer.getTextPos(); + increaseIndent(); emitDetachedComments(body.statements); var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 309eac2b504..9dc8a475527 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2366,17 +2366,14 @@ module ts { } function parseTypeMemberSemicolon() { - // Try to parse out an explicit or implicit (ASI) semicolon for a type member. If we - // don't have one, then an appropriate error will be reported. - if (parseSemicolon()) { + // We allow type members to be separated by commas or (possibly ASI) semicolons. + // First check if it was a comma. If so, we're done with the member. + if (parseOptional(SyntaxKind.CommaToken)) { return; } - // If we don't have a semicolon, then the user may have written a comma instead - // accidently (pretty easy to do since commas are so prevalent as list separators). So - // just consume the comma and keep going. Note: we'll have already reported the error - // about the missing semicolon above. - parseOptional(SyntaxKind.CommaToken); + // Didn't have a comma. We must have a (possible ASI) semicolon. + parseSemicolon(); } function parseSignatureMember(kind: SyntaxKind): SignatureDeclaration { diff --git a/src/server/client.ts b/src/server/client.ts index 4cee592fb6c..c8e7f2fdcb1 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -229,6 +229,7 @@ module ts.server { kind: entry.kind, kindModifiers: entry.kindModifiers, matchKind: entry.matchKind, + isCaseSensitive: entry.isCaseSensitive, fileName: fileName, textSpan: ts.createTextSpanFromBounds(start, end) }; diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index a4541d2666d..23ef00d6b44 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -711,6 +711,11 @@ declare module ts.server.protocol { * exact, substring, or prefix. */ matchKind?: string; + + /** + * If this was a case sensitive or insensitive match. + */ + isCaseSensitive?: boolean; /** * Optional modifiers for the kind (such as 'public'). diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index d008cac80f7..b3f72d83cb3 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,35 +1,46 @@ module ts.NavigateTo { - type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }; - - enum MatchKind { - none = 0, - exact = 1, - substring = 2, - prefix = 3 - } - - export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{ - // Split search value in terms array - var terms = searchValue.split(" "); - - // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version - var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration }; + export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[] { + var patternMatcher = createPatternMatcher(searchValue); var rawItems: RawNavigateToItem[] = []; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); - var fileName = sourceFile.fileName; var declarations = sourceFile.getNamedDeclarations(); for (var i = 0, n = declarations.length; i < n; i++) { var declaration = declarations[i]; - // TODO(jfreeman): Skip this declaration if it has a computed name - var name = (declaration.name).text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== MatchKind.none) { - rawItems.push({ name, fileName, matchKind, declaration }); + var name = getDeclarationName(declaration); + if (name !== undefined) { + + // First do a quick check to see if the name of the declaration matches the + // last portion of the (possibly) dotted name they're searching for. + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); + + if (!matches) { + continue; + } + + // It was a match! If the pattern has dots in it, then also see if hte + // declaration container matches as well. + if (patternMatcher.patternContainsDots) { + var containers = getContainers(declaration); + if (!containers) { + return undefined; + } + + matches = patternMatcher.getMatches(containers, name); + + if (!matches) { + continue; + } + } + + var fileName = sourceFile.fileName; + var matchKind = bestMatchKind(matches); + rawItems.push({ name, fileName, matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration }); } } }); @@ -43,6 +54,129 @@ module ts.NavigateTo { return items; + function allMatchesAreCaseSensitive(matches: PatternMatch[]): boolean { + Debug.assert(matches.length > 0); + + // This is a case sensitive match, only if all the submatches were case sensitive. + for (var i = 0, n = matches.length; i < n; i++) { + if (!matches[i].isCaseSensitive) { + return false; + } + } + + return true; + } + + function getDeclarationName(declaration: Declaration): string { + var result = getTextOfIdentifierOrLiteral(declaration.name); + if (result !== undefined) { + return result; + } + + if (declaration.name.kind === SyntaxKind.ComputedPropertyName) { + var expr = (declaration.name).expression; + if (expr.kind === SyntaxKind.PropertyAccessExpression) { + return (expr).name.text; + } + + return getTextOfIdentifierOrLiteral(expr); + } + + return undefined; + } + + function getTextOfIdentifierOrLiteral(node: Node) { + if (node.kind === SyntaxKind.Identifier || + node.kind === SyntaxKind.StringLiteral || + node.kind === SyntaxKind.NumericLiteral) { + + return (node).text; + } + + return undefined; + } + + function tryAddSingleDeclarationName(declaration: Declaration, containers: string[]) { + if (declaration && declaration.name) { + var text = getTextOfIdentifierOrLiteral(declaration.name); + if (text !== undefined) { + containers.unshift(text); + } + else if (declaration.name.kind === SyntaxKind.ComputedPropertyName) { + return tryAddComputedPropertyName((declaration.name).expression, containers, /*includeLastPortion:*/ true); + } + else { + // Don't know how to add this. + return false + } + } + + return true; + } + + // Only added the names of computed properties if they're simple dotted expressions, like: + // + // [X.Y.Z]() { } + function tryAddComputedPropertyName(expression: Expression, containers: string[], includeLastPortion: boolean): boolean { + var text = getTextOfIdentifierOrLiteral(expression); + if (text !== undefined) { + if (includeLastPortion) { + containers.unshift(text); + } + return true; + } + + if (expression.kind === SyntaxKind.PropertyAccessExpression) { + var propertyAccess = expression; + if (includeLastPortion) { + containers.unshift(propertyAccess.name.text); + } + + return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion:*/ true); + } + + return false; + } + + function getContainers(declaration: Declaration) { + var containers: string[] = []; + + // First, if we started with a computed property name, then add all but the last + // portion into the container array. + if (declaration.name.kind === SyntaxKind.ComputedPropertyName) { + if (!tryAddComputedPropertyName((declaration.name).expression, containers, /*includeLastPortion:*/ false)) { + return undefined; + } + } + + // Now, walk up our containers, adding all their names to the container array. + declaration = getContainerNode(declaration); + + while (declaration) { + if (!tryAddSingleDeclarationName(declaration, containers)) { + return undefined; + } + + declaration = getContainerNode(declaration); + } + + return containers; + } + + function bestMatchKind(matches: PatternMatch[]) { + Debug.assert(matches.length > 0); + var bestMatchKind = PatternMatchKind.camelCase; + + for (var i = 0, n = matches.length; i < n; i++) { + var kind = matches[i].kind; + if (kind < bestMatchKind) { + bestMatchKind = kind; + } + } + + return bestMatchKind; + } + // This means "compare in a case insensitive manner." var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { @@ -62,7 +196,8 @@ module ts.NavigateTo { name: rawItem.name, kind: getNodeKind(declaration), kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[rawItem.matchKind], + matchKind: PatternMatchKind[rawItem.matchKind], + isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), // TODO(jfreeman): What should be the containerName when the container has a computed name? @@ -70,48 +205,5 @@ module ts.NavigateTo { containerKind: container && container.name ? getNodeKind(container) : "" }; } - - function hasAnyUpperCaseCharacter(s: string): boolean { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || - (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - - return false; - } - - function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { - var matchKind = MatchKind.none; - - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - // in case of case-insensitive search searchTerm.term will already be lower-cased - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - // Didn't match. - return MatchKind.none; - } - - var termKind = MatchKind.substring; - if (index === 0) { - // here we know that match occur at the beginning of the string. - // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match - termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; - } - - // Update our match kind if we don't have one, or if this match is better. - if (matchKind === MatchKind.none || termKind < matchKind) { - matchKind = termKind; - } - } - } - - return matchKind; - } } } \ No newline at end of file diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index da07c4400bc..9bcd3e1d000 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -1,10 +1,10 @@ module ts { // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. export enum PatternMatchKind { - Exact, - Prefix, - Substring, - CamelCase + exact, + prefix, + substring, + camelCase } // Information about a match made by the pattern matcher between a candidate and the @@ -46,7 +46,7 @@ module ts { // Fully checks a candidate, with an dotted container, against the search pattern. // The candidate must match the last part of the search pattern, and the dotted container // must match the preceding segments of the pattern. - getMatches(candidate: string, dottedContainer: string): PatternMatch[]; + getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; // Whether or not the pattern contained dots or not. Clients can use this to determine // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. @@ -139,7 +139,7 @@ module ts { return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); } - function getMatches(candidate: string, dottedContainer: string): PatternMatch[] { + function getMatches(candidateContainers: string[], candidate: string): PatternMatch[] { if (skipMatch(candidate)) { return undefined; } @@ -152,27 +152,26 @@ module ts { return undefined; } - dottedContainer = dottedContainer || ""; - var containerParts = dottedContainer.split("."); + candidateContainers = candidateContainers || []; // -1 because the last part was checked against the name, and only the rest // of the parts are checked against the container. - if (dotSeparatedSegments.length - 1 > containerParts.length) { + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { // There weren't enough container parts to match against the pattern parts. // So this definitely doesn't match. - return null; + return undefined; } // So far so good. Now break up the container for the candidate and check if all // the dotted parts match up correctly. var totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i--, j--) { var segment = dotSeparatedSegments[i]; - var containerName = containerParts[j]; + var containerName = candidateContainers[j]; var containerMatch = matchSegment(containerName, segment); if (!containerMatch) { @@ -202,12 +201,12 @@ module ts { if (chunk.text.length === candidate.length) { // a) Check if the part matches the candidate entirely, in an case insensitive or // sensitive manner. If it does, return that there was an exact match. - return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); + return createPatternMatch(PatternMatchKind.exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); } else { // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive // manner. If it does, return that there was a prefix match. - return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); + return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); } } @@ -225,7 +224,7 @@ module ts { for (var i = 0, n = wordSpans.length; i < n; i++) { var span = wordSpans[i] if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { - return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } } @@ -236,7 +235,7 @@ module ts { // candidate in a case *sensitive* manner. If so, return that there was a substring // match. if (candidate.indexOf(chunk.text) > 0) { - return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true); + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ true); } } @@ -246,12 +245,12 @@ module ts { var candidateParts = getWordSpans(candidate); var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); } camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); } } } @@ -266,7 +265,7 @@ module ts { // (Pattern: fogbar, Candidate: quuxfogbarFogBar). if (chunk.text.length < candidate.length) { if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false); + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); } } } @@ -508,7 +507,7 @@ module ts { } function compareCamelCase(result1: PatternMatch, result2: PatternMatch) { - if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) { + if (result1.kind === PatternMatchKind.camelCase && result2.kind === PatternMatchKind.camelCase) { // Swap the values here. If result1 has a higher weight, then we want it to come // first. return result2.camelCaseWeight - result1.camelCaseWeight; diff --git a/src/services/services.ts b/src/services/services.ts index 38d444b6f68..db6a09c1a71 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -970,6 +970,7 @@ module ts { kind: string; kindModifiers: string; matchKind: string; + isCaseSensitive: boolean; fileName: string; textSpan: TextSpan; containerName: string; @@ -1957,7 +1958,7 @@ module ts { }); } - /* @internal */ export function getContainerNode(node: Node): Node { + /* @internal */ export function getContainerNode(node: Node): Declaration { while (true) { node = node.parent; if (!node) { @@ -1975,7 +1976,7 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: - return node; + return node; } } } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index ae9a91e9e4e..f906533da0a 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1639,6 +1639,7 @@ declare module "typescript" { kind: string; kindModifiers: string; matchKind: string; + isCaseSensitive: boolean; fileName: string; textSpan: TextSpan; containerName: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index a2f2a706eaa..970562a7b65 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -5314,6 +5314,9 @@ declare module "typescript" { matchKind: string; >matchKind : string + isCaseSensitive: boolean; +>isCaseSensitive : boolean + fileName: string; >fileName : string diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 13b3e4f068a..d4708039de0 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1670,6 +1670,7 @@ declare module "typescript" { kind: string; kindModifiers: string; matchKind: string; + isCaseSensitive: boolean; fileName: string; textSpan: TextSpan; containerName: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0adce16104c..6f5c1f3e91b 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -5460,6 +5460,9 @@ declare module "typescript" { matchKind: string; >matchKind : string + isCaseSensitive: boolean; +>isCaseSensitive : boolean + fileName: string; >fileName : string diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 4d9d0def9d9..d63d954288d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1671,6 +1671,7 @@ declare module "typescript" { kind: string; kindModifiers: string; matchKind: string; + isCaseSensitive: boolean; fileName: string; textSpan: TextSpan; containerName: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index ad758be0ab1..7ffc3a11f1f 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -5410,6 +5410,9 @@ declare module "typescript" { matchKind: string; >matchKind : string + isCaseSensitive: boolean; +>isCaseSensitive : boolean + fileName: string; >fileName : string diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 25cb4af9e42..4cd76682393 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1708,6 +1708,7 @@ declare module "typescript" { kind: string; kindModifiers: string; matchKind: string; + isCaseSensitive: boolean; fileName: string; textSpan: TextSpan; containerName: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 1283ed80958..52385d9f70a 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5583,6 +5583,9 @@ declare module "typescript" { matchKind: string; >matchKind : string + isCaseSensitive: boolean; +>isCaseSensitive : boolean + fileName: string; >fileName : string diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt deleted file mode 100644 index 81798538bb7..00000000000 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,27): error TS1005: ';' expected. -tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(8,43): error TS1005: ';' expected. -tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(9,30): error TS1005: ';' expected. - - -==== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts (3 errors) ==== - module A { - - class Point { - constructor(public x: number, public y: number) { } - } - - export var UnitSquare : { - top: { left: Point, right: Point }, - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1005: ';' expected. - bottom: { left: Point, right: Point } - ~ -!!! error TS1005: ';' expected. - } = null; - } \ No newline at end of file diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types new file mode 100644 index 00000000000..a4284a8f410 --- /dev/null +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts === +module A { +>A : typeof A + + class Point { +>Point : Point + + constructor(public x: number, public y: number) { } +>x : number +>y : number + } + + export var UnitSquare : { +>UnitSquare : { top: { left: Point; right: Point; }; bottom: { left: Point; right: Point; }; } + + top: { left: Point, right: Point }, +>top : { left: Point; right: Point; } +>left : Point +>Point : Point +>right : Point +>Point : Point + + bottom: { left: Point, right: Point } +>bottom : { left: Point; right: Point; } +>left : Point +>Point : Point +>right : Point +>Point : Point + + } = null; +} diff --git a/tests/baselines/reference/accessorWithInitializer.js b/tests/baselines/reference/accessorWithInitializer.js index 2b07ccc080f..26e72fe7d7d 100644 --- a/tests/baselines/reference/accessorWithInitializer.js +++ b/tests/baselines/reference/accessorWithInitializer.js @@ -10,12 +10,16 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - set: function (v) { }, + set: function (v) { + if (v === void 0) { v = 0; } + }, enumerable: true, configurable: true }); Object.defineProperty(C, "X", { - set: function (v2) { }, + set: function (v2) { + if (v2 === void 0) { v2 = 0; } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js index 51afd6869d2..0f8a033067d 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js @@ -57,9 +57,15 @@ b.b(1); //// [callSignatureWithOptionalParameterAndInitializer.js] // Optional parameters cannot also have initializer expressions, these are all errors -function foo(x) { } -var f = function foo(x) { }; -var f2 = function (x, y) { }; +function foo(x) { + if (x === void 0) { x = 1; } +} +var f = function foo(x) { + if (x === void 0) { x = 1; } +}; +var f2 = function (x, y) { + if (y === void 0) { y = 1; } +}; foo(1); foo(); f(1); @@ -69,7 +75,9 @@ f2(1, 2); var C = (function () { function C() { } - C.prototype.foo = function (x) { }; + C.prototype.foo = function (x) { + if (x === void 0) { x = 1; } + }; return C; })(); var c; @@ -86,9 +94,15 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { }, - a: function foo(x, y) { }, - b: function (x) { } + foo: function (x) { + if (x === void 0) { x = 1; } + }, + a: function foo(x, y) { + if (y === void 0) { y = ''; } + }, + b: function (x) { + if (x === void 0) { x = ''; } + } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers.js b/tests/baselines/reference/callSignaturesWithParameterInitializers.js index ee51890a7b1..c95a558e4c8 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers.js @@ -59,9 +59,15 @@ b.b(1); //// [callSignaturesWithParameterInitializers.js] // Optional parameters allow initializers only in implementation signatures -function foo(x) { } -var f = function foo(x) { }; -var f2 = function (x, y) { }; +function foo(x) { + if (x === void 0) { x = 1; } +} +var f = function foo(x) { + if (x === void 0) { x = 1; } +}; +var f2 = function (x, y) { + if (y === void 0) { y = 1; } +}; foo(1); foo(); f(1); @@ -71,7 +77,9 @@ f2(1, 2); var C = (function () { function C() { } - C.prototype.foo = function (x) { }; + C.prototype.foo = function (x) { + if (x === void 0) { x = 1; } + }; return C; })(); var c; @@ -89,9 +97,15 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { }, - a: function foo(x, y) { }, - b: function (x) { } + foo: function (x) { + if (x === void 0) { x = 1; } + }, + a: function foo(x, y) { + if (y === void 0) { y = 1; } + }, + b: function (x) { + if (x === void 0) { x = 1; } + } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js index 5c812d5ecfb..0524db42f65 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js @@ -28,21 +28,29 @@ b.foo(1); //// [callSignaturesWithParameterInitializers2.js] // Optional parameters allow initializers only in implementation signatures // All the below declarations are errors -function foo(x) { } +function foo(x) { + if (x === void 0) { x = 1; } +} foo(1); foo(); var C = (function () { function C() { } - C.prototype.foo = function (x) { }; + C.prototype.foo = function (x) { + if (x === void 0) { x = 1; } + }; return C; })(); var c; c.foo(); c.foo(1); var b = { - foo: function (x) { }, - foo: function (x) { } + foo: function (x) { + if (x === void 0) { x = 1; } + }, + foo: function (x) { + if (x === void 0) { x = 1; } + } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index d676c0f2a33..e9f7a7a3288 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -61,10 +61,6 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; function foo(x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } } var a; var z; @@ -93,10 +89,6 @@ var C = (function () { this.foo.apply(this, [x, y].concat(z)); } C.prototype.foo = function (x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } }; return C; })(); diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js index 2def4c49c25..caaa6a59da5 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js @@ -23,7 +23,9 @@ module M { var M; (function (_M) { _M.x = 3; - function fn(M, p) { } + function fn(M, p) { + if (p === void 0) { p = _M.x; } + } })(M || (M = {})); var M; (function (_M_1) { diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js index 83d9330dbcf..212364ed30b 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js @@ -39,7 +39,9 @@ var M; var c = (function () { function c() { } - c.prototype.fn = function (M, p) { }; + c.prototype.fn = function (M, p) { + if (p === void 0) { p = _M.x; } + }; return c; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/collisionRestParameterFunction.js b/tests/baselines/reference/collisionRestParameterFunction.js index 8660e8f5db0..9ae266dad41 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.js +++ b/tests/baselines/reference/collisionRestParameterFunction.js @@ -56,10 +56,6 @@ function f3NoError() { var _i = 10; // no error } function f4(_i) { - var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; - } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js index 22709b087eb..f45619ddb71 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js @@ -47,10 +47,6 @@ function foo() { var _i = 10; // no error } function f4(_i) { - var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; - } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt index 5aa399d1d84..e212ee21fb5 100644 --- a/tests/baselines/reference/complicatedPrivacy.errors.txt +++ b/tests/baselines/reference/complicatedPrivacy.errors.txt @@ -1,9 +1,10 @@ -tests/cases/compiler/complicatedPrivacy.ts(24,38): error TS1005: ';' expected. +tests/cases/compiler/complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters. +tests/cases/compiler/complicatedPrivacy.ts(35,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS2304: Cannot find name 'number'. tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' has no exported member 'i6'. -==== tests/cases/compiler/complicatedPrivacy.ts (3 errors) ==== +==== tests/cases/compiler/complicatedPrivacy.ts (4 errors) ==== module m1 { export module m2 { @@ -15,6 +16,8 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' export class C2 implements m3.i3 { public get p1(arg) { + ~~ +!!! error TS1054: A 'get' accessor cannot have parameters. return new C1(); } @@ -28,8 +31,6 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' } export function f2(arg1: { x?: C1, y: number }) { - ~ -!!! error TS1005: ';' expected. } export function f3(): { @@ -41,6 +42,8 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' export function f4(arg1: { [number]: C1; // Used to be indexer, now it is a computed property + ~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~~~~~~ !!! error TS2304: Cannot find name 'number'. }) { diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js index f23a1a19e60..4c4dfb9f9a6 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js @@ -12,5 +12,5 @@ var o: I = { //// [computedPropertyNamesContextualType1_ES6.js] var o = { ["" + 0](y) { return y.length; }, - ["" + 1]: y => { return y.length; } + ["" + 1]: y => y.length }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js index 6a3fb653138..1f0704ce8a7 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js @@ -12,5 +12,5 @@ var o: I = { //// [computedPropertyNamesContextualType2_ES6.js] var o = { [+"foo"](y) { return y.length; }, - [+"bar"]: y => { return y.length; } + [+"bar"]: y => y.length }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js index 9bf7dec1dd0..08d39bbeae3 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js @@ -11,5 +11,5 @@ var o: I = { //// [computedPropertyNamesContextualType3_ES6.js] var o = { [+"foo"](y) { return y.length; }, - [+"bar"]: y => { return y.length; } + [+"bar"]: y => y.length }; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index ba71b082ada..7cb571ee5af 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS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C,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC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A,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 5843e0f3f24..9dc9c4b3ee6 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -2197,18 +2197,21 @@ sourceFile:contextualTyping.ts 2 > ^^^^ 3 > ^ 4 > ^ -5 > ^^^^^ +5 > ^^^^ +6 > ^ 1 > >function 2 > c9t5 3 > ( 4 > f: (n: number) => IFoo -5 > ) {} +5 > ) { +6 > } 1 >Emitted(87, 10) Source(146, 10) + SourceIndex(0) 2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) 3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) 4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) +5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) +6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) --- >>>; 1 > diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.js b/tests/baselines/reference/defaultArgsInFunctionExpressions.js index b0c1fe5824a..3f77c4430e8 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.js +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.js @@ -49,16 +49,24 @@ s = f2(''); s = f2(); n = f2(); // Contextually type the default arg with the type annotation -var f3 = function (a) { }; +var f3 = function (a) { + if (a === void 0) { a = function (s) { return s; }; } +}; // Type check using the function's contextual type -var f4 = function (a) { }; +var f4 = function (a) { + if (a === void 0) { a = ""; } +}; // Contextually type the default arg using the function's contextual type -var f5 = function (a) { }; +var f5 = function (a) { + if (a === void 0) { a = function (s) { return s; }; } +}; var U; (function (U) { U.x; })(U || (U = {})); -var f6 = function (t) { }; +var f6 = function (t) { + if (t === void 0) { t = T; } +}; var f7 = function (t) { if (t === void 0) { t = U; } return t; diff --git a/tests/baselines/reference/defaultArgsInOverloads.js b/tests/baselines/reference/defaultArgsInOverloads.js index 9bcb24ff653..defc4f3e223 100644 --- a/tests/baselines/reference/defaultArgsInOverloads.js +++ b/tests/baselines/reference/defaultArgsInOverloads.js @@ -20,12 +20,18 @@ interface I { var f: (a = 3) => number; //// [defaultArgsInOverloads.js] -function fun(a) { } +function fun(a) { + if (a === void 0) { a = null; } +} var C = (function () { function C() { } - C.prototype.fun = function (a) { }; - C.fun = function (a) { }; + C.prototype.fun = function (a) { + if (a === void 0) { a = null; } + }; + C.fun = function (a) { + if (a === void 0) { a = null; } + }; return C; })(); var f; diff --git a/tests/baselines/reference/defaultValueInFunctionOverload1.js b/tests/baselines/reference/defaultValueInFunctionOverload1.js index 15aa9f22b48..0f33fe9ff2e 100644 --- a/tests/baselines/reference/defaultValueInFunctionOverload1.js +++ b/tests/baselines/reference/defaultValueInFunctionOverload1.js @@ -3,4 +3,6 @@ function foo(x: string = ''); function foo(x = '') { } //// [defaultValueInFunctionOverload1.js] -function foo(x) { } +function foo(x) { + if (x === void 0) { x = ''; } +} diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 9c50c4776b1..455972f781b 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -11,7 +11,9 @@ foo(() => { return false; }); var f1 = function () { }; var f2 = function (x, y) { }; var f3 = function (x, y) { }; -var f4 = function (x, y, z) { }; +var f4 = function (x, y, z) { + if (z === void 0) { z = 10; } +}; function foo(func) { } foo(function () { return true; }); foo(function () { return false; }); diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js index 35078502ef7..603b2737fc5 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.js +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -14,5 +14,5 @@ var f2 = (x, y) => { }; var f3 = (x, y, ...rest) => { }; var f4 = (x, y, z = 10) => { }; function foo(func) { } -foo(() => { return true; }); +foo(() => true); foo(() => { return false; }); diff --git a/tests/baselines/reference/emitDefaultParametersFunction.js b/tests/baselines/reference/emitDefaultParametersFunction.js index 5808de5a5db..6be7ae9dbfe 100644 --- a/tests/baselines/reference/emitDefaultParametersFunction.js +++ b/tests/baselines/reference/emitDefaultParametersFunction.js @@ -5,7 +5,23 @@ function bar(y = 10) { } function bar1(y = 10, ...rest) { } //// [emitDefaultParametersFunction.js] -function foo(x, y) { } -function baz(x, y) { } -function bar(y) { } -function bar1(y) { } +function foo(x, y) { + if (y === void 0) { y = 10; } +} +function baz(x, y) { + if (y === void 0) { y = 5; } + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +} +function bar(y) { + if (y === void 0) { y = 10; } +} +function bar1(y) { + if (y === void 0) { y = 10; } + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/emitDefaultParametersFunctionExpression.js b/tests/baselines/reference/emitDefaultParametersFunctionExpression.js index 5fc2d0794e6..bcfe5b240f2 100644 --- a/tests/baselines/reference/emitDefaultParametersFunctionExpression.js +++ b/tests/baselines/reference/emitDefaultParametersFunctionExpression.js @@ -10,10 +10,45 @@ var z = (function (num: number, boo = false, ...rest) { })(10) //// [emitDefaultParametersFunctionExpression.js] -var lambda1 = function (y) { }; -var lambda2 = function (x, y) { }; -var lambda3 = function (x, y) { }; -var lambda4 = function (y) { }; -var x = function (str) { }; -var y = (function (num, boo) { })(); -var z = (function (num, boo) { })(10); +var lambda1 = function (y) { + if (y === void 0) { y = "hello"; } +}; +var lambda2 = function (x, y) { + if (y === void 0) { y = "hello"; } +}; +var lambda3 = function (x, y) { + if (y === void 0) { y = "hello"; } + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; +var lambda4 = function (y) { + if (y === void 0) { y = "hello"; } + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}; +var x = function (str) { + if (str === void 0) { str = "hello"; } + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}; +var y = (function (num, boo) { + if (num === void 0) { num = 10; } + if (boo === void 0) { boo = false; } + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +})(); +var z = (function (num, boo) { + if (boo === void 0) { boo = false; } + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +})(10); diff --git a/tests/baselines/reference/emitDefaultParametersFunctionProperty.js b/tests/baselines/reference/emitDefaultParametersFunctionProperty.js index ba0e8d5e14e..16cac41a4ce 100644 --- a/tests/baselines/reference/emitDefaultParametersFunctionProperty.js +++ b/tests/baselines/reference/emitDefaultParametersFunctionProperty.js @@ -9,8 +9,24 @@ var obj2 = { //// [emitDefaultParametersFunctionProperty.js] var obj2 = { - func1: function (y) { }, - func2: function (x) { }, - func3: function (x, z, y) { }, - func4: function (x, z, y) { }, + func1: function (y) { + if (y === void 0) { y = 10; } + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }, + func2: function (x) { + if (x === void 0) { x = "hello"; } + }, + func3: function (x, z, y) { + if (y === void 0) { y = "hello"; } + }, + func4: function (x, z, y) { + if (y === void 0) { y = "hello"; } + var rest = []; + for (var _i = 3; _i < arguments.length; _i++) { + rest[_i - 3] = arguments[_i]; + } + }, }; diff --git a/tests/baselines/reference/emitDefaultParametersMethod.js b/tests/baselines/reference/emitDefaultParametersMethod.js index 5a6aede9e75..126c19305b3 100644 --- a/tests/baselines/reference/emitDefaultParametersMethod.js +++ b/tests/baselines/reference/emitDefaultParametersMethod.js @@ -22,10 +22,26 @@ var C = (function () { function C(t, z, x, y) { if (y === void 0) { y = "hello"; } } - C.prototype.foo = function (x, t) { }; - C.prototype.foo1 = function (x, t) { }; - C.prototype.bar = function (t) { }; - C.prototype.boo = function (t) { }; + C.prototype.foo = function (x, t) { + if (t === void 0) { t = false; } + }; + C.prototype.foo1 = function (x, t) { + if (t === void 0) { t = false; } + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } + }; + C.prototype.bar = function (t) { + if (t === void 0) { t = false; } + }; + C.prototype.boo = function (t) { + if (t === void 0) { t = false; } + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }; return C; })(); var D = (function () { diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.js new file mode 100644 index 00000000000..b0ebfe4cfdb --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.js @@ -0,0 +1,7 @@ +//// [functionWithDefaultParameterWithNoStatements1.ts] +function foo(x = 0) { } + +//// [functionWithDefaultParameterWithNoStatements1.js] +function foo(x) { + if (x === void 0) { x = 0; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.types new file mode 100644 index 00000000000..d5c114c9216 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements1.ts === +function foo(x = 0) { } +>foo : (x?: number) => void +>x : number + diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.js new file mode 100644 index 00000000000..f312966ea4f --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements10.ts] +function foo(a = [0]) { } + +function bar(a = [0]) { +} + +//// [functionWithDefaultParameterWithNoStatements10.js] +function foo(a) { + if (a === void 0) { a = [0]; } +} +function bar(a) { + if (a === void 0) { a = [0]; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.types new file mode 100644 index 00000000000..df28a085d85 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements10.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements10.ts === +function foo(a = [0]) { } +>foo : (a?: number[]) => void +>a : number[] +>[0] : number[] + +function bar(a = [0]) { +>bar : (a?: number[]) => void +>a : number[] +>[0] : number[] +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.js new file mode 100644 index 00000000000..3f0b2dab8e2 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements11.ts] +var v: any[]; + +function foo(a = v[0]) { } + +function bar(a = v[0]) { +} + +//// [functionWithDefaultParameterWithNoStatements11.js] +var v; +function foo(a) { + if (a === void 0) { a = v[0]; } +} +function bar(a) { + if (a === void 0) { a = v[0]; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.types new file mode 100644 index 00000000000..5e522855e4b --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements11.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements11.ts === +var v: any[]; +>v : any[] + +function foo(a = v[0]) { } +>foo : (a?: any) => void +>a : any +>v[0] : any +>v : any[] + +function bar(a = v[0]) { +>bar : (a?: any) => void +>a : any +>v[0] : any +>v : any[] +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.js new file mode 100644 index 00000000000..20ba16f9af7 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements12.ts] +var v: any[]; + +function foo(a = (v)) { } + +function bar(a = (v)) { +} + +//// [functionWithDefaultParameterWithNoStatements12.js] +var v; +function foo(a) { + if (a === void 0) { a = (v); } +} +function bar(a) { + if (a === void 0) { a = (v); } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.types new file mode 100644 index 00000000000..c458b4d2850 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements12.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements12.ts === +var v: any[]; +>v : any[] + +function foo(a = (v)) { } +>foo : (a?: any[]) => void +>a : any[] +>(v) : any[] +>v : any[] + +function bar(a = (v)) { +>bar : (a?: any[]) => void +>a : any[] +>(v) : any[] +>v : any[] +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.js new file mode 100644 index 00000000000..7fcbae72541 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements13.ts] +var v: any[]; + +function foo(a = [1 + 1]) { } + +function bar(a = [1 + 1]) { +} + +//// [functionWithDefaultParameterWithNoStatements13.js] +var v; +function foo(a) { + if (a === void 0) { a = [1 + 1]; } +} +function bar(a) { + if (a === void 0) { a = [1 + 1]; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.types new file mode 100644 index 00000000000..eccf0a92856 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements13.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements13.ts === +var v: any[]; +>v : any[] + +function foo(a = [1 + 1]) { } +>foo : (a?: number[]) => void +>a : number[] +>[1 + 1] : number[] +>1 + 1 : number + +function bar(a = [1 + 1]) { +>bar : (a?: number[]) => void +>a : number[] +>[1 + 1] : number[] +>1 + 1 : number +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.js new file mode 100644 index 00000000000..084168435f0 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements14.ts] +var v: any[]; + +function foo(a = v[1 + 1]) { } + +function bar(a = v[1 + 1]) { +} + +//// [functionWithDefaultParameterWithNoStatements14.js] +var v; +function foo(a) { + if (a === void 0) { a = v[1 + 1]; } +} +function bar(a) { + if (a === void 0) { a = v[1 + 1]; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.types new file mode 100644 index 00000000000..c155b335e9a --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements14.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements14.ts === +var v: any[]; +>v : any[] + +function foo(a = v[1 + 1]) { } +>foo : (a?: any) => void +>a : any +>v[1 + 1] : any +>v : any[] +>1 + 1 : number + +function bar(a = v[1 + 1]) { +>bar : (a?: any) => void +>a : any +>v[1 + 1] : any +>v : any[] +>1 + 1 : number +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.js new file mode 100644 index 00000000000..6c03ae90f93 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements15.ts] +var v: any[]; + +function foo(a = (1 + 1)) { } + +function bar(a = (1 + 1)) { +} + +//// [functionWithDefaultParameterWithNoStatements15.js] +var v; +function foo(a) { + if (a === void 0) { a = (1 + 1); } +} +function bar(a) { + if (a === void 0) { a = (1 + 1); } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.types new file mode 100644 index 00000000000..a782b4bd15c --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements15.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements15.ts === +var v: any[]; +>v : any[] + +function foo(a = (1 + 1)) { } +>foo : (a?: number) => void +>a : number +>(1 + 1) : number +>1 + 1 : number + +function bar(a = (1 + 1)) { +>bar : (a?: number) => void +>a : number +>(1 + 1) : number +>1 + 1 : number +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.js new file mode 100644 index 00000000000..698be233d09 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.js @@ -0,0 +1,16 @@ +//// [functionWithDefaultParameterWithNoStatements16.ts] +var v: any[]; + +function foo(a = bar()) { } + +function bar(a = foo()) { +} + +//// [functionWithDefaultParameterWithNoStatements16.js] +var v; +function foo(a) { + if (a === void 0) { a = bar(); } +} +function bar(a) { + if (a === void 0) { a = foo(); } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.types new file mode 100644 index 00000000000..050c95ec1c8 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements16.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements16.ts === +var v: any[]; +>v : any[] + +function foo(a = bar()) { } +>foo : (a?: void) => void +>a : void +>bar() : void +>bar : (a?: void) => void + +function bar(a = foo()) { +>bar : (a?: void) => void +>a : void +>foo() : void +>foo : (a?: void) => void +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.js new file mode 100644 index 00000000000..f5df819a15a --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.js @@ -0,0 +1,8 @@ +//// [functionWithDefaultParameterWithNoStatements2.ts] +function foo(x = 0) { +} + +//// [functionWithDefaultParameterWithNoStatements2.js] +function foo(x) { + if (x === void 0) { x = 0; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.types new file mode 100644 index 00000000000..9be77e7d82e --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements2.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts === +function foo(x = 0) { +>foo : (x?: number) => void +>x : number +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.js new file mode 100644 index 00000000000..34897d95301 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements3.ts] +function foo(a = "") { } + +function bar(a = "") { +} + +//// [functionWithDefaultParameterWithNoStatements3.js] +function foo(a) { + if (a === void 0) { a = ""; } +} +function bar(a) { + if (a === void 0) { a = ""; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.types new file mode 100644 index 00000000000..77895ae1cc9 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements3.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements3.ts === +function foo(a = "") { } +>foo : (a?: string) => void +>a : string + +function bar(a = "") { +>bar : (a?: string) => void +>a : string +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.js new file mode 100644 index 00000000000..492573e9597 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements4.ts] +function foo(a = ``) { } + +function bar(a = ``) { +} + +//// [functionWithDefaultParameterWithNoStatements4.js] +function foo(a) { + if (a === void 0) { a = ""; } +} +function bar(a) { + if (a === void 0) { a = ""; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.types new file mode 100644 index 00000000000..7071c956db2 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements4.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements4.ts === +function foo(a = ``) { } +>foo : (a?: string) => void +>a : string + +function bar(a = ``) { +>bar : (a?: string) => void +>a : string +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.js new file mode 100644 index 00000000000..fa995f4734c --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements5.ts] +function foo(a = 0) { } + +function bar(a = 0) { +} + +//// [functionWithDefaultParameterWithNoStatements5.js] +function foo(a) { + if (a === void 0) { a = 0; } +} +function bar(a) { + if (a === void 0) { a = 0; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.types new file mode 100644 index 00000000000..b7d53b544fa --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements5.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts === +function foo(a = 0) { } +>foo : (a?: number) => void +>a : number + +function bar(a = 0) { +>bar : (a?: number) => void +>a : number +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.js new file mode 100644 index 00000000000..e3047fb56a5 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements6.ts] +function foo(a = true) { } + +function bar(a = true) { +} + +//// [functionWithDefaultParameterWithNoStatements6.js] +function foo(a) { + if (a === void 0) { a = true; } +} +function bar(a) { + if (a === void 0) { a = true; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.types new file mode 100644 index 00000000000..b430bc70953 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements6.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements6.ts === +function foo(a = true) { } +>foo : (a?: boolean) => void +>a : boolean + +function bar(a = true) { +>bar : (a?: boolean) => void +>a : boolean +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.js new file mode 100644 index 00000000000..b3811695aef --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements7.ts] +function foo(a = false) { } + +function bar(a = false) { +} + +//// [functionWithDefaultParameterWithNoStatements7.js] +function foo(a) { + if (a === void 0) { a = false; } +} +function bar(a) { + if (a === void 0) { a = false; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.types new file mode 100644 index 00000000000..baf83c870a9 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements7.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts === +function foo(a = false) { } +>foo : (a?: boolean) => void +>a : boolean + +function bar(a = false) { +>bar : (a?: boolean) => void +>a : boolean +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.js new file mode 100644 index 00000000000..8b729251358 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements8.ts] +function foo(a = undefined) { } + +function bar(a = undefined) { +} + +//// [functionWithDefaultParameterWithNoStatements8.js] +function foo(a) { + if (a === void 0) { a = undefined; } +} +function bar(a) { + if (a === void 0) { a = undefined; } +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.types b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.types new file mode 100644 index 00000000000..e4480691c45 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements8.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/functionWithDefaultParameterWithNoStatements8.ts === +function foo(a = undefined) { } +>foo : (a?: any) => void +>a : any +>undefined : undefined + +function bar(a = undefined) { +>bar : (a?: any) => void +>a : any +>undefined : undefined +} diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.errors.txt b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.errors.txt new file mode 100644 index 00000000000..4e60ceda6b5 --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts(1,18): error TS2304: Cannot find name 'console'. +tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts(3,18): error TS2304: Cannot find name 'console'. + + +==== tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts (2 errors) ==== + function foo(a = console.log) { } + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + + function bar(a = console.log) { + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + } \ No newline at end of file diff --git a/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.js b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.js new file mode 100644 index 00000000000..81e6612958c --- /dev/null +++ b/tests/baselines/reference/functionWithDefaultParameterWithNoStatements9.js @@ -0,0 +1,13 @@ +//// [functionWithDefaultParameterWithNoStatements9.ts] +function foo(a = console.log) { } + +function bar(a = console.log) { +} + +//// [functionWithDefaultParameterWithNoStatements9.js] +function foo(a) { + if (a === void 0) { a = console.log; } +} +function bar(a) { + if (a === void 0) { a = console.log; } +} diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 0337ab8f1a1..a88929669fd 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -1065,18 +1065,42 @@ var x120 = (function () { } return x120; })(); -function x121(parm) { } -function x122(parm) { } -function x123(parm) { } -function x124(parm) { } -function x125(parm) { } -function x126(parm) { } -function x127(parm) { } -function x128(parm) { } -function x129(parm) { } -function x130(parm) { } -function x131(parm) { } -function x132(parm) { } +function x121(parm) { + if (parm === void 0) { parm = function () { return [d1, d2]; }; } +} +function x122(parm) { + if (parm === void 0) { parm = function () { return [d1, d2]; }; } +} +function x123(parm) { + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } +} +function x124(parm) { + if (parm === void 0) { parm = function () { return [d1, d2]; }; } +} +function x125(parm) { + if (parm === void 0) { parm = function () { return [d1, d2]; }; } +} +function x126(parm) { + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } +} +function x127(parm) { + if (parm === void 0) { parm = [d1, d2]; } +} +function x128(parm) { + if (parm === void 0) { parm = [d1, d2]; } +} +function x129(parm) { + if (parm === void 0) { parm = [d1, d2]; } +} +function x130(parm) { + if (parm === void 0) { parm = { n: [d1, d2] }; } +} +function x131(parm) { + if (parm === void 0) { parm = function (n) { var n; return null; }; } +} +function x132(parm) { + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } +} function x133() { return function () { return [d1, d2]; }; } function x134() { return function () { return [d1, d2]; }; } function x135() { return function named() { return [d1, d2]; }; } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.js index dffd3641079..ae104470b76 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.js @@ -19,8 +19,18 @@ function foo2(x) { if (x === void 0) { x = undefined; } return x; } // ok -function foo3(x) { } // error -function foo4(x, y) { } // error -function foo5(x, y) { } // ok -function foo6(x, y, z) { } // error -function foo7(x, y) { } // should be ok +function foo3(x) { + if (x === void 0) { x = 1; } +} // error +function foo4(x, y) { + if (y === void 0) { y = x; } +} // error +function foo5(x, y) { + if (y === void 0) { y = x; } +} // ok +function foo6(x, y, z) { + if (z === void 0) { z = y; } +} // error +function foo7(x, y) { + if (y === void 0) { y = x; } +} // should be ok diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js index c9c74594760..4dce5ba1816 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js @@ -21,10 +21,16 @@ function func2(a, b, c) { } ; // error at "a,b,c" function func3() { } ; // error at "args" -function func4(z, w) { } +function func4(z, w) { + if (z === void 0) { z = null; } + if (w === void 0) { w = undefined; } +} ; // error at "z,w" // these shouldn't be errors -function noError1(x, y) { } +function noError1(x, y) { + if (x === void 0) { x = 3; } + if (y === void 0) { y = 2; } +} ; function noError2(x, y) { } ; diff --git a/tests/baselines/reference/interfaceWithCommaSeparators.js b/tests/baselines/reference/interfaceWithCommaSeparators.js new file mode 100644 index 00000000000..df144402d9f --- /dev/null +++ b/tests/baselines/reference/interfaceWithCommaSeparators.js @@ -0,0 +1,6 @@ +//// [interfaceWithCommaSeparators.ts] +var v: { bar(): void, baz } +interface Foo { bar(): void, baz } + +//// [interfaceWithCommaSeparators.js] +var v; diff --git a/tests/baselines/reference/interfaceWithCommaSeparators.types b/tests/baselines/reference/interfaceWithCommaSeparators.types new file mode 100644 index 00000000000..8af41a4344a --- /dev/null +++ b/tests/baselines/reference/interfaceWithCommaSeparators.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/interfaceWithCommaSeparators.ts === +var v: { bar(): void, baz } +>v : { bar(): void; baz: any; } +>bar : () => void +>baz : any + +interface Foo { bar(): void, baz } +>Foo : Foo +>bar : () => void +>baz : any + diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index ef762013989..f12e29f5117 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -3,7 +3,6 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,25): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,53): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. Types of property 'id' are incompatible. Type 'number' is not assignable to type 'string'. @@ -12,7 +11,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr Type 'number' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (7 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (6 errors) ==== var id: number = 10000; var name: string = "my name"; @@ -28,8 +27,6 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr ~ !!! error TS1128: Declaration or statement expected. function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error - ~ -!!! error TS1005: ';' expected. ~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. !!! error TS2322: Types of property 'id' are incompatible. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index b10ef656cd0..26b0224f2b0 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,20 +1,17 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Property 'b' is missing in type '{ name: string; id: number; }'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,55): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. Types of property 'name' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(6,55): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,25): error TS1128: Declaration or statement expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. Types of property 'name' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,28): error TS1005: ';' expected. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (9 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (6 errors) ==== var id: number = 10000; var name: string = "my name"; @@ -23,15 +20,11 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. !!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'. function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error - ~ -!!! error TS1005: ';' expected. ~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. !!! error TS2322: Types of property 'name' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'number'. function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error - ~ -!!! error TS1005: ';' expected. var person1: { name, id }; // error : Can't use shorthand in the type position ~~~~ !!! error TS1131: Property or signature expected. @@ -43,6 +36,4 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr ~~~~~~~ !!! error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. !!! error TS2322: Types of property 'name' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt b/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt index a774115e350..00442f4f87d 100644 --- a/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt +++ b/tests/baselines/reference/objectTypeLiteralSyntax2.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(2,16): error TS1005: ';' expected. tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,22): error TS1005: ';' expected. -==== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts (2 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts (1 errors) ==== var x: { foo: string, - ~ -!!! error TS1005: ';' expected. bar: string } diff --git a/tests/baselines/reference/optionalArgsWithDefaultValues.js b/tests/baselines/reference/optionalArgsWithDefaultValues.js index ab1aa2f5c15..12ab7c9f330 100644 --- a/tests/baselines/reference/optionalArgsWithDefaultValues.js +++ b/tests/baselines/reference/optionalArgsWithDefaultValues.js @@ -10,12 +10,21 @@ var a = (x?=0) => { return 1; }; var b = (x, y?:number = 2) => { x; }; //// [optionalArgsWithDefaultValues.js] -function foo(x, y, z) { } +function foo(x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } +} var CCC = (function () { function CCC() { } - CCC.prototype.foo = function (x, y, z) { }; - CCC.foo2 = function (x, y, z) { }; + CCC.prototype.foo = function (x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } + }; + CCC.foo2 = function (x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } + }; return CCC; })(); var a = function (x) { diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads1.js b/tests/baselines/reference/optionalBindingParametersInOverloads1.js index 3658efa72c6..af83404c2c8 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads1.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads1.js @@ -11,10 +11,6 @@ foo([false, 0, ""]); //// [optionalBindingParametersInOverloads1.js] function foo() { - var rest = []; - for (var _i = 0; _i < arguments.length; _i++) { - rest[_i - 0] = arguments[_i]; - } } foo(["", 0, false]); foo([false, 0, ""]); diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads2.js b/tests/baselines/reference/optionalBindingParametersInOverloads2.js index 1ddfdae4f07..f32fb1bfbf4 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads2.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads2.js @@ -11,10 +11,6 @@ foo({ x: false, y: 0, z: "" }); //// [optionalBindingParametersInOverloads2.js] function foo() { - var rest = []; - for (var _i = 0; _i < arguments.length; _i++) { - rest[_i - 0] = arguments[_i]; - } } foo({ x: "", y: 0, z: false }); foo({ x: false, y: 0, z: "" }); diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 202439bc79a..5598f8d0872 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -242,7 +242,10 @@ c1o1.C1M4(); i1o1.C1M4(); F4(); L4(); -function fnOpt1(id, children, expectedPath, isRoot) { } +function fnOpt1(id, children, expectedPath, isRoot) { + if (children === void 0) { children = []; } + if (expectedPath === void 0) { expectedPath = []; } +} function fnOpt2(id, children, expectedPath, isRoot) { } fnOpt1(1, [2, 3], [1], true); fnOpt2(1, [2, 3], [1], true); diff --git a/tests/baselines/reference/out-flag.js.map b/tests/baselines/reference/out-flag.js.map index 9247af9d5d4..795d564b2c0 100644 --- a/tests/baselines/reference/out-flag.js.map +++ b/tests/baselines/reference/out-flag.js.map @@ -1,2 +1,2 @@ //// [out-flag.js.map] -{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file +{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBA,EAAEA;IACNA,CAACA;IACLA,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag.sourcemap.txt b/tests/baselines/reference/out-flag.sourcemap.txt index c0289140552..b54f7f8d0a1 100644 --- a/tests/baselines/reference/out-flag.sourcemap.txt +++ b/tests/baselines/reference/out-flag.sourcemap.txt @@ -150,8 +150,8 @@ sourceFile:out-flag.ts > { > 2 > // -1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass.SetCount) -2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass.SetCount) +1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass) +2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass) --- >>> }; 1 >^^^^ @@ -160,8 +160,8 @@ sourceFile:out-flag.ts 1 > > 2 > } -1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass.SetCount) -2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass.SetCount) +1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass) +2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass) --- >>> return MyClass; 1->^^^^ diff --git a/tests/baselines/reference/parameterInitializersForwardReferencing.js b/tests/baselines/reference/parameterInitializersForwardReferencing.js index 8ce7fae6874..188a104f3af 100644 --- a/tests/baselines/reference/parameterInitializersForwardReferencing.js +++ b/tests/baselines/reference/parameterInitializersForwardReferencing.js @@ -73,14 +73,23 @@ function outside() { var b; } } -function defaultArgFunction(a, b) { } -function defaultArgArrow(a, b) { } +function defaultArgFunction(a, b) { + if (a === void 0) { a = function () { return b; }; } + if (b === void 0) { b = 1; } +} +function defaultArgArrow(a, b) { + if (a === void 0) { a = function () { return function () { return b; }; }; } + if (b === void 0) { b = 3; } +} var C = (function () { function C(a, b) { if (a === void 0) { a = b; } if (b === void 0) { b = 1; } } - C.prototype.method = function (a, b) { }; + C.prototype.method = function (a, b) { + if (a === void 0) { a = b; } + if (b === void 0) { b = 1; } + }; return C; })(); // Function expressions diff --git a/tests/baselines/reference/parenthesizedContexualTyping3.js b/tests/baselines/reference/parenthesizedContexualTyping3.js index cc6dbd44f88..6cc162a44d1 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping3.js +++ b/tests/baselines/reference/parenthesizedContexualTyping3.js @@ -25,11 +25,11 @@ var h = tempFun `${ (x => x) } ${ (((x => x))) } ${ undefined }` function tempFun(tempStrs, g, x) { return g(x); } -var a = tempFun `${x => { return x; }} ${10}`; -var b = tempFun `${(x => { return x; })} ${10}`; -var c = tempFun `${((x => { return x; }))} ${10}`; -var d = tempFun `${x => { return x; }} ${x => { return x; }} ${10}`; -var e = tempFun `${x => { return x; }} ${(x => { return x; })} ${10}`; -var f = tempFun `${x => { return x; }} ${((x => { return x; }))} ${10}`; -var g = tempFun `${(x => { return x; })} ${(((x => { return x; })))} ${10}`; -var h = tempFun `${(x => { return x; })} ${(((x => { return x; })))} ${undefined}`; +var a = tempFun `${x => x} ${10}`; +var b = tempFun `${(x => x)} ${10}`; +var c = tempFun `${((x => x))} ${10}`; +var d = tempFun `${x => x} ${x => x} ${10}`; +var e = tempFun `${x => x} ${(x => x)} ${10}`; +var f = tempFun `${x => x} ${((x => x))} ${10}`; +var g = tempFun `${(x => x)} ${(((x => x)))} ${10}`; +var h = tempFun `${(x => x)} ${(((x => x)))} ${undefined}`; diff --git a/tests/baselines/reference/parserCommaInTypeMemberList1.errors.txt b/tests/baselines/reference/parserCommaInTypeMemberList1.errors.txt deleted file mode 100644 index 8bc22ca887e..00000000000 --- a/tests/baselines/reference/parserCommaInTypeMemberList1.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList1.ts(1,23): error TS1005: ';' expected. - - -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList1.ts (1 errors) ==== - var v: { workItem: any, width: string }; - ~ -!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserCommaInTypeMemberList1.types b/tests/baselines/reference/parserCommaInTypeMemberList1.types new file mode 100644 index 00000000000..177372c3e27 --- /dev/null +++ b/tests/baselines/reference/parserCommaInTypeMemberList1.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList1.ts === +var v: { workItem: any, width: string }; +>v : { workItem: any; width: string; } +>workItem : any +>width : string + diff --git a/tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt b/tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt index 8f29c985a66..931bd87293d 100644 --- a/tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt +++ b/tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt @@ -1,11 +1,8 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,9): error TS2304: Cannot find name '$'. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,53): error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (1 errors) ==== var s = $.extend< { workItem: any }, { workItem: any, width: string }>({ workItem: this._workItem }, {}); ~ !!! error TS2304: Cannot find name '$'. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration16.js b/tests/baselines/reference/parserMemberAccessorDeclaration16.js index d6f638d1f2b..a6cd0aaa7e9 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration16.js +++ b/tests/baselines/reference/parserMemberAccessorDeclaration16.js @@ -8,7 +8,9 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - set: function (a) { }, + set: function (a) { + if (a === void 0) { a = 1; } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/parserParameterList10.js b/tests/baselines/reference/parserParameterList10.js index e3664df011b..4f85dec801c 100644 --- a/tests/baselines/reference/parserParameterList10.js +++ b/tests/baselines/reference/parserParameterList10.js @@ -7,6 +7,12 @@ class C { var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + if (bar === void 0) { bar = 0; } + var bar = []; + for (var _i = 0; _i < arguments.length; _i++) { + bar[_i - 0] = arguments[_i]; + } + }; return C; })(); diff --git a/tests/baselines/reference/parserParameterList2.js b/tests/baselines/reference/parserParameterList2.js index ee972df955a..c6a7f48c43e 100644 --- a/tests/baselines/reference/parserParameterList2.js +++ b/tests/baselines/reference/parserParameterList2.js @@ -7,6 +7,8 @@ class C { var C = (function () { function C() { } - C.prototype.F = function (A) { }; + C.prototype.F = function (A) { + if (A === void 0) { A = 0; } + }; return C; })(); diff --git a/tests/baselines/reference/properties.js.map b/tests/baselines/reference/properties.js.map index d47694825ec..e59b82653b6 100644 --- a/tests/baselines/reference/properties.js.map +++ b/tests/baselines/reference/properties.js.map @@ -1,2 +1,2 @@ //// [properties.js.map] -{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BE,EAAEA;QACNA,CAACA;;;OALAF;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file +{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BA,EAAEA;QACNA,CAACA;;;OALAA;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/properties.sourcemap.txt b/tests/baselines/reference/properties.sourcemap.txt index 7ef028e33c0..ac124f60230 100644 --- a/tests/baselines/reference/properties.sourcemap.txt +++ b/tests/baselines/reference/properties.sourcemap.txt @@ -118,8 +118,8 @@ sourceFile:properties.ts > { > 2 > // -1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass.Count) -2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass.Count) +1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass) +2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass) --- >>> }, 1 >^^^^^^^^ @@ -128,8 +128,8 @@ sourceFile:properties.ts 1 > > 2 > } -1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass.Count) -2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass.Count) +1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass) +2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass) --- >>> enumerable: true, >>> configurable: true diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index a2c623e2cf5..0faf03690d3 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GA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DN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjC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AKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBT,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 8e4f3be36ff..be632f2f517 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -975,8 +975,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) -2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/restParamAsOptional.js b/tests/baselines/reference/restParamAsOptional.js index 717df925f35..8b0a1329680 100644 --- a/tests/baselines/reference/restParamAsOptional.js +++ b/tests/baselines/reference/restParamAsOptional.js @@ -4,4 +4,10 @@ function f2(...x = []) { } //// [restParamAsOptional.js] function f() { } -function f2() { } +function f2() { + if (x === void 0) { x = []; } + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/restParameterAssignmentCompatibility.js b/tests/baselines/reference/restParameterAssignmentCompatibility.js index 62c0204c749..cdfc257db41 100644 --- a/tests/baselines/reference/restParameterAssignmentCompatibility.js +++ b/tests/baselines/reference/restParameterAssignmentCompatibility.js @@ -31,10 +31,6 @@ var T = (function () { function T() { } T.prototype.m = function () { - var p3 = []; - for (var _i = 0; _i < arguments.length; _i++) { - p3[_i - 0] = arguments[_i]; - } }; return T; })(); diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 28d4566efc7..914d81cee83 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBA,CAACA;IADeA,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index c0e46430688..74975cdc583 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -450,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) -2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes) --- >>> Shapes.foo = foo; 1->^^^^ diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map index 9170a8e3a2d..4f11f33d322 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationFunctionPropertyAssignment.js.map] -{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,iBAAM,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAK,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt index 1ba2024cee0..a1a44c4ffb4 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt @@ -15,27 +15,30 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^ -8 > ^^ -9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > x 4 > = 5 > { 6 > n -7 > () { } -8 > } -9 > ; +7 > () { +8 > } +9 > } +10> ; 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) 5 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) 6 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) -7 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) -8 >Emitted(1, 31) Source(1, 20) + SourceIndex(0) -9 >Emitted(1, 32) Source(1, 21) + SourceIndex(0) +7 >Emitted(1, 28) Source(1, 17) + SourceIndex(0) +8 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) +9 >Emitted(1, 31) Source(1, 20) + SourceIndex(0) +10>Emitted(1, 32) Source(1, 21) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationFunctionPropertyAssignment.js.map \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js index df7516552e0..dd60a87cbea 100644 --- a/tests/baselines/reference/symbolProperty20.js +++ b/tests/baselines/reference/symbolProperty20.js @@ -11,6 +11,6 @@ var i: I = { //// [symbolProperty20.js] var i = { - [Symbol.iterator]: s => { return s; }, + [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; } }; diff --git a/tests/baselines/reference/symbolProperty22.js b/tests/baselines/reference/symbolProperty22.js index 35757182143..d4609c74d36 100644 --- a/tests/baselines/reference/symbolProperty22.js +++ b/tests/baselines/reference/symbolProperty22.js @@ -8,4 +8,4 @@ declare function foo(p1: T, p2: I): U; foo("", { [Symbol.unscopables]: s => s.length }); //// [symbolProperty22.js] -foo("", { [Symbol.unscopables]: s => { return s.length; } }); +foo("", { [Symbol.unscopables]: s => s.length }); diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js index 3f1817c6419..2f57882b4b7 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js @@ -106,34 +106,34 @@ function someGenerics1b(n, m) { } someGenerics1b `${3}`; // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs, n) { } -someGenerics2a `${(n) => { return n; }}`; +someGenerics2a `${(n) => n}`; function someGenerics2b(strs, n) { } -someGenerics2b `${(n, x) => { return n; }}`; +someGenerics2b `${(n, x) => n}`; // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs, producer) { } -someGenerics3 `${() => { return ''; }}`; -someGenerics3 `${() => { return undefined; }}`; -someGenerics3 `${() => { return 3; }}`; +someGenerics3 `${() => ''}`; +someGenerics3 `${() => undefined}`; +someGenerics3 `${() => 3}`; // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs, n, f) { } -someGenerics4 `${4}${() => { return null; }}`; -someGenerics4 `${''}${() => { return 3; }}`; +someGenerics4 `${4}${() => null}`; +someGenerics4 `${''}${() => 3}`; someGenerics4 `${null}${null}`; // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -someGenerics5 `${4} ${() => { return null; }}`; -someGenerics5 `${''}${() => { return 3; }}`; +someGenerics5 `${4} ${() => null}`; +someGenerics5 `${''}${() => 3}`; someGenerics5 `${null}${null}`; // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -someGenerics6 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; -someGenerics6 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; -someGenerics6 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; +someGenerics6 `${n => n}${n => n}${n => n}`; +someGenerics6 `${n => n}${n => n}${n => n}`; +someGenerics6 `${(n) => n}${(n) => n}${(n) => n}`; // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs, a, b, c) { } -someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; -someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; -someGenerics7 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; +someGenerics7 `${n => n}${n => n}${n => n}`; +someGenerics7 `${n => n}${n => n}${n => n}`; +someGenerics7 `${(n) => n}${(n) => n}${(n) => n}`; // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } var x = someGenerics8 `${someGenerics7}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js index 8bcc426627d..583770b9cd8 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js @@ -109,5 +109,5 @@ fn4 `${null}${null}`; // Error fn4 `${true}${null}`; fn4 `${null}${true}`; function fn5() { return undefined; } -fn5 `${(n) => { return n.toFixed(); }}`; // will error; 'n' should have type 'string'. -fn5 `${(n) => { return n.substr(0); }}`; +fn5 `${(n) => n.toFixed()}`; // will error; 'n' should have type 'string'. +fn5 `${(n) => n.substr(0)}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index a4dd1619642..1f5d65390a7 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -8,9 +8,5 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] function foo() { - var rest = []; - for (var _i = 0; _i < arguments.length; _i++) { - rest[_i - 0] = arguments[_i]; - } } foo "" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/templateStringInArrowFunctionES6.js b/tests/baselines/reference/templateStringInArrowFunctionES6.js index 11dd7a82fe3..2e61b4c52fe 100644 --- a/tests/baselines/reference/templateStringInArrowFunctionES6.js +++ b/tests/baselines/reference/templateStringInArrowFunctionES6.js @@ -2,4 +2,4 @@ var x = x => `abc${ x }def`; //// [templateStringInArrowFunctionES6.js] -var x = x => { return `abc${x}def`; }; +var x = x => `abc${x}def`; diff --git a/tests/baselines/reference/templateStringWithEmbeddedArrowFunctionES6.js b/tests/baselines/reference/templateStringWithEmbeddedArrowFunctionES6.js index 3dd7e4c11e4..2a16de702dd 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedArrowFunctionES6.js +++ b/tests/baselines/reference/templateStringWithEmbeddedArrowFunctionES6.js @@ -2,4 +2,4 @@ var x = `abc${ x => x }def`; //// [templateStringWithEmbeddedArrowFunctionES6.js] -var x = `abc${x => { return x; }}def`; +var x = `abc${x => x}def`; diff --git a/tests/baselines/reference/typeResolution.js.map b/tests/baselines/reference/typeResolution.js.map index a39fb49d634..a7bdf6606c9 100644 --- a/tests/baselines/reference/typeResolution.js.map +++ b/tests/baselines/reference/typeResolution.js.map @@ -1,2 +1,2 @@ //// [typeResolution.js.map] -{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor"],"mappings":";IAAA,IAAc,eAAe,CAmG5B;IAnGD,WAAc,eAAe,EAAC,CAAC;QAC3BA,IAAcA,UAAUA,CAwEvBA;QAxEDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAcA,aAAaA,CAwD1BA;YAxDDA,WAAcA,aAAaA,EAACA,CAACA;gBACzBC,IAAaA,MAAMA;oBAAnBC,SAAaA,MAAMA;oBAmBnBC,CAACA;oBAlBUD,2BAAUA,GAAjBA;wBAEIE,AADAA,uCAAuCA;4BACnCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,yCAAyCA;4BACrCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,qCAAqCA;4BACjCA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,sBAAsBA;4BAClBA,EAAcA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACpCA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;oBACLF,aAACA;gBAADA,CAACA,AAnBDD,IAmBCA;gBAnBYA,oBAAMA,GAANA,MAmBZA,CAAAA;gBACDA,I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 No newline at end of file +{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor"],"mappings":";IAAA,IAAc,eAAe,CAmG5B;IAnGD,WAAc,eAAe,EAAC,CAAC;QAC3BA,IAAcA,UAAUA,CAwEvBA;QAxEDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAcA,aAAaA,CAwD1BA;YAxDDA,WAAcA,aAAaA,EAACA,C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AE0CA,JAC/CA,CAACA,EAXaf,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAWvBA;QAEDA,IAAMA,MAAMA;YAAZuB,SAAMA,MAAMA;YAEZC,CAACA;YADUD,uBAAMA,GAAbA,cAAkBA,CAACA;YACvBA,aAACA;QAADA,CAACA,AAFDvB,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtByB,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAAGC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,GAANA,MAAUA,CAAAA;QAC3BA,CAACA,EAFMzB,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmG5B;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpB4B,IAAcA,UAAUA,CAIvBA;QAJDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAEnBC,CAACA;gBADUD,yBAAQA,GAAfA,cAAoBA,CAACA;gBACzBA,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,GAANA,MAEZA,CAAAA;QACLA,CAACA,EAJaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAIvBA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.sourcemap.txt b/tests/baselines/reference/typeResolution.sourcemap.txt index 08cb4a873d0..d233e267f9f 100644 --- a/tests/baselines/reference/typeResolution.sourcemap.txt +++ b/tests/baselines/reference/typeResolution.sourcemap.txt @@ -2266,15 +2266,18 @@ sourceFile:typeResolution.ts 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ 1-> 2 > AisIn1_2_2 3 > -4 > public AisIn1_2_2() { } +4 > public AisIn1_2_2() { +5 > } 1->Emitted(114, 21) Source(79, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 2 >Emitted(114, 48) Source(79, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 3 >Emitted(114, 51) Source(79, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) -4 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) +4 >Emitted(114, 65) Source(79, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) +5 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2353,15 +2356,18 @@ sourceFile:typeResolution.ts 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ 1-> 2 > BisIn1_2_2 3 > -4 > public BisIn1_2_2() { } +4 > public BisIn1_2_2() { +5 > } 1->Emitted(121, 21) Source(80, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 2 >Emitted(121, 48) Source(80, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 3 >Emitted(121, 51) Source(80, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) -4 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) +4 >Emitted(121, 65) Source(80, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) +5 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) --- >>> return ClassB; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2440,15 +2446,18 @@ sourceFile:typeResolution.ts 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ 1-> 2 > CisIn1_2_2 3 > -4 > public CisIn1_2_2() { } +4 > public CisIn1_2_2() { +5 > } 1->Emitted(128, 21) Source(81, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 2 >Emitted(128, 48) Source(81, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 3 >Emitted(128, 51) Source(81, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) -4 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) +4 >Emitted(128, 65) Source(81, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) +5 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) --- >>> return ClassC; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2619,15 +2628,18 @@ sourceFile:typeResolution.ts 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ 1-> 2 > AisIn1 3 > -4 > public AisIn1() { } +4 > public AisIn1() { +5 > } 1->Emitted(137, 13) Source(90, 16) + SourceIndex(0) name (TopLevelModule1.ClassA) 2 >Emitted(137, 36) Source(90, 22) + SourceIndex(0) name (TopLevelModule1.ClassA) 3 >Emitted(137, 39) Source(90, 9) + SourceIndex(0) name (TopLevelModule1.ClassA) -4 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA) +4 >Emitted(137, 53) Source(90, 27) + SourceIndex(0) name (TopLevelModule1.ClassA) +5 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA) --- >>> return ClassA; 1 >^^^^^^^^^^^^ @@ -3043,15 +3055,18 @@ sourceFile:typeResolution.ts 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ 1-> 2 > AisIn2_3 3 > -4 > public AisIn2_3() { } +4 > public AisIn2_3() { +5 > } 1->Emitted(157, 17) Source(105, 20) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 2 >Emitted(157, 42) Source(105, 28) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 3 >Emitted(157, 45) Source(105, 13) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) -4 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) +4 >Emitted(157, 59) Source(105, 33) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) +5 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/varArgParamTypeCheck.js b/tests/baselines/reference/varArgParamTypeCheck.js index c2a33416436..5d8a60a564a 100644 --- a/tests/baselines/reference/varArgParamTypeCheck.js +++ b/tests/baselines/reference/varArgParamTypeCheck.js @@ -23,10 +23,6 @@ sequence( //// [varArgParamTypeCheck.js] function sequence() { - var sequences = []; - for (var _i = 0; _i < arguments.length; _i++) { - sequences[_i - 0] = arguments[_i]; - } } function callback(clb) { } diff --git a/tests/baselines/reference/vararg.js b/tests/baselines/reference/vararg.js index 038afb90cbc..c0260cd8d86 100644 --- a/tests/baselines/reference/vararg.js +++ b/tests/baselines/reference/vararg.js @@ -57,10 +57,6 @@ var M; return result; }; C.prototype.fnope = function (x) { - var rest = []; - for (var _i = 1; _i < arguments.length; _i++) { - rest[_i - 1] = arguments[_i]; - } }; C.prototype.fonly = function () { var rest = []; diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements1.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements1.ts new file mode 100644 index 00000000000..8dfc001ed4a --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements1.ts @@ -0,0 +1 @@ +function foo(x = 0) { } \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements10.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements10.ts new file mode 100644 index 00000000000..5e8fabd1cb2 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements10.ts @@ -0,0 +1,4 @@ +function foo(a = [0]) { } + +function bar(a = [0]) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements11.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements11.ts new file mode 100644 index 00000000000..ca696b35014 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements11.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = v[0]) { } + +function bar(a = v[0]) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements12.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements12.ts new file mode 100644 index 00000000000..6724f83bb3a --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements12.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = (v)) { } + +function bar(a = (v)) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements13.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements13.ts new file mode 100644 index 00000000000..97c6baad999 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements13.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = [1 + 1]) { } + +function bar(a = [1 + 1]) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements14.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements14.ts new file mode 100644 index 00000000000..7b86efe287b --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements14.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = v[1 + 1]) { } + +function bar(a = v[1 + 1]) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements15.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements15.ts new file mode 100644 index 00000000000..74fcd9e14b0 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements15.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = (1 + 1)) { } + +function bar(a = (1 + 1)) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements16.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements16.ts new file mode 100644 index 00000000000..2143232aae6 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements16.ts @@ -0,0 +1,6 @@ +var v: any[]; + +function foo(a = bar()) { } + +function bar(a = foo()) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts new file mode 100644 index 00000000000..e7945020386 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements2.ts @@ -0,0 +1,2 @@ +function foo(x = 0) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements3.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements3.ts new file mode 100644 index 00000000000..7b82a5b2e3c --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements3.ts @@ -0,0 +1,4 @@ +function foo(a = "") { } + +function bar(a = "") { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements4.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements4.ts new file mode 100644 index 00000000000..c86960030da --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements4.ts @@ -0,0 +1,4 @@ +function foo(a = ``) { } + +function bar(a = ``) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts new file mode 100644 index 00000000000..9ed5111ab33 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements5.ts @@ -0,0 +1,4 @@ +function foo(a = 0) { } + +function bar(a = 0) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements6.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements6.ts new file mode 100644 index 00000000000..5946619a2ce --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements6.ts @@ -0,0 +1,4 @@ +function foo(a = true) { } + +function bar(a = true) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts new file mode 100644 index 00000000000..4e97c631fd7 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements7.ts @@ -0,0 +1,4 @@ +function foo(a = false) { } + +function bar(a = false) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements8.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements8.ts new file mode 100644 index 00000000000..ae0689a7e29 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements8.ts @@ -0,0 +1,4 @@ +function foo(a = undefined) { } + +function bar(a = undefined) { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts new file mode 100644 index 00000000000..cd2b753c792 --- /dev/null +++ b/tests/cases/compiler/functionWithDefaultParameterWithNoStatements9.ts @@ -0,0 +1,4 @@ +function foo(a = console.log) { } + +function bar(a = console.log) { +} \ No newline at end of file diff --git a/tests/cases/compiler/interfaceWithCommaSeparators.ts b/tests/cases/compiler/interfaceWithCommaSeparators.ts new file mode 100644 index 00000000000..03ae5480ef1 --- /dev/null +++ b/tests/cases/compiler/interfaceWithCommaSeparators.ts @@ -0,0 +1,2 @@ +var v: { bar(): void, baz } +interface Foo { bar(): void, baz } \ No newline at end of file diff --git a/tests/cases/fourslash/declareFunction.ts b/tests/cases/fourslash/declareFunction.ts index 171596f3ea5..8806bc6d75e 100644 --- a/tests/cases/fourslash/declareFunction.ts +++ b/tests/cases/fourslash/declareFunction.ts @@ -4,4 +4,4 @@ goTo.marker(); //verify there is no empty navigation item. -verify.navigationItemsListCount(0, "^$"/*empty string*/) +verify.navigationItemsListCount(0, "") diff --git a/tests/cases/fourslash/navigationItemsSubStringMatch.ts b/tests/cases/fourslash/navigationItemsSubStringMatch.ts index 8dc42a2365e..b90a2a2f33e 100644 --- a/tests/cases/fourslash/navigationItemsSubStringMatch.ts +++ b/tests/cases/fourslash/navigationItemsSubStringMatch.ts @@ -1,28 +1,26 @@ /// /////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes { +////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { //// //// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point { +//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { //// // Instance member -//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0; +//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; //// //// // Getter -//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; } +//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } //// //// } ////} //// ////// Local variables -////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); - -//// Testing for substring matching of navigationItems -//var searchValue = "FromOrigin horizon INITIATED Shape Point"; +////{| "itemName": "MymyPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var MymyPointThatIJustInitiated = new Shapes.Point(); +debugger; test.markers().forEach((marker) => { if (marker.data) { var name = marker.data.itemName; - verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName); + verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); } }); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsSubStringMatch2.ts b/tests/cases/fourslash/navigationItemsSubStringMatch2.ts index c1afd7326c0..edce5ad761d 100644 --- a/tests/cases/fourslash/navigationItemsSubStringMatch2.ts +++ b/tests/cases/fourslash/navigationItemsSubStringMatch2.ts @@ -17,12 +17,12 @@ //// INITIATED123; //// public horizon(): void; ////} - +debugger; var notFoundSearchValue = "mPointThatIJustInitiated wrongKeyWord"; goTo.marker("file1"); // case sensitive matching for 'Horizon' will fail -verify.navigationItemsListCount(0, "Horizon", "exact"); +verify.navigationItemsListCount(1, "Horizon", "exact"); // case insensitive matching will find 'horizon' verify.navigationItemsListCount(1, "horizon", "exact"); // case sensitive matching will find 'Distance' and INITIATED diff --git a/tests/cases/fourslash/server/navto.ts b/tests/cases/fourslash/server/navto.ts index 8dc42a2365e..0179c168552 100644 --- a/tests/cases/fourslash/server/navto.ts +++ b/tests/cases/fourslash/server/navto.ts @@ -1,15 +1,15 @@ /// /////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes { +////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { //// //// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point { +//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { //// // Instance member -//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0; +//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; //// //// // Getter -//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; } +//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } //// //// } ////} @@ -23,6 +23,6 @@ test.markers().forEach((marker) => { if (marker.data) { var name = marker.data.itemName; - verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName); + verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); } }); \ No newline at end of file diff --git a/tests/cases/unittests/services/patternMatcher.ts b/tests/cases/unittests/services/patternMatcher.ts index ddf1f9fe344..21f62507f4a 100644 --- a/tests/cases/unittests/services/patternMatcher.ts +++ b/tests/cases/unittests/services/patternMatcher.ts @@ -96,39 +96,37 @@ describe('PatternMatcher', function () { describe("SingleWordPattern", () => { it("PreferCaseSensitiveExact", () => { - debugger; var match = getFirstMatch("Foo", "Foo"); - assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(ts.PatternMatchKind.exact, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitiveExactInsensitive", () => { var match = getFirstMatch("foo", "Foo"); - assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(ts.PatternMatchKind.exact, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitivePrefix", () => { var match = getFirstMatch("Foo", "Fo"); - assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(ts.PatternMatchKind.prefix, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitivePrefixCaseInsensitive", () => { var match = getFirstMatch("Foo", "fo"); - assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(ts.PatternMatchKind.prefix, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitiveCamelCaseMatchSimple", () => { - debugger; var match = getFirstMatch("FogBar", "FB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); assertInRange(match.camelCaseWeight, 1, 1 << 30); }); @@ -136,7 +134,7 @@ describe('PatternMatcher', function () { it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { var match = getFirstMatch("FogBar", "FoB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); @@ -167,57 +165,56 @@ describe('PatternMatcher', function () { it("TwoUppercaseCharacters", () => { var match = getFirstMatch("SimpleUIElement", "SiUI"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitiveLowercasePattern", () => { - debugger; var match = getFirstMatch("FogBar", "b"); - assert.equal(ts.PatternMatchKind.Substring, match.kind); + assert.equal(ts.PatternMatchKind.substring, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitiveLowercasePattern2", () => { var match = getFirstMatch("FogBar", "fB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitiveTryUnderscoredName", () => { var match = getFirstMatch("_fogBar", "_fB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitiveTryUnderscoredName2", () => { var match = getFirstMatch("_fogBar", "fB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { var match = getFirstMatch("_FogBar", "_fB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitiveMiddleUnderscore", () => { var match = getFirstMatch("Fog_Bar", "FB"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); it("PreferCaseSensitiveMiddleUnderscore2", () => { var match = getFirstMatch("Fog_Bar", "F_B"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(true, match.isCaseSensitive); }); @@ -230,14 +227,14 @@ describe('PatternMatcher', function () { it("PreferCaseSensitiveMiddleUnderscore4", () => { var match = getFirstMatch("Fog_Bar", "f_B"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(false, match.isCaseSensitive); }); it("PreferCaseSensitiveMiddleUnderscore5", () => { var match = getFirstMatch("Fog_Bar", "F_b"); - assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(ts.PatternMatchKind.camelCase, match.kind); assert.equal(false, match.isCaseSensitive); }); @@ -266,7 +263,6 @@ describe('PatternMatcher', function () { }); it("AllLowerPattern1", () => { - debugger; var match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); assert.isTrue(undefined !== match); @@ -295,81 +291,81 @@ describe('PatternMatcher', function () { it("ExactWithLowercase", () => { var matches = getAllMatches("AddMetadataReference", "addmetadatareference"); - assertContainsKind(ts.PatternMatchKind.Exact, matches); + assertContainsKind(ts.PatternMatchKind.exact, matches); }); it("SingleLowercasedSearchWord1", () => { var matches = getAllMatches("AddMetadataReference", "add"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); }); it("SingleLowercasedSearchWord2", () => { var matches = getAllMatches("AddMetadataReference", "metadata"); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("SingleUppercaseSearchWord1", () => { var matches = getAllMatches("AddMetadataReference", "Add"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); }); it("SingleUppercaseSearchWord2", () => { var matches = getAllMatches("AddMetadataReference", "Metadata"); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("SingleUppercaseSearchLetter1", () => { var matches = getAllMatches("AddMetadataReference", "A"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); }); it("SingleUppercaseSearchLetter2", () => { var matches = getAllMatches("AddMetadataReference", "M"); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("TwoLowercaseWords", () => { var matches = getAllMatches("AddMetadataReference", "add metadata"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("TwoLowercaseWords", () => { var matches = getAllMatches("AddMetadataReference", "A M"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("TwoLowercaseWords", () => { var matches = getAllMatches("AddMetadataReference", "AM"); - assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + assertContainsKind(ts.PatternMatchKind.camelCase, matches); }); it("TwoLowercaseWords", () => { var matches = getAllMatches("AddMetadataReference", "ref Metadata") - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); }); it("TwoLowercaseWords", () => { var matches = getAllMatches("AddMetadataReference", "ref M") - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); }); it("MixedCamelCase", () => { var matches = getAllMatches("AddMetadataReference", "AMRe"); - assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + assertContainsKind(ts.PatternMatchKind.camelCase, matches); }); it("BlankPattern", () => { @@ -387,22 +383,22 @@ describe('PatternMatcher', function () { it("EachWordSeparately1", () => { var matches = getAllMatches("AddMetadataReference", "add Meta"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("EachWordSeparately2", () => { var matches = getAllMatches("AddMetadataReference", "Add meta"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("EachWordSeparately3", () => { var matches = getAllMatches("AddMetadataReference", "Add Meta"); - assertContainsKind(ts.PatternMatchKind.Prefix, matches); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.prefix, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); }); it("MixedCasing", () => { @@ -420,7 +416,7 @@ describe('PatternMatcher', function () { it("AsteriskSplit", () => { var matches = getAllMatches("GetKeyWord", "K*W"); - assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]); }); it("LowercaseSubstring1", () => { @@ -431,7 +427,7 @@ describe('PatternMatcher', function () { it("LowercaseSubstring2", () => { var matches = getAllMatches("FooAttribute", "a"); - assertContainsKind(ts.PatternMatchKind.Substring, matches); + assertContainsKind(ts.PatternMatchKind.substring, matches); assert.isFalse(matches[0].isCaseSensitive); }); }); @@ -440,7 +436,7 @@ describe('PatternMatcher', function () { it("DottedPattern1", () => { var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); - assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(ts.PatternMatchKind.prefix, match.kind); assert.equal(true, match.isCaseSensitive); }); @@ -451,19 +447,19 @@ describe('PatternMatcher', function () { it("DottedPattern3", () => { var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); - assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(ts.PatternMatchKind.prefix, match.kind); assert.equal(true, match.isCaseSensitive); }); it("DottedPattern4", () => { var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); - assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(ts.PatternMatchKind.exact, match.kind); assert.equal(true, match.isCaseSensitive); }); it("DottedPattern5", () => { var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); - assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(ts.PatternMatchKind.exact, match.kind); assert.equal(true, match.isCaseSensitive); }); @@ -473,7 +469,6 @@ describe('PatternMatcher', function () { }); it("DottedPattern7", () => { - debugger; var match = getFirstMatch("UIElement", "UIElement"); var match = getFirstMatch("GetKeyword", "UIElement"); assert.isTrue(match === undefined); @@ -490,7 +485,7 @@ describe('PatternMatcher', function () { } function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { - var matches = ts.createPatternMatcher(pattern).getMatches(candidate, dottedContainer); + var matches = ts.createPatternMatcher(pattern).getMatches(dottedContainer.split("."), candidate); return matches ? matches[0] : undefined; }