mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-21 13:14:43 -06:00
Merge branch 'master' into correctlyCacheTaggedTemplates
This commit is contained in:
commit
1cb5eb9685
2
.gitignore
vendored
2
.gitignore
vendored
@ -59,4 +59,4 @@ internal/
|
||||
.idea
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
.parallelperf.json
|
||||
.parallelperf.*
|
||||
|
||||
@ -1456,11 +1456,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
function declareSymbolAndAddToSymbolTable(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): Symbol {
|
||||
// Just call this directly so that the return type of this function stays "void".
|
||||
return declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
|
||||
function declareSymbolAndAddToSymbolTableWorker(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): Symbol {
|
||||
switch (container.kind) {
|
||||
// Modules, source files, and classes need specialized handling for how their
|
||||
// members are declared (for example, a member of a class will go into a specific
|
||||
@ -1683,6 +1678,9 @@ namespace ts {
|
||||
|
||||
function bindAnonymousDeclaration(node: Declaration, symbolFlags: SymbolFlags, name: __String) {
|
||||
const symbol = createSymbol(symbolFlags, name);
|
||||
if (symbolFlags & SymbolFlags.EnumMember) {
|
||||
symbol.parent = container.symbol;
|
||||
}
|
||||
addDeclarationToSymbol(symbol, node, symbolFlags);
|
||||
}
|
||||
|
||||
|
||||
@ -2425,15 +2425,6 @@ namespace ts {
|
||||
}
|
||||
};
|
||||
|
||||
interface NodeBuilderContext {
|
||||
enclosingDeclaration: Node | undefined;
|
||||
flags: NodeBuilderFlags | undefined;
|
||||
|
||||
// State
|
||||
encounteredError: boolean;
|
||||
symbolStack: Symbol[] | undefined;
|
||||
}
|
||||
|
||||
function createNodeBuilderContext(enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeBuilderContext {
|
||||
return {
|
||||
enclosingDeclaration,
|
||||
@ -3027,30 +3018,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNameOfSymbol(symbol: Symbol, context: NodeBuilderContext): string {
|
||||
const declaration = firstOrUndefined(symbol.declarations);
|
||||
if (declaration) {
|
||||
const name = getNameOfDeclaration(declaration);
|
||||
if (name) {
|
||||
return declarationNameToString(name);
|
||||
}
|
||||
if (declaration.parent && declaration.parent.kind === SyntaxKind.VariableDeclaration) {
|
||||
return declarationNameToString((<VariableDeclaration>declaration.parent).name);
|
||||
}
|
||||
if (!context.encounteredError && !(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier)) {
|
||||
context.encounteredError = true;
|
||||
}
|
||||
switch (declaration.kind) {
|
||||
case SyntaxKind.ClassExpression:
|
||||
return "(Anonymous class)";
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return "(Anonymous function)";
|
||||
}
|
||||
}
|
||||
return unescapeLeadingUnderscores(symbol.escapedName);
|
||||
}
|
||||
}
|
||||
|
||||
function typePredicateToString(typePredicate: TypePredicate, enclosingDeclaration?: Declaration, flags?: TypeFormatFlags): string {
|
||||
@ -3115,7 +3082,16 @@ namespace ts {
|
||||
return type.flags & TypeFlags.StringLiteral ? '"' + escapeString((<StringLiteralType>type).value) + '"' : "" + (<NumberLiteralType>type).value;
|
||||
}
|
||||
|
||||
function getNameOfSymbol(symbol: Symbol): string {
|
||||
interface NodeBuilderContext {
|
||||
enclosingDeclaration: Node | undefined;
|
||||
flags: NodeBuilderFlags | undefined;
|
||||
|
||||
// State
|
||||
encounteredError: boolean;
|
||||
symbolStack: Symbol[] | undefined;
|
||||
}
|
||||
|
||||
function getNameOfSymbol(symbol: Symbol, context?: NodeBuilderContext): string {
|
||||
if (symbol.declarations && symbol.declarations.length) {
|
||||
const declaration = symbol.declarations[0];
|
||||
const name = getNameOfDeclaration(declaration);
|
||||
@ -3125,6 +3101,9 @@ namespace ts {
|
||||
if (declaration.parent && declaration.parent.kind === SyntaxKind.VariableDeclaration) {
|
||||
return declarationNameToString((<VariableDeclaration>declaration.parent).name);
|
||||
}
|
||||
if (context && !context.encounteredError && !(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier)) {
|
||||
context.encounteredError = true;
|
||||
}
|
||||
switch (declaration.kind) {
|
||||
case SyntaxKind.ClassExpression:
|
||||
return "(Anonymous class)";
|
||||
@ -5011,7 +4990,7 @@ namespace ts {
|
||||
const valueDecl = type.symbol.valueDeclaration;
|
||||
if (valueDecl && isInJavaScriptFile(valueDecl)) {
|
||||
const augTag = getJSDocAugmentsTag(type.symbol.valueDeclaration);
|
||||
if (augTag) {
|
||||
if (augTag && augTag.typeExpression && augTag.typeExpression.type) {
|
||||
baseType = getTypeFromTypeNode(augTag.typeExpression.type);
|
||||
}
|
||||
}
|
||||
@ -5145,7 +5124,9 @@ namespace ts {
|
||||
|
||||
const declaration = <JSDocTypedefTag | TypeAliasDeclaration>find(symbol.declarations, d =>
|
||||
d.kind === SyntaxKind.JSDocTypedefTag || d.kind === SyntaxKind.TypeAliasDeclaration);
|
||||
let type = getTypeFromTypeNode(declaration.kind === SyntaxKind.JSDocTypedefTag ? declaration.typeExpression : declaration.type);
|
||||
const typeNode = declaration.kind === SyntaxKind.JSDocTypedefTag ? declaration.typeExpression : declaration.type;
|
||||
// If typeNode is missing, we will error in checkJSDocTypedefTag.
|
||||
let type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType;
|
||||
|
||||
if (popTypeResolution()) {
|
||||
const typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
||||
@ -13198,16 +13179,11 @@ namespace ts {
|
||||
// the type of the property with the numeric name N in T, if one exists. Otherwise, if T has a numeric index signature,
|
||||
// it is the type of the numeric index signature in T. Otherwise, in ES6 and higher, the contextual type is the iterated
|
||||
// type of T.
|
||||
function getContextualTypeForElementExpression(node: Expression): Type {
|
||||
const arrayLiteral = <ArrayLiteralExpression>node.parent;
|
||||
const type = getApparentTypeOfContextualType(arrayLiteral);
|
||||
if (type) {
|
||||
const index = indexOf(arrayLiteral.elements, node);
|
||||
return getTypeOfPropertyOfContextualType(type, "" + index as __String)
|
||||
|| getIndexTypeOfContextualType(type, IndexKind.Number)
|
||||
|| getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false);
|
||||
}
|
||||
return undefined;
|
||||
function getContextualTypeForElementExpression(arrayContextualType: Type | undefined, index: number): Type | undefined {
|
||||
return arrayContextualType && (
|
||||
getTypeOfPropertyOfContextualType(arrayContextualType, "" + index as __String)
|
||||
|| getIndexTypeOfContextualType(arrayContextualType, IndexKind.Number)
|
||||
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
|
||||
}
|
||||
|
||||
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
|
||||
@ -13321,15 +13297,21 @@ namespace ts {
|
||||
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElementLike>parent);
|
||||
case SyntaxKind.SpreadAssignment:
|
||||
return getApparentTypeOfContextualType(parent.parent as ObjectLiteralExpression);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
case SyntaxKind.ArrayLiteralExpression: {
|
||||
const arrayLiteral = <ArrayLiteralExpression>parent;
|
||||
const type = getApparentTypeOfContextualType(arrayLiteral);
|
||||
return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
|
||||
}
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return getContextualTypeForConditionalOperand(node);
|
||||
case SyntaxKind.TemplateSpan:
|
||||
Debug.assert(parent.parent.kind === SyntaxKind.TemplateExpression);
|
||||
return getContextualTypeForSubstitutionExpression(<TemplateExpression>parent.parent, node);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return getContextualType(<ParenthesizedExpression>parent);
|
||||
case SyntaxKind.ParenthesizedExpression: {
|
||||
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
|
||||
const tag = isInJavaScriptFile(parent) ? getJSDocTypeTag(parent) : undefined;
|
||||
return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(<ParenthesizedExpression>parent);
|
||||
}
|
||||
case SyntaxKind.JsxExpression:
|
||||
return getContextualTypeForJsxExpression(<JsxExpression>parent);
|
||||
case SyntaxKind.JsxAttribute:
|
||||
@ -13451,12 +13433,14 @@ namespace ts {
|
||||
(node.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node).operatorToken.kind === SyntaxKind.EqualsToken);
|
||||
}
|
||||
|
||||
function checkArrayLiteral(node: ArrayLiteralExpression, checkMode?: CheckMode): Type {
|
||||
function checkArrayLiteral(node: ArrayLiteralExpression, checkMode: CheckMode | undefined): Type {
|
||||
const elements = node.elements;
|
||||
let hasSpreadElement = false;
|
||||
const elementTypes: Type[] = [];
|
||||
const inDestructuringPattern = isAssignmentTarget(node);
|
||||
for (const e of elements) {
|
||||
const contextualType = getApparentTypeOfContextualType(node);
|
||||
for (let index = 0; index < elements.length; index++) {
|
||||
const e = elements[index];
|
||||
if (inDestructuringPattern && e.kind === SyntaxKind.SpreadElement) {
|
||||
// Given the following situation:
|
||||
// var c: {};
|
||||
@ -13478,7 +13462,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
const type = checkExpressionForMutableLocation(e, checkMode);
|
||||
const elementContextualType = getContextualTypeForElementExpression(contextualType, index);
|
||||
const type = checkExpressionForMutableLocation(e, checkMode, elementContextualType);
|
||||
elementTypes.push(type);
|
||||
}
|
||||
hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElement;
|
||||
@ -16508,7 +16493,7 @@ namespace ts {
|
||||
|
||||
// If the symbol of the node has members, treat it like a constructor.
|
||||
const symbol = isFunctionDeclaration(node) || isFunctionExpression(node) ? getSymbolOfNode(node) :
|
||||
isVariableDeclaration(node) && isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
|
||||
isVariableDeclaration(node) && node.initializer && isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
|
||||
undefined;
|
||||
|
||||
return symbol && symbol.members !== undefined;
|
||||
@ -18026,9 +18011,13 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkExpressionForMutableLocation(node: Expression, checkMode?: CheckMode): Type {
|
||||
function checkExpressionForMutableLocation(node: Expression, checkMode: CheckMode, contextualType?: Type): Type {
|
||||
if (arguments.length === 2) {
|
||||
contextualType = getContextualType(node);
|
||||
}
|
||||
const type = checkExpression(node, checkMode);
|
||||
return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);
|
||||
const shouldWiden = isTypeAssertion(node) || isLiteralContextualType(contextualType);
|
||||
return shouldWiden ? type : getWidenedLiteralType(type);
|
||||
}
|
||||
|
||||
function checkPropertyAssignment(node: PropertyAssignment, checkMode?: CheckMode): Type {
|
||||
@ -18146,13 +18135,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkParenthesizedExpression(node: ParenthesizedExpression, checkMode?: CheckMode): Type {
|
||||
if (isInJavaScriptFile(node) && node.jsDoc) {
|
||||
const typecasts = flatMap(node.jsDoc, doc => filter(doc.tags, tag => tag.kind === SyntaxKind.JSDocTypeTag && !!(tag as JSDocTypeTag).typeExpression && !!(tag as JSDocTypeTag).typeExpression.type));
|
||||
if (typecasts && typecasts.length) {
|
||||
// We should have already issued an error if there were multiple type jsdocs
|
||||
const cast = typecasts[0] as JSDocTypeTag;
|
||||
return checkAssertionWorker(cast, cast.typeExpression.type, node.expression, checkMode);
|
||||
}
|
||||
const tag = isInJavaScriptFile(node) ? getJSDocTypeTag(node) : undefined;
|
||||
if (tag) {
|
||||
return checkAssertionWorker(tag, tag.typeExpression.type, node.expression, checkMode);
|
||||
}
|
||||
return checkExpression(node.expression, checkMode);
|
||||
}
|
||||
@ -19292,10 +19277,11 @@ namespace ts {
|
||||
: DeclarationSpaces.ExportNamespace;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
// A NamespaceImport declares an Alias, which is allowed to merge with other values within the module
|
||||
case SyntaxKind.NamespaceImport:
|
||||
return DeclarationSpaces.ExportType | DeclarationSpaces.ExportValue;
|
||||
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ImportClause:
|
||||
let result = DeclarationSpaces.None;
|
||||
const target = resolveAlias(getSymbolOfNode(d));
|
||||
forEach(target.declarations, d => { result |= getDeclarationSpaces(d); });
|
||||
@ -19799,11 +19785,11 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkJSDoc(node: FunctionDeclaration | MethodDeclaration) {
|
||||
if (!isInJavaScriptFile(node)) {
|
||||
return;
|
||||
function checkJSDocTypedefTag(node: JSDocTypedefTag) {
|
||||
if (!node.typeExpression) {
|
||||
// If the node had `@property` tags, `typeExpression` would have been set to the first property tag.
|
||||
error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
||||
}
|
||||
forEach(node.jsDoc, checkSourceElement);
|
||||
}
|
||||
|
||||
function checkJSDocComment(node: JSDoc) {
|
||||
@ -19815,7 +19801,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkFunctionOrMethodDeclaration(node: FunctionDeclaration | MethodDeclaration): void {
|
||||
checkJSDoc(node);
|
||||
checkDecorators(node);
|
||||
checkSignatureDeclaration(node);
|
||||
const functionFlags = getFunctionFlags(node);
|
||||
@ -22449,6 +22434,12 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInJavaScriptFile(node) && (node as JSDocContainer).jsDoc) {
|
||||
for (const jsdoc of (node as JSDocContainer).jsDoc) {
|
||||
checkJSDocComment(jsdoc);
|
||||
}
|
||||
}
|
||||
|
||||
const kind = node.kind;
|
||||
if (cancellationToken) {
|
||||
// Only bother checking on a few construct kinds. We don't want to be excessively
|
||||
@ -22503,6 +22494,8 @@ namespace ts {
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
case SyntaxKind.TypeOperator:
|
||||
return checkSourceElement((<ParenthesizedTypeNode | TypeOperatorNode>node).type);
|
||||
case SyntaxKind.JSDocTypedefTag:
|
||||
return checkJSDocTypedefTag(node as JSDocTypedefTag);
|
||||
case SyntaxKind.JSDocComment:
|
||||
return checkJSDocComment(node as JSDoc);
|
||||
case SyntaxKind.JSDocParameterTag:
|
||||
|
||||
@ -994,11 +994,6 @@ namespace ts {
|
||||
|
||||
/**
|
||||
* Gets the owned, enumerable property keys of a map-like.
|
||||
*
|
||||
* NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use
|
||||
* Object.keys instead as it offers better performance.
|
||||
*
|
||||
* @param map A map-like.
|
||||
*/
|
||||
export function getOwnKeys<T>(map: MapLike<T>): string[] {
|
||||
const keys: string[] = [];
|
||||
@ -1011,6 +1006,17 @@ namespace ts {
|
||||
return keys;
|
||||
}
|
||||
|
||||
export function getOwnValues<T>(sparseArray: T[]): T[] {
|
||||
const values: T[] = [];
|
||||
for (const key in sparseArray) {
|
||||
if (hasOwnProperty.call(sparseArray, key)) {
|
||||
values.push(sparseArray[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
/** Shims `Array.from`. */
|
||||
export function arrayFrom<T, U>(iterator: Iterator<T>, map: (t: T) => U): U[];
|
||||
export function arrayFrom<T>(iterator: Iterator<T>): T[];
|
||||
|
||||
@ -3507,6 +3507,10 @@
|
||||
"category": "Error",
|
||||
"code": 8020
|
||||
},
|
||||
"JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.": {
|
||||
"category": "Error",
|
||||
"code": 8021
|
||||
},
|
||||
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
|
||||
4
src/compiler/emitter.ts
Normal file → Executable file
4
src/compiler/emitter.ts
Normal file → Executable file
@ -1863,7 +1863,9 @@ namespace ts {
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
emitModifiers(node, node.modifiers);
|
||||
write(node.flags & NodeFlags.Namespace ? "namespace " : "module ");
|
||||
if (~node.flags & NodeFlags.GlobalAugmentation) {
|
||||
write(node.flags & NodeFlags.Namespace ? "namespace " : "module ");
|
||||
}
|
||||
emit(node.name);
|
||||
|
||||
let body = node.body;
|
||||
|
||||
@ -1207,6 +1207,30 @@ namespace ts {
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createTemplateHead(text: string) {
|
||||
const node = <TemplateHead>createSynthesizedNode(SyntaxKind.TemplateHead);
|
||||
node.text = text;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createTemplateMiddle(text: string) {
|
||||
const node = <TemplateMiddle>createSynthesizedNode(SyntaxKind.TemplateMiddle);
|
||||
node.text = text;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createTemplateTail(text: string) {
|
||||
const node = <TemplateTail>createSynthesizedNode(SyntaxKind.TemplateTail);
|
||||
node.text = text;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createNoSubstitutionTemplateLiteral(text: string) {
|
||||
const node = <NoSubstitutionTemplateLiteral>createSynthesizedNode(SyntaxKind.NoSubstitutionTemplateLiteral);
|
||||
node.text = text;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createYield(expression?: Expression): YieldExpression;
|
||||
export function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression;
|
||||
export function createYield(asteriskTokenOrExpression?: AsteriskToken | Expression, expression?: Expression) {
|
||||
|
||||
@ -6135,11 +6135,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Parses out a JSDoc type expression.
|
||||
/* @internal */
|
||||
export function parseJSDocTypeExpression(): JSDocTypeExpression {
|
||||
export function parseJSDocTypeExpression(): JSDocTypeExpression;
|
||||
export function parseJSDocTypeExpression(requireBraces: true): JSDocTypeExpression | undefined;
|
||||
export function parseJSDocTypeExpression(requireBraces?: boolean): JSDocTypeExpression | undefined {
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
|
||||
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
if (!parseExpected(SyntaxKind.OpenBraceToken) && requireBraces) {
|
||||
return undefined;
|
||||
}
|
||||
result.type = doInsideOfContext(NodeFlags.JSDoc, parseType);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
|
||||
@ -6486,14 +6489,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
function tryParseTypeExpression(): JSDocTypeExpression | undefined {
|
||||
return tryParse(() => {
|
||||
skipWhitespace();
|
||||
if (token() !== SyntaxKind.OpenBraceToken) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return parseJSDocTypeExpression();
|
||||
});
|
||||
skipWhitespace();
|
||||
return token() === SyntaxKind.OpenBraceToken ? parseJSDocTypeExpression() : undefined;
|
||||
}
|
||||
|
||||
function parseBracketNameInPropertyAndParamTag(): { name: EntityName, isBracketed: boolean } {
|
||||
@ -6602,12 +6599,12 @@ namespace ts {
|
||||
const result = <JSDocTypeTag>createNode(SyntaxKind.JSDocTypeTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeExpression = tryParseTypeExpression();
|
||||
result.typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function parseAugmentsTag(atToken: AtToken, tagName: Identifier): JSDocAugmentsTag {
|
||||
const typeExpression = tryParseTypeExpression();
|
||||
const typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true);
|
||||
|
||||
const result = <JSDocAugmentsTag>createNode(SyntaxKind.JSDocAugmentsTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
|
||||
@ -1462,7 +1462,7 @@ namespace ts {
|
||||
|
||||
// file.imports may not be undefined if there exists dynamic import
|
||||
let imports: StringLiteral[];
|
||||
let moduleAugmentations: Array<StringLiteral | Identifier>;
|
||||
let moduleAugmentations: (StringLiteral | Identifier)[];
|
||||
let ambientModules: string[];
|
||||
|
||||
// If we are importing helpers, we need to add a synthetic reference to resolve the
|
||||
|
||||
@ -14,21 +14,29 @@ namespace ts {
|
||||
return getSymbolWalker;
|
||||
|
||||
function getSymbolWalker(accept: (symbol: Symbol) => boolean = () => true): SymbolWalker {
|
||||
const visitedTypes = createMap<Type>(); // Key is id as string
|
||||
const visitedSymbols = createMap<Symbol>(); // Key is id as string
|
||||
const visitedTypes: Type[] = []; // Sparse array from id to type
|
||||
const visitedSymbols: Symbol[] = []; // Sparse array from id to symbol
|
||||
|
||||
return {
|
||||
walkType: type => {
|
||||
visitedTypes.clear();
|
||||
visitedSymbols.clear();
|
||||
visitType(type);
|
||||
return { visitedTypes: arrayFrom(visitedTypes.values()), visitedSymbols: arrayFrom(visitedSymbols.values()) };
|
||||
try {
|
||||
visitType(type);
|
||||
return { visitedTypes: getOwnValues(visitedTypes), visitedSymbols: getOwnValues(visitedSymbols) };
|
||||
}
|
||||
finally {
|
||||
clear(visitedTypes);
|
||||
clear(visitedSymbols);
|
||||
}
|
||||
},
|
||||
walkSymbol: symbol => {
|
||||
visitedTypes.clear();
|
||||
visitedSymbols.clear();
|
||||
visitSymbol(symbol);
|
||||
return { visitedTypes: arrayFrom(visitedTypes.values()), visitedSymbols: arrayFrom(visitedSymbols.values()) };
|
||||
try {
|
||||
visitSymbol(symbol);
|
||||
return { visitedTypes: getOwnValues(visitedTypes), visitedSymbols: getOwnValues(visitedSymbols) };
|
||||
}
|
||||
finally {
|
||||
clear(visitedTypes);
|
||||
clear(visitedSymbols);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@ -37,11 +45,10 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
const typeIdString = type.id.toString();
|
||||
if (visitedTypes.has(typeIdString)) {
|
||||
if (visitedTypes[type.id]) {
|
||||
return;
|
||||
}
|
||||
visitedTypes.set(typeIdString, type);
|
||||
visitedTypes[type.id] = type;
|
||||
|
||||
// Reuse visitSymbol to visit the type's symbol,
|
||||
// but be sure to bail on recuring into the type if accept declines the symbol.
|
||||
@ -79,18 +86,9 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function visitTypeList(types: Type[]): void {
|
||||
if (!types) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
visitType(types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function visitTypeReference(type: TypeReference): void {
|
||||
visitType(type.target);
|
||||
visitTypeList(type.typeArguments);
|
||||
forEach(type.typeArguments, visitType);
|
||||
}
|
||||
|
||||
function visitTypeParameter(type: TypeParameter): void {
|
||||
@ -98,7 +96,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitUnionOrIntersectionType(type: UnionOrIntersectionType): void {
|
||||
visitTypeList(type.types);
|
||||
forEach(type.types, visitType);
|
||||
}
|
||||
|
||||
function visitIndexType(type: IndexType): void {
|
||||
@ -122,7 +120,7 @@ namespace ts {
|
||||
if (signature.typePredicate) {
|
||||
visitType(signature.typePredicate.type);
|
||||
}
|
||||
visitTypeList(signature.typeParameters);
|
||||
forEach(signature.typeParameters, visitType);
|
||||
|
||||
for (const parameter of signature.parameters){
|
||||
visitSymbol(parameter);
|
||||
@ -133,8 +131,8 @@ namespace ts {
|
||||
|
||||
function visitInterfaceType(interfaceT: InterfaceType): void {
|
||||
visitObjectType(interfaceT);
|
||||
visitTypeList(interfaceT.typeParameters);
|
||||
visitTypeList(getBaseTypes(interfaceT));
|
||||
forEach(interfaceT.typeParameters, visitType);
|
||||
forEach(getBaseTypes(interfaceT), visitType);
|
||||
visitType(interfaceT.thisType);
|
||||
}
|
||||
|
||||
@ -161,11 +159,11 @@ namespace ts {
|
||||
if (!symbol) {
|
||||
return;
|
||||
}
|
||||
const symbolIdString = getSymbolId(symbol).toString();
|
||||
if (visitedSymbols.has(symbolIdString)) {
|
||||
const symbolId = getSymbolId(symbol);
|
||||
if (visitedSymbols[symbolId]) {
|
||||
return;
|
||||
}
|
||||
visitedSymbols.set(symbolIdString, symbol);
|
||||
visitedSymbols[symbolId] = symbol;
|
||||
if (!accept(symbol)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4095,8 +4095,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface CompilerHost extends ModuleResolutionHost {
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
|
||||
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile | undefined;
|
||||
getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile | undefined;
|
||||
getCancellationToken?(): CancellationToken;
|
||||
getDefaultLibFileName(options: CompilerOptions): string;
|
||||
getDefaultLibLocation?(): string;
|
||||
|
||||
@ -321,6 +321,18 @@ namespace ts {
|
||||
return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: it is expected that the `nodeArray` and the `node` are within the same file.
|
||||
* For example, searching for a `SourceFile` in a `SourceFile[]` wouldn't work.
|
||||
*/
|
||||
export function indexOfNode(nodeArray: ReadonlyArray<Node>, node: Node) {
|
||||
return binarySearch(nodeArray, node, compareNodePos);
|
||||
}
|
||||
|
||||
function compareNodePos({ pos: aPos }: Node, { pos: bPos}: Node) {
|
||||
return aPos < bPos ? Comparison.LessThan : bPos < aPos ? Comparison.GreaterThan : Comparison.EqualTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets flags that control emit behavior of a node.
|
||||
*/
|
||||
@ -1502,7 +1514,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getJSDocCommentsAndTags(node: Node): (JSDoc | JSDocTag)[] {
|
||||
let result: Array<JSDoc | JSDocTag> | undefined;
|
||||
let result: (JSDoc | JSDocTag)[] | undefined;
|
||||
getJSDocCommentsAndTagsWorker(node);
|
||||
return result || emptyArray;
|
||||
|
||||
@ -4079,9 +4091,14 @@ namespace ts {
|
||||
return getFirstJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag;
|
||||
}
|
||||
|
||||
/** Gets the JSDoc type tag for the node if present */
|
||||
/** Gets the JSDoc type tag for the node if present and valid */
|
||||
export function getJSDocTypeTag(node: Node): JSDocTypeTag | undefined {
|
||||
return getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag;
|
||||
// We should have already issued an error if there were multiple type jsdocs, so just use the first one.
|
||||
const tag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag;
|
||||
if (tag && tag.typeExpression && tag.typeExpression.type) {
|
||||
return tag;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -177,7 +177,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
Harness.Compiler.doTypeAndSymbolBaseline(justName, result, toBeCompiled.concat(otherFiles).filter(file => !!result.program.getSourceFile(file.unitName)));
|
||||
Harness.Compiler.doTypeAndSymbolBaseline(justName, result.program, toBeCompiled.concat(otherFiles).filter(file => !!result.program.getSourceFile(file.unitName)));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1003,7 +1003,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyReferenceGroups(startRanges: Range | Range[], parts: Array<{ definition: string, ranges: Range[] }>): void {
|
||||
public verifyReferenceGroups(startRanges: Range | Range[], parts: FourSlashInterface.ReferenceGroup[]): void {
|
||||
const fullExpected = ts.map(parts, ({ definition, ranges }) => ({ definition, ranges: ranges.map(rangeToReferenceEntry) }));
|
||||
|
||||
for (const startRange of toArray(startRanges)) {
|
||||
@ -3833,7 +3833,7 @@ namespace FourSlashInterface {
|
||||
this.state.verifyReferencesOf(start, references);
|
||||
}
|
||||
|
||||
public referenceGroups(startRanges: FourSlash.Range[], parts: Array<{ definition: string, ranges: FourSlash.Range[] }>) {
|
||||
public referenceGroups(startRanges: FourSlash.Range[], parts: ReferenceGroup[]) {
|
||||
this.state.verifyReferenceGroups(startRanges, parts);
|
||||
}
|
||||
|
||||
@ -4344,6 +4344,11 @@ namespace FourSlashInterface {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ReferenceGroup {
|
||||
definition: string;
|
||||
ranges: FourSlash.Range[];
|
||||
}
|
||||
|
||||
export interface ApplyRefactorOptions {
|
||||
refactorName: string;
|
||||
actionName: string;
|
||||
|
||||
@ -148,6 +148,8 @@ namespace Utils {
|
||||
});
|
||||
}
|
||||
|
||||
export const canonicalizeForHarness = ts.createGetCanonicalFileName(/*caseSensitive*/ false); // This is done so tests work on windows _and_ linux
|
||||
|
||||
export function assertInvariants(node: ts.Node, parent: ts.Node): void {
|
||||
if (node) {
|
||||
assert.isFalse(node.pos < 0, "node.pos < 0");
|
||||
@ -1446,10 +1448,7 @@ namespace Harness {
|
||||
});
|
||||
}
|
||||
|
||||
export function doTypeAndSymbolBaseline(baselinePath: string, result: CompilerResult, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean) {
|
||||
if (result.errors.length !== 0) {
|
||||
return;
|
||||
}
|
||||
export function doTypeAndSymbolBaseline(baselinePath: string, program: ts.Program, allFiles: {unitName: string, content: string}[], opts?: Harness.Baseline.BaselineOptions, multifile?: boolean, skipTypeAndSymbolbaselines?: boolean) {
|
||||
// The full walker simulates the types that you would get from doing a full
|
||||
// compile. The pull walker simulates the types you get when you just do
|
||||
// a type query for a random node (like how the LS would do it). Most of the
|
||||
@ -1465,16 +1464,8 @@ namespace Harness {
|
||||
// These types are equivalent, but depend on what order the compiler observed
|
||||
// certain parts of the program.
|
||||
|
||||
const program = result.program;
|
||||
|
||||
const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true);
|
||||
|
||||
const fullResults = ts.createMap<TypeWriterResult[]>();
|
||||
|
||||
for (const sourceFile of allFiles) {
|
||||
fullResults.set(sourceFile.unitName, fullWalker.getTypeAndSymbols(sourceFile.unitName));
|
||||
}
|
||||
|
||||
// Produce baselines. The first gives the types for all expressions.
|
||||
// The second gives symbols for all identifiers.
|
||||
let typesError: Error, symbolsError: Error;
|
||||
@ -1515,76 +1506,77 @@ namespace Harness {
|
||||
baselinePath.replace(/\.tsx?/, "") : baselinePath;
|
||||
|
||||
if (!multifile) {
|
||||
const fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine);
|
||||
const fullBaseLine = generateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines);
|
||||
Harness.Baseline.runBaseline(outputFileName + fullExtension, () => fullBaseLine, opts);
|
||||
}
|
||||
else {
|
||||
Harness.Baseline.runMultifileBaseline(outputFileName, fullExtension, () => {
|
||||
return iterateBaseLine(fullResults, isSymbolBaseLine);
|
||||
return iterateBaseLine(isSymbolBaseLine, skipTypeAndSymbolbaselines);
|
||||
}, opts);
|
||||
}
|
||||
}
|
||||
|
||||
function generateBaseLine(typeWriterResults: ts.Map<TypeWriterResult[]>, isSymbolBaseline: boolean): string {
|
||||
function generateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): string {
|
||||
let result = "";
|
||||
const gen = iterateBaseLine(typeWriterResults, isSymbolBaseline);
|
||||
const gen = iterateBaseLine(isSymbolBaseline, skipTypeAndSymbolbaselines);
|
||||
for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) {
|
||||
const [, content] = value;
|
||||
result += content;
|
||||
}
|
||||
return result;
|
||||
/* tslint:disable:no-null-keyword */
|
||||
return result || null;
|
||||
/* tslint:enable:no-null-keyword */
|
||||
}
|
||||
|
||||
function *iterateBaseLine(typeWriterResults: ts.Map<TypeWriterResult[]>, isSymbolBaseline: boolean): IterableIterator<[string, string]> {
|
||||
let typeLines = "";
|
||||
const typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {};
|
||||
function *iterateBaseLine(isSymbolBaseline: boolean, skipTypeAndSymbolbaselines?: boolean): IterableIterator<[string, string]> {
|
||||
if (skipTypeAndSymbolbaselines) {
|
||||
return;
|
||||
}
|
||||
const dupeCase = ts.createMap<number>();
|
||||
|
||||
for (const file of allFiles) {
|
||||
const codeLines = file.content.split("\n");
|
||||
const key = file.unitName;
|
||||
typeWriterResults.get(file.unitName).forEach(result => {
|
||||
const { unitName } = file;
|
||||
let typeLines = "=== " + unitName + " ===\r\n";
|
||||
const codeLines = ts.flatMap(file.content.split(/\r?\n/g), e => e.split(/[\r\u2028\u2029]/g));
|
||||
const gen: IterableIterator<TypeWriterResult> = isSymbolBaseline ? fullWalker.getSymbols(unitName) : fullWalker.getTypes(unitName);
|
||||
let lastIndexWritten: number | undefined;
|
||||
for (let {done, value: result} = gen.next(); !done; { done, value: result } = gen.next()) {
|
||||
if (isSymbolBaseline && !result.symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastIndexWritten === undefined) {
|
||||
typeLines += codeLines.slice(0, result.line + 1).join("\r\n") + "\r\n";
|
||||
}
|
||||
else if (result.line !== lastIndexWritten) {
|
||||
if (!((lastIndexWritten + 1 < codeLines.length) && (codeLines[lastIndexWritten + 1].match(/^\s*[{|}]\s*$/) || codeLines[lastIndexWritten + 1].trim() === ""))) {
|
||||
typeLines += "\r\n";
|
||||
}
|
||||
typeLines += codeLines.slice(lastIndexWritten + 1, result.line + 1).join("\r\n") + "\r\n";
|
||||
}
|
||||
lastIndexWritten = result.line;
|
||||
const typeOrSymbolString = isSymbolBaseline ? result.symbol : result.type;
|
||||
const formattedLine = result.sourceText.replace(/\r?\n/g, "") + " : " + typeOrSymbolString;
|
||||
if (!typeMap[key]) {
|
||||
typeMap[key] = {};
|
||||
}
|
||||
typeLines += ">" + formattedLine + "\r\n";
|
||||
}
|
||||
|
||||
let typeInfo = [formattedLine];
|
||||
const existingTypeInfo = typeMap[key][result.line];
|
||||
if (existingTypeInfo) {
|
||||
typeInfo = existingTypeInfo.concat(typeInfo);
|
||||
}
|
||||
typeMap[key][result.line] = typeInfo;
|
||||
});
|
||||
|
||||
typeLines += "=== " + file.unitName + " ===\r\n";
|
||||
for (let i = 0; i < codeLines.length; i++) {
|
||||
const currentCodeLine = codeLines[i];
|
||||
typeLines += currentCodeLine + "\r\n";
|
||||
if (typeMap[key]) {
|
||||
const typeInfo = typeMap[key][i];
|
||||
if (typeInfo) {
|
||||
typeInfo.forEach(ty => {
|
||||
typeLines += ">" + ty + "\r\n";
|
||||
});
|
||||
if (i + 1 < codeLines.length && (codeLines[i + 1].match(/^\s*[{|}]\s*$/) || codeLines[i + 1].trim() === "")) {
|
||||
}
|
||||
else {
|
||||
typeLines += "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Preserve legacy behavior
|
||||
if (lastIndexWritten === undefined) {
|
||||
for (let i = 0; i < codeLines.length; i++) {
|
||||
const currentCodeLine = codeLines[i];
|
||||
typeLines += currentCodeLine + "\r\n";
|
||||
typeLines += "No type information for this code.";
|
||||
}
|
||||
}
|
||||
yield [checkDuplicatedFileName(file.unitName, dupeCase), typeLines];
|
||||
typeLines = "";
|
||||
else {
|
||||
if (lastIndexWritten + 1 < codeLines.length) {
|
||||
if (!((lastIndexWritten + 1 < codeLines.length) && (codeLines[lastIndexWritten + 1].match(/^\s*[{|}]\s*$/) || codeLines[lastIndexWritten + 1].trim() === ""))) {
|
||||
typeLines += "\r\n";
|
||||
}
|
||||
typeLines += codeLines.slice(lastIndexWritten + 1).join("\r\n");
|
||||
}
|
||||
typeLines += "\r\n";
|
||||
}
|
||||
yield [checkDuplicatedFileName(unitName, dupeCase), typeLines];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1726,7 +1718,7 @@ namespace Harness {
|
||||
}
|
||||
|
||||
function sanitizeTestFilePath(name: string) {
|
||||
return ts.normalizeSlashes(name.replace(/[\^<>:"|?*%]/g, "_")).replace(/\.\.\//g, "__dotdot/").toLowerCase();
|
||||
return ts.toPath(ts.normalizeSlashes(name.replace(/[\^<>:"|?*%]/g, "_")).replace(/\.\.\//g, "__dotdot/"), "", Utils.canonicalizeForHarness);
|
||||
}
|
||||
|
||||
// This does not need to exist strictly speaking, but many tests will need to be updated if it's removed
|
||||
@ -2070,7 +2062,6 @@ namespace Harness {
|
||||
export function runMultifileBaseline(relativeFileBase: string, extension: string, generateContent: () => IterableIterator<[string, string, number]> | IterableIterator<[string, string]>, opts?: BaselineOptions, referencedExtensions?: string[]): void {
|
||||
const gen = generateContent();
|
||||
const writtenFiles = ts.createMap<true>();
|
||||
const canonicalize = ts.createGetCanonicalFileName(/*caseSensitive*/ false); // This is done so tests work on windows _and_ linux
|
||||
/* tslint:disable-next-line:no-null-keyword */
|
||||
const errors: Error[] = [];
|
||||
if (gen !== null) {
|
||||
@ -2086,8 +2077,7 @@ namespace Harness {
|
||||
catch (e) {
|
||||
errors.push(e);
|
||||
}
|
||||
const path = ts.toPath(relativeFileName, "", canonicalize);
|
||||
writtenFiles.set(path, true);
|
||||
writtenFiles.set(relativeFileName, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2100,8 +2090,7 @@ namespace Harness {
|
||||
const missing: string[] = [];
|
||||
for (const name of existing) {
|
||||
const localCopy = name.substring(referenceDir.length - relativeFileBase.length);
|
||||
const path = ts.toPath(localCopy, "", canonicalize);
|
||||
if (!writtenFiles.has(path)) {
|
||||
if (!writtenFiles.has(localCopy)) {
|
||||
missing.push(localCopy);
|
||||
}
|
||||
}
|
||||
@ -2114,13 +2103,14 @@ namespace Harness {
|
||||
if (errors.length || missing.length) {
|
||||
let errorMsg = "";
|
||||
if (errors.length) {
|
||||
errorMsg += `The baseline for ${relativeFileBase} has changed:${"\n " + errors.map(e => e.message).join("\n ")}`;
|
||||
errorMsg += `The baseline for ${relativeFileBase} in ${errors.length} files has changed:${"\n " + errors.slice(0, 5).map(e => e.message).join("\n ") + (errors.length > 5 ? "\n" + ` and ${errors.length - 5} more` : "")}`;
|
||||
}
|
||||
if (errors.length && missing.length) {
|
||||
errorMsg += "\n";
|
||||
}
|
||||
if (missing.length) {
|
||||
errorMsg += `Baseline missing files:${"\n " + missing.join("\n ") + "\n"}Written:${"\n " + ts.arrayFrom(writtenFiles.keys()).join("\n ")}`;
|
||||
const writtenFilesArray = ts.arrayFrom(writtenFiles.keys());
|
||||
errorMsg += `Baseline missing ${missing.length} files:${"\n " + missing.slice(0, 5).join("\n ") + (missing.length > 5 ? "\n" + ` and ${missing.length - 5} more` : "") + "\n"}Written ${writtenFiles.size} files:${"\n " + writtenFilesArray.slice(0, 5).join("\n ") + (writtenFilesArray.length > 5 ? "\n" + ` and ${writtenFilesArray.length - 5} more` : "")}`;
|
||||
}
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
@ -26,9 +26,12 @@ namespace Harness.Parallel.Host {
|
||||
text?: string;
|
||||
}
|
||||
|
||||
const perfdataFileName = ".parallelperf.json";
|
||||
function readSavedPerfData(): {[testHash: string]: number} {
|
||||
const perfDataContents = Harness.IO.readFile(perfdataFileName);
|
||||
const perfdataFileNameFragment = ".parallelperf";
|
||||
function perfdataFileName(target?: string) {
|
||||
return `${perfdataFileNameFragment}${target ? `.${target}` : ""}.json`;
|
||||
}
|
||||
function readSavedPerfData(target?: string): {[testHash: string]: number} {
|
||||
const perfDataContents = Harness.IO.readFile(perfdataFileName(target));
|
||||
if (perfDataContents) {
|
||||
return JSON.parse(perfDataContents);
|
||||
}
|
||||
@ -44,8 +47,9 @@ namespace Harness.Parallel.Host {
|
||||
console.log("Discovering tests...");
|
||||
const discoverStart = +(new Date());
|
||||
const { statSync }: { statSync(path: string): { size: number }; } = require("fs");
|
||||
const tasks: { runner: TestRunnerKind, file: string, size: number }[] = [];
|
||||
const perfData = readSavedPerfData();
|
||||
let tasks: { runner: TestRunnerKind, file: string, size: number }[] = [];
|
||||
const newTasks: { runner: TestRunnerKind, file: string, size: number }[] = [];
|
||||
const perfData = readSavedPerfData(configOption);
|
||||
let totalCost = 0;
|
||||
let unknownValue: string | undefined;
|
||||
for (const runner of runners) {
|
||||
@ -60,8 +64,10 @@ namespace Harness.Parallel.Host {
|
||||
const hashedName = hashName(runner.kind(), file);
|
||||
size = perfData[hashedName];
|
||||
if (size === undefined) {
|
||||
size = Number.MAX_SAFE_INTEGER;
|
||||
size = 0;
|
||||
unknownValue = hashedName;
|
||||
newTasks.push({ runner: runner.kind(), file, size });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tasks.push({ runner: runner.kind(), file, size });
|
||||
@ -69,6 +75,7 @@ namespace Harness.Parallel.Host {
|
||||
}
|
||||
}
|
||||
tasks.sort((a, b) => a.size - b.size);
|
||||
tasks = tasks.concat(newTasks);
|
||||
// 1 fewer batches than threads to account for unittests running on the final thread
|
||||
const batchCount = runners.length === 1 ? workerCount : workerCount - 1;
|
||||
const packfraction = 0.9;
|
||||
@ -113,7 +120,7 @@ namespace Harness.Parallel.Host {
|
||||
child.on("message", (data: ParallelClientMessage) => {
|
||||
switch (data.type) {
|
||||
case "error": {
|
||||
console.error(`Test worker encounted unexpected error and was forced to close:
|
||||
console.error(`Test worker encounted unexpected error${data.payload.name ? ` during the execution of test ${data.payload.name}` : ""} and was forced to close:
|
||||
Message: ${data.payload.error}
|
||||
Stack: ${data.payload.stack}`);
|
||||
return process.exit(2);
|
||||
@ -174,7 +181,7 @@ namespace Harness.Parallel.Host {
|
||||
let scheduledTotal = 0;
|
||||
batcher: while (true) {
|
||||
for (let i = 0; i < batchCount; i++) {
|
||||
if (tasks.length === 0) {
|
||||
if (tasks.length <= workerCount) { // Keep a small reserve even in the suboptimally packed case
|
||||
console.log(`Suboptimal packing detected: no tests remain to be stolen. Reduce packing fraction from ${packfraction} to fix.`);
|
||||
break batcher;
|
||||
}
|
||||
@ -213,7 +220,9 @@ namespace Harness.Parallel.Host {
|
||||
worker.send({ type: "batch", payload });
|
||||
}
|
||||
else { // Unittest thread - send off just one test
|
||||
worker.send({ type: "test", payload: tasks.pop() });
|
||||
const payload = tasks.pop();
|
||||
ts.Debug.assert(!!payload); // The reserve kept above should ensure there is always an initial task available, even in suboptimal scenarios
|
||||
worker.send({ type: "test", payload });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +293,7 @@ namespace Harness.Parallel.Host {
|
||||
reporter.epilogue();
|
||||
}
|
||||
|
||||
Harness.IO.writeFile(perfdataFileName, JSON.stringify(newPerfData, null, 4)); // tslint:disable-line:no-null-keyword
|
||||
Harness.IO.writeFile(perfdataFileName(configOption), JSON.stringify(newPerfData, null, 4)); // tslint:disable-line:no-null-keyword
|
||||
|
||||
process.exit(errorResults.length);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ namespace Harness.Parallel {
|
||||
export type ParallelCloseMessage = { type: "close" } | never;
|
||||
export type ParallelHostMessage = ParallelTestMessage | ParallelCloseMessage | ParallelBatchMessage;
|
||||
|
||||
export type ParallelErrorMessage = { type: "error", payload: { error: string, stack: string } } | never;
|
||||
export type ParallelErrorMessage = { type: "error", payload: { error: string, stack: string, name?: string } } | never;
|
||||
export type ErrorInfo = ParallelErrorMessage["payload"] & { name: string };
|
||||
export type ParallelResultMessage = { type: "result", payload: { passing: number, errors: ErrorInfo[], duration: number, runner: TestRunnerKind, file: string } } | never;
|
||||
export type ParallelBatchProgressMessage = { type: "progress", payload: ParallelResultMessage["payload"] } | never;
|
||||
|
||||
@ -53,17 +53,41 @@ namespace Harness.Parallel.Worker {
|
||||
const savedTestList = testList;
|
||||
|
||||
testList = [];
|
||||
callback.call(fakeContext);
|
||||
beforeFunc && beforeFunc();
|
||||
beforeFunc = undefined;
|
||||
try {
|
||||
callback.call(fakeContext);
|
||||
}
|
||||
catch (e) {
|
||||
errors.push({ error: `Error executing suite: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
|
||||
return cleanup();
|
||||
}
|
||||
try {
|
||||
beforeFunc && beforeFunc();
|
||||
}
|
||||
catch (e) {
|
||||
errors.push({ error: `Error executing before function: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
|
||||
return cleanup();
|
||||
}
|
||||
finally {
|
||||
beforeFunc = undefined;
|
||||
}
|
||||
testList.forEach(({ name, callback, kind }) => executeCallback(name, callback, kind));
|
||||
testList.length = 0;
|
||||
testList = savedTestList;
|
||||
|
||||
afterFunc && afterFunc();
|
||||
afterFunc = undefined;
|
||||
beforeEachFunc = savedBeforeEach;
|
||||
namestack.pop();
|
||||
try {
|
||||
afterFunc && afterFunc();
|
||||
}
|
||||
catch (e) {
|
||||
errors.push({ error: `Error executing after function: ${e.message}`, stack: e.stack, name: namestack.join(" ") });
|
||||
}
|
||||
finally {
|
||||
afterFunc = undefined;
|
||||
cleanup();
|
||||
}
|
||||
function cleanup() {
|
||||
testList.length = 0;
|
||||
testList = savedTestList;
|
||||
beforeEachFunc = savedBeforeEach;
|
||||
namestack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
function executeCallback(name: string, callback: Function, kind: "suite" | "test") {
|
||||
@ -82,13 +106,15 @@ namespace Harness.Parallel.Worker {
|
||||
retries() { return this; },
|
||||
slow() { return this; },
|
||||
};
|
||||
name = [...namestack, name].join(" ");
|
||||
namestack.push(name);
|
||||
name = namestack.join(" ");
|
||||
if (beforeEachFunc) {
|
||||
try {
|
||||
beforeEachFunc();
|
||||
}
|
||||
catch (error) {
|
||||
errors.push({ error: error.message, stack: error.stack, name });
|
||||
namestack.pop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -101,6 +127,9 @@ namespace Harness.Parallel.Worker {
|
||||
errors.push({ error: error.message, stack: error.stack, name });
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
namestack.pop();
|
||||
}
|
||||
passing++;
|
||||
}
|
||||
else {
|
||||
@ -124,6 +153,9 @@ namespace Harness.Parallel.Worker {
|
||||
errors.push({ error: error.message, stack: error.stack, name });
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
namestack.pop();
|
||||
}
|
||||
if (!completed) {
|
||||
errors.push({ error: "Test completes asynchronously, which is unsupported by the parallel harness", stack: "", name });
|
||||
}
|
||||
@ -172,7 +204,7 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
});
|
||||
process.on("uncaughtException", error => {
|
||||
const message: ParallelErrorMessage = { type: "error", payload: { error: error.message, stack: error.stack } };
|
||||
const message: ParallelErrorMessage = { type: "error", payload: { error: error.message, stack: error.stack, name: namestack.join(" ") } };
|
||||
try {
|
||||
process.send(message);
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ interface TaskSet {
|
||||
files: string[];
|
||||
}
|
||||
|
||||
let configOption: string;
|
||||
function handleTestConfig() {
|
||||
if (testConfigContent !== "") {
|
||||
const testConfig = <TestConfig>JSON.parse(testConfigContent);
|
||||
@ -136,6 +137,13 @@ function handleTestConfig() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!configOption) {
|
||||
configOption = option;
|
||||
}
|
||||
else {
|
||||
configOption += "+" + option;
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case "compiler":
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
|
||||
@ -39,6 +39,8 @@ namespace RWC {
|
||||
const baseName = /(.*)\/(.*).json/.exec(ts.normalizeSlashes(jsonPath))[2];
|
||||
let currentDirectory: string;
|
||||
let useCustomLibraryFile: boolean;
|
||||
let skipTypeAndSymbolbaselines = false;
|
||||
const typeAndSymbolSizeLimit = 10000000;
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
@ -52,6 +54,7 @@ namespace RWC {
|
||||
// or to use lib.d.ts inside the json object. If the flag is true, use the lib.d.ts inside json file
|
||||
// otherwise use the lib.d.ts from built/local
|
||||
useCustomLibraryFile = undefined;
|
||||
skipTypeAndSymbolbaselines = false;
|
||||
});
|
||||
|
||||
it("can compile", function(this: Mocha.ITestCallbackContext) {
|
||||
@ -61,6 +64,7 @@ namespace RWC {
|
||||
const ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath));
|
||||
currentDirectory = ioLog.currentDirectory;
|
||||
useCustomLibraryFile = ioLog.useCustomLibraryFile;
|
||||
skipTypeAndSymbolbaselines = ioLog.filesRead.reduce((acc, elem) => (elem && elem.result && elem.result.contents) ? acc + elem.result.contents.length : acc, 0) > typeAndSymbolSizeLimit;
|
||||
runWithIOLog(ioLog, () => {
|
||||
opts = ts.parseCommandLine(ioLog.arguments, fileName => Harness.IO.readFile(fileName));
|
||||
assert.equal(opts.errors.length, 0);
|
||||
@ -217,10 +221,10 @@ namespace RWC {
|
||||
|
||||
it("has the expected types", () => {
|
||||
// We don't need to pass the extension here because "doTypeAndSymbolBaseline" will append appropriate extension of ".types" or ".symbols"
|
||||
Harness.Compiler.doTypeAndSymbolBaseline(baseName, compilerResult, inputFiles
|
||||
Harness.Compiler.doTypeAndSymbolBaseline(baseName, compilerResult.program, inputFiles
|
||||
.concat(otherFiles)
|
||||
.filter(file => !!compilerResult.program.getSourceFile(file.unitName))
|
||||
.filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true);
|
||||
.filter(e => !Harness.isDefaultLibraryFile(e.unitName)), baselineOpts, /*multifile*/ true, skipTypeAndSymbolbaselines);
|
||||
});
|
||||
|
||||
// Ideally, a generated declaration file will have no errors. But we allow generated
|
||||
|
||||
@ -1,13 +1,26 @@
|
||||
interface TypeWriterResult {
|
||||
interface TypeWriterTypeResult {
|
||||
line: number;
|
||||
syntaxKind: number;
|
||||
sourceText: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface TypeWriterSymbolResult {
|
||||
line: number;
|
||||
syntaxKind: number;
|
||||
sourceText: string;
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
interface TypeWriterResult {
|
||||
line: number;
|
||||
syntaxKind: number;
|
||||
sourceText: string;
|
||||
symbol?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
class TypeWriterWalker {
|
||||
results: TypeWriterResult[];
|
||||
currentSourceFile: ts.SourceFile;
|
||||
|
||||
private checker: ts.TypeChecker;
|
||||
@ -20,57 +33,93 @@ class TypeWriterWalker {
|
||||
: program.getTypeChecker();
|
||||
}
|
||||
|
||||
public getTypeAndSymbols(fileName: string): TypeWriterResult[] {
|
||||
public *getSymbols(fileName: string): IterableIterator<TypeWriterSymbolResult> {
|
||||
const sourceFile = this.program.getSourceFile(fileName);
|
||||
this.currentSourceFile = sourceFile;
|
||||
this.results = [];
|
||||
this.visitNode(sourceFile);
|
||||
return this.results;
|
||||
const gen = this.visitNode(sourceFile, /*isSymbolWalk*/ true);
|
||||
for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) {
|
||||
yield value as TypeWriterSymbolResult;
|
||||
}
|
||||
}
|
||||
|
||||
private visitNode(node: ts.Node): void {
|
||||
public *getTypes(fileName: string): IterableIterator<TypeWriterTypeResult> {
|
||||
const sourceFile = this.program.getSourceFile(fileName);
|
||||
this.currentSourceFile = sourceFile;
|
||||
const gen = this.visitNode(sourceFile, /*isSymbolWalk*/ false);
|
||||
for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) {
|
||||
yield value as TypeWriterTypeResult;
|
||||
}
|
||||
}
|
||||
|
||||
private *visitNode(node: ts.Node, isSymbolWalk: boolean): IterableIterator<TypeWriterResult> {
|
||||
if (ts.isPartOfExpression(node) || node.kind === ts.SyntaxKind.Identifier) {
|
||||
this.logTypeAndSymbol(node);
|
||||
const result = this.writeTypeOrSymbol(node, isSymbolWalk);
|
||||
if (result) {
|
||||
yield result;
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEachChild(node, child => this.visitNode(child));
|
||||
const children: ts.Node[] = [];
|
||||
ts.forEachChild(node, child => void children.push(child));
|
||||
for (const child of children) {
|
||||
const gen = this.visitNode(child, isSymbolWalk);
|
||||
for (let {done, value} = gen.next(); !done; { done, value } = gen.next()) {
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private logTypeAndSymbol(node: ts.Node): void {
|
||||
private writeTypeOrSymbol(node: ts.Node, isSymbolWalk: boolean): TypeWriterResult {
|
||||
const actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos);
|
||||
const lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos);
|
||||
const sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
|
||||
|
||||
// Workaround to ensure we output 'C' instead of 'typeof C' for base class expressions
|
||||
// let type = this.checker.getTypeAtLocation(node);
|
||||
const type = node.parent && ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent) && this.checker.getTypeAtLocation(node.parent) || this.checker.getTypeAtLocation(node);
|
||||
|
||||
ts.Debug.assert(type !== undefined, "type doesn't exist");
|
||||
const symbol = this.checker.getSymbolAtLocation(node);
|
||||
|
||||
const typeString = this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation);
|
||||
let symbolString: string;
|
||||
if (symbol) {
|
||||
symbolString = "Symbol(" + this.checker.symbolToString(symbol, node.parent);
|
||||
if (symbol.declarations) {
|
||||
for (const declaration of symbol.declarations) {
|
||||
symbolString += ", ";
|
||||
const declSourceFile = declaration.getSourceFile();
|
||||
const declLineAndCharacter = declSourceFile.getLineAndCharacterOfPosition(declaration.pos);
|
||||
const fileName = ts.getBaseFileName(declSourceFile.fileName);
|
||||
const isLibFile = /lib(.*)\.d\.ts/i.test(fileName);
|
||||
symbolString += `Decl(${ fileName }, ${ isLibFile ? "--" : declLineAndCharacter.line }, ${ isLibFile ? "--" : declLineAndCharacter.character })`;
|
||||
}
|
||||
}
|
||||
symbolString += ")";
|
||||
if (!isSymbolWalk) {
|
||||
// Workaround to ensure we output 'C' instead of 'typeof C' for base class expressions
|
||||
// let type = this.checker.getTypeAtLocation(node);
|
||||
const type = node.parent && ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent) && this.checker.getTypeAtLocation(node.parent) || this.checker.getTypeAtLocation(node);
|
||||
const typeString = type ? this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation) : "No type information available!";
|
||||
return {
|
||||
line: lineAndCharacter.line,
|
||||
syntaxKind: node.kind,
|
||||
sourceText,
|
||||
type: typeString
|
||||
};
|
||||
}
|
||||
|
||||
this.results.push({
|
||||
const symbol = this.checker.getSymbolAtLocation(node);
|
||||
if (!symbol) {
|
||||
return;
|
||||
}
|
||||
let symbolString = "Symbol(" + this.checker.symbolToString(symbol, node.parent);
|
||||
if (symbol.declarations) {
|
||||
let count = 0;
|
||||
for (const declaration of symbol.declarations) {
|
||||
if (count >= 5) {
|
||||
symbolString += ` ... and ${symbol.declarations.length - count} more`;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
symbolString += ", ";
|
||||
if ((declaration as any)["__symbolTestOutputCache"]) {
|
||||
symbolString += (declaration as any)["__symbolTestOutputCache"];
|
||||
continue;
|
||||
}
|
||||
const declSourceFile = declaration.getSourceFile();
|
||||
const declLineAndCharacter = declSourceFile.getLineAndCharacterOfPosition(declaration.pos);
|
||||
const fileName = ts.getBaseFileName(declSourceFile.fileName);
|
||||
const isLibFile = /lib(.*)\.d\.ts/i.test(fileName);
|
||||
const declText = `Decl(${ fileName }, ${ isLibFile ? "--" : declLineAndCharacter.line }, ${ isLibFile ? "--" : declLineAndCharacter.character })`;
|
||||
symbolString += declText;
|
||||
(declaration as any)["__symbolTestOutputCache"] = declText;
|
||||
}
|
||||
}
|
||||
symbolString += ")";
|
||||
return {
|
||||
line: lineAndCharacter.line,
|
||||
syntaxKind: node.kind,
|
||||
sourceText,
|
||||
type: typeString,
|
||||
symbol: symbolString
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -139,6 +139,16 @@ namespace ts {
|
||||
`/**
|
||||
* @param
|
||||
*/`);
|
||||
|
||||
parsesIncorrectly("noType",
|
||||
`/**
|
||||
* @type
|
||||
*/`);
|
||||
|
||||
parsesIncorrectly("@augments with no type",
|
||||
`/**
|
||||
* @augments
|
||||
*/`);
|
||||
});
|
||||
|
||||
describe("parsesCorrectly", () => {
|
||||
@ -148,12 +158,6 @@ namespace ts {
|
||||
*/`);
|
||||
|
||||
|
||||
parsesCorrectly("noType",
|
||||
`/**
|
||||
* @type
|
||||
*/`);
|
||||
|
||||
|
||||
parsesCorrectly("noReturnType",
|
||||
`/**
|
||||
* @return
|
||||
|
||||
@ -136,6 +136,28 @@ namespace ts {
|
||||
createSourceFile("source.ts", "", ScriptTarget.ESNext))
|
||||
);
|
||||
|
||||
printsCorrectly("emptyGlobalAugmentation", {}, printer => printer.printNode(
|
||||
EmitHint.Unspecified,
|
||||
createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ [createToken(SyntaxKind.DeclareKeyword)],
|
||||
createIdentifier("global"),
|
||||
createModuleBlock(emptyArray),
|
||||
NodeFlags.GlobalAugmentation),
|
||||
createSourceFile("source.ts", "", ScriptTarget.ES2015)
|
||||
));
|
||||
|
||||
printsCorrectly("emptyGlobalAugmentationWithNoDeclareKeyword", {}, printer => printer.printNode(
|
||||
EmitHint.Unspecified,
|
||||
createModuleDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
createIdentifier("global"),
|
||||
createModuleBlock(emptyArray),
|
||||
NodeFlags.GlobalAugmentation),
|
||||
createSourceFile("source.ts", "", ScriptTarget.ES2015)
|
||||
));
|
||||
|
||||
// https://github.com/Microsoft/TypeScript/issues/15971
|
||||
printsCorrectly("classWithOptionalMethodAndProperty", {}, printer => printer.printNode(
|
||||
EmitHint.Unspecified,
|
||||
|
||||
@ -509,7 +509,7 @@ namespace ts.server {
|
||||
class InProcClient {
|
||||
private server: InProcSession;
|
||||
private seq = 0;
|
||||
private callbacks: Array<(resp: protocol.Response) => void> = [];
|
||||
private callbacks: ((resp: protocol.Response) => void)[] = [];
|
||||
private eventHandlers = createMap<(args: any) => void>();
|
||||
|
||||
handle(msg: protocol.Message): void {
|
||||
|
||||
8
src/lib/es2015.core.d.ts
vendored
8
src/lib/es2015.core.d.ts
vendored
@ -10,7 +10,7 @@ interface Array<T> {
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T | undefined;
|
||||
find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
@ -21,7 +21,7 @@ interface Array<T> {
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
@ -52,13 +52,13 @@ interface ArrayConstructor {
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U = T>(arrayLike: ArrayLike<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
from<T, U = T>(arrayLike: ArrayLike<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of<T>(...items: T[]): Array<T>;
|
||||
of<T>(...items: T[]): T[];
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
|
||||
2
src/lib/es2015.iterable.d.ts
vendored
2
src/lib/es2015.iterable.d.ts
vendored
@ -54,7 +54,7 @@ interface ArrayConstructor {
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U = T>(iterable: Iterable<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
from<T, U = T>(iterable: Iterable<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[];
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
|
||||
2
src/lib/es2015.reflect.d.ts
vendored
2
src/lib/es2015.reflect.d.ts
vendored
@ -8,7 +8,7 @@ declare namespace Reflect {
|
||||
function getPrototypeOf(target: object): object;
|
||||
function has(target: object, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: object): boolean;
|
||||
function ownKeys(target: object): Array<PropertyKey>;
|
||||
function ownKeys(target: object): PropertyKey[];
|
||||
function preventExtensions(target: object): boolean;
|
||||
function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: object, proto: any): boolean;
|
||||
|
||||
@ -84,7 +84,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
export interface SafeList {
|
||||
[name: string]: { match: RegExp, exclude?: Array<Array<string | number>>, types?: string[] };
|
||||
[name: string]: { match: RegExp, exclude?: (string | number)[][], types?: string[] };
|
||||
}
|
||||
|
||||
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions: CommandLineOption[]): Map<Map<number>> {
|
||||
@ -1780,7 +1780,7 @@ namespace ts.server {
|
||||
|
||||
if (rule.exclude) {
|
||||
for (const exclude of rule.exclude) {
|
||||
const processedRule = root.replace(rule.match, (...groups: Array<string>) => {
|
||||
const processedRule = root.replace(rule.match, (...groups: string[]) => {
|
||||
return exclude.map(groupNumberOrString => {
|
||||
// RegExp group numbers are 1-based, but the first element in groups
|
||||
// is actually the original string, so it all works out in the end.
|
||||
|
||||
@ -515,7 +515,7 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
|
||||
// Source file ID → symbol ID → Whether the symbol has been searched for in the source file.
|
||||
private readonly sourceFileToSeenSymbols: Array<Array<true>> = [];
|
||||
private readonly sourceFileToSeenSymbols: true[][] = [];
|
||||
/** Returns `true` the first time we search for a symbol in a file and `false` afterwards. */
|
||||
markSearchedSymbol(sourceFile: SourceFile, symbol: Symbol): boolean {
|
||||
const sourceId = getNodeId(sourceFile);
|
||||
|
||||
@ -53,28 +53,19 @@ namespace ts.formatting {
|
||||
return res;
|
||||
|
||||
function advance(): void {
|
||||
Debug.assert(scanner !== undefined, "Scanner should be present");
|
||||
|
||||
lastTokenInfo = undefined;
|
||||
const isStarted = scanner.getStartPos() !== startPos;
|
||||
|
||||
if (isStarted) {
|
||||
if (trailingTrivia) {
|
||||
Debug.assert(trailingTrivia.length !== 0);
|
||||
wasNewLine = lastOrUndefined(trailingTrivia).kind === SyntaxKind.NewLineTrivia;
|
||||
}
|
||||
else {
|
||||
wasNewLine = false;
|
||||
}
|
||||
wasNewLine = trailingTrivia && lastOrUndefined(trailingTrivia)!.kind === SyntaxKind.NewLineTrivia;
|
||||
}
|
||||
else {
|
||||
scanner.scan();
|
||||
}
|
||||
|
||||
leadingTrivia = undefined;
|
||||
trailingTrivia = undefined;
|
||||
|
||||
if (!isStarted) {
|
||||
scanner.scan();
|
||||
}
|
||||
|
||||
let pos = scanner.getStartPos();
|
||||
|
||||
// Read leading trivia and token
|
||||
@ -94,25 +85,20 @@ namespace ts.formatting {
|
||||
|
||||
pos = scanner.getStartPos();
|
||||
|
||||
if (!leadingTrivia) {
|
||||
leadingTrivia = [];
|
||||
}
|
||||
leadingTrivia.push(item);
|
||||
leadingTrivia = append(leadingTrivia, item);
|
||||
}
|
||||
|
||||
savedPos = scanner.getStartPos();
|
||||
}
|
||||
|
||||
function shouldRescanGreaterThanToken(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.GreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanToken:
|
||||
return true;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.GreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanToken:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -134,7 +120,7 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
function shouldRescanJsxText(node: Node): boolean {
|
||||
return node && node.kind === SyntaxKind.JsxText;
|
||||
return node.kind === SyntaxKind.JsxText;
|
||||
}
|
||||
|
||||
function shouldRescanSlashToken(container: Node): boolean {
|
||||
@ -151,16 +137,7 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
function readTokenInfo(n: Node): TokenInfo {
|
||||
Debug.assert(scanner !== undefined);
|
||||
|
||||
if (!isOnToken()) {
|
||||
// scanner is not on the token (either advance was not called yet or scanner is already past the end position)
|
||||
return {
|
||||
leadingTrivia,
|
||||
trailingTrivia: undefined,
|
||||
token: undefined
|
||||
};
|
||||
}
|
||||
Debug.assert(isOnToken());
|
||||
|
||||
// normally scanner returns the smallest available token
|
||||
// check the kind of context node to determine if scanner should have more greedy behavior and consume more text.
|
||||
@ -194,33 +171,7 @@ namespace ts.formatting {
|
||||
scanner.scan();
|
||||
}
|
||||
|
||||
let currentToken = scanner.getToken();
|
||||
|
||||
if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) {
|
||||
currentToken = scanner.reScanGreaterToken();
|
||||
Debug.assert(n.kind === currentToken);
|
||||
lastScanAction = ScanAction.RescanGreaterThanToken;
|
||||
}
|
||||
else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) {
|
||||
currentToken = scanner.reScanSlashToken();
|
||||
Debug.assert(n.kind === currentToken);
|
||||
lastScanAction = ScanAction.RescanSlashToken;
|
||||
}
|
||||
else if (expectedScanAction === ScanAction.RescanTemplateToken && currentToken === SyntaxKind.CloseBraceToken) {
|
||||
currentToken = scanner.reScanTemplateToken();
|
||||
lastScanAction = ScanAction.RescanTemplateToken;
|
||||
}
|
||||
else if (expectedScanAction === ScanAction.RescanJsxIdentifier) {
|
||||
currentToken = scanner.scanJsxIdentifier();
|
||||
lastScanAction = ScanAction.RescanJsxIdentifier;
|
||||
}
|
||||
else if (expectedScanAction === ScanAction.RescanJsxText) {
|
||||
currentToken = scanner.reScanJsxToken();
|
||||
lastScanAction = ScanAction.RescanJsxText;
|
||||
}
|
||||
else {
|
||||
lastScanAction = ScanAction.Scan;
|
||||
}
|
||||
let currentToken = getNextToken(n, expectedScanAction);
|
||||
|
||||
const token: TextRangeWithKind = {
|
||||
pos: scanner.getStartPos(),
|
||||
@ -261,9 +212,47 @@ namespace ts.formatting {
|
||||
return fixTokenKind(lastTokenInfo, n);
|
||||
}
|
||||
|
||||
function isOnToken(): boolean {
|
||||
Debug.assert(scanner !== undefined);
|
||||
function getNextToken(n: Node, expectedScanAction: ScanAction): SyntaxKind {
|
||||
const token = scanner.getToken();
|
||||
lastScanAction = ScanAction.Scan;
|
||||
switch (expectedScanAction) {
|
||||
case ScanAction.RescanGreaterThanToken:
|
||||
if (token === SyntaxKind.GreaterThanToken) {
|
||||
lastScanAction = ScanAction.RescanGreaterThanToken;
|
||||
const newToken = scanner.reScanGreaterToken();
|
||||
Debug.assert(n.kind === newToken);
|
||||
return newToken;
|
||||
}
|
||||
break;
|
||||
case ScanAction.RescanSlashToken:
|
||||
if (startsWithSlashToken(token)) {
|
||||
lastScanAction = ScanAction.RescanSlashToken;
|
||||
const newToken = scanner.reScanSlashToken();
|
||||
Debug.assert(n.kind === newToken);
|
||||
return newToken;
|
||||
}
|
||||
break;
|
||||
case ScanAction.RescanTemplateToken:
|
||||
if (token === SyntaxKind.CloseBraceToken) {
|
||||
lastScanAction = ScanAction.RescanTemplateToken;
|
||||
return scanner.reScanTemplateToken();
|
||||
}
|
||||
break;
|
||||
case ScanAction.RescanJsxIdentifier:
|
||||
lastScanAction = ScanAction.RescanJsxIdentifier;
|
||||
return scanner.scanJsxIdentifier();
|
||||
case ScanAction.RescanJsxText:
|
||||
lastScanAction = ScanAction.RescanJsxText;
|
||||
return scanner.reScanJsxToken();
|
||||
case ScanAction.Scan:
|
||||
break;
|
||||
default:
|
||||
Debug.assertNever(expectedScanAction);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
function isOnToken(): boolean {
|
||||
const current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
||||
const startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos();
|
||||
return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace ts.FindAllReferences {
|
||||
export interface ImportsResult {
|
||||
/** For every import of the symbol, the location and local symbol for the import. */
|
||||
importSearches: Array<[Identifier, Symbol]>;
|
||||
importSearches: [Identifier, Symbol][];
|
||||
/** For rename imports/exports `{ foo as bar }`, `foo` is not a local, so it may be added as a reference immediately without further searching. */
|
||||
singleReferences: Identifier[];
|
||||
/** List of source files that may (or may not) use the symbol via a namespace. (For UMD modules this is every file.) */
|
||||
@ -180,7 +180,7 @@ namespace ts.FindAllReferences {
|
||||
* But re-exports will be placed in 'singleReferences' since they cannot be locally referenced.
|
||||
*/
|
||||
function getSearchesFromDirectImports(directImports: Importer[], exportSymbol: Symbol, exportKind: ExportKind, checker: TypeChecker, isForRename: boolean): Pick<ImportsResult, "importSearches" | "singleReferences"> {
|
||||
const importSearches: Array<[Identifier, Symbol]> = [];
|
||||
const importSearches: [Identifier, Symbol][] = [];
|
||||
const singleReferences: Identifier[] = [];
|
||||
function addSearch(location: Identifier, symbol: Symbol): void {
|
||||
importSearches.push([location, symbol]);
|
||||
|
||||
@ -43,4 +43,8 @@ namespace ts {
|
||||
return refactor && refactor.getEditsForAction(context, actionName);
|
||||
}
|
||||
}
|
||||
|
||||
export function getRefactorContextLength(context: RefactorContext): number {
|
||||
return context.endPosition === undefined ? 0 : context.endPosition - context.startPosition;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ namespace ts.refactor.extractMethod {
|
||||
|
||||
/** Compute the associated code actions */
|
||||
function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined {
|
||||
const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: context.endPosition - context.startPosition });
|
||||
const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: getRefactorContextLength(context) });
|
||||
|
||||
const targetRange: TargetRange = rangeToExtract.targetRange;
|
||||
if (targetRange === undefined) {
|
||||
@ -66,8 +66,7 @@ namespace ts.refactor.extractMethod {
|
||||
}
|
||||
|
||||
function getEditsForAction(context: RefactorContext, actionName: string): RefactorEditInfo | undefined {
|
||||
const length = context.endPosition === undefined ? 0 : context.endPosition - context.startPosition;
|
||||
const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length });
|
||||
const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: getRefactorContextLength(context) });
|
||||
const targetRange: TargetRange = rangeToExtract.targetRange;
|
||||
|
||||
const parsedIndexMatch = /^scope_(\d+)$/.exec(actionName);
|
||||
@ -148,7 +147,7 @@ namespace ts.refactor.extractMethod {
|
||||
*/
|
||||
// exported only for tests
|
||||
export function getRangeToExtract(sourceFile: SourceFile, span: TextSpan): RangeToExtract {
|
||||
const length = span.length || 0;
|
||||
const { length } = span;
|
||||
|
||||
if (length === 0) {
|
||||
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.StatementOrExpressionExpected)] };
|
||||
@ -286,7 +285,7 @@ namespace ts.refactor.extractMethod {
|
||||
|
||||
let errors: Diagnostic[];
|
||||
let permittedJumps = PermittedJumps.Return;
|
||||
let seenLabels: Array<__String>;
|
||||
let seenLabels: __String[];
|
||||
|
||||
visit(nodeToCheck);
|
||||
|
||||
|
||||
@ -568,11 +568,18 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function realizeDiagnostics(diagnostics: ReadonlyArray<Diagnostic>, newLine: string): { message: string; start: number; length: number; category: string; code: number; }[] {
|
||||
interface RealizedDiagnostic {
|
||||
message: string;
|
||||
start: number;
|
||||
length: number;
|
||||
category: string;
|
||||
code: number;
|
||||
}
|
||||
export function realizeDiagnostics(diagnostics: ReadonlyArray<Diagnostic>, newLine: string): RealizedDiagnostic[] {
|
||||
return diagnostics.map(d => realizeDiagnostic(d, newLine));
|
||||
}
|
||||
|
||||
function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; code: number; } {
|
||||
function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): RealizedDiagnostic {
|
||||
return {
|
||||
message: flattenDiagnosticMessageText(diagnostic.messageText, newLine),
|
||||
start: diagnostic.start,
|
||||
|
||||
@ -226,7 +226,7 @@ namespace ts.textChanges {
|
||||
Debug.fail("node is not a list element");
|
||||
return this;
|
||||
}
|
||||
const index = containingList.indexOf(node);
|
||||
const index = indexOfNode(containingList, node);
|
||||
if (index < 0) {
|
||||
return this;
|
||||
}
|
||||
@ -358,7 +358,7 @@ namespace ts.textChanges {
|
||||
Debug.fail("node is not a list element");
|
||||
return this;
|
||||
}
|
||||
const index = containingList.indexOf(after);
|
||||
const index = indexOfNode(containingList, after);
|
||||
if (index < 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -597,7 +597,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
const children = list.getChildren();
|
||||
const listItemIndex = indexOf(children, node);
|
||||
const listItemIndex = indexOfNode(children, node);
|
||||
|
||||
return {
|
||||
listItemIndex,
|
||||
@ -1100,7 +1100,7 @@ namespace ts {
|
||||
|
||||
/** Returns `true` the first time it encounters a node and `false` afterwards. */
|
||||
export function nodeSeenTracker<T extends Node>(): (node: T) => boolean {
|
||||
const seen: Array<true> = [];
|
||||
const seen: true[] = [];
|
||||
return node => {
|
||||
const id = getNodeId(node);
|
||||
return !seen[id] && (seen[id] = true);
|
||||
|
||||
6
tests/baselines/reference/ArrowFunction1.symbols
Normal file
6
tests/baselines/reference/ArrowFunction1.symbols
Normal file
@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts ===
|
||||
var v = (a: ) => {
|
||||
>v : Symbol(v, Decl(ArrowFunction1.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(ArrowFunction1.ts, 0, 9))
|
||||
|
||||
};
|
||||
8
tests/baselines/reference/ArrowFunction1.types
Normal file
8
tests/baselines/reference/ArrowFunction1.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts ===
|
||||
var v = (a: ) => {
|
||||
>v : (a: any) => void
|
||||
>(a: ) => { } : (a: any) => void
|
||||
>a : any
|
||||
> : No type information available!
|
||||
|
||||
};
|
||||
6
tests/baselines/reference/ArrowFunction3.symbols
Normal file
6
tests/baselines/reference/ArrowFunction3.symbols
Normal file
@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts ===
|
||||
var v = (a): => {
|
||||
>v : Symbol(v, Decl(ArrowFunction3.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(ArrowFunction3.ts, 0, 9))
|
||||
|
||||
};
|
||||
8
tests/baselines/reference/ArrowFunction3.types
Normal file
8
tests/baselines/reference/ArrowFunction3.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts ===
|
||||
var v = (a): => {
|
||||
>v : (a: any) => any
|
||||
>(a): => { } : (a: any) => any
|
||||
>a : any
|
||||
> : No type information available!
|
||||
|
||||
};
|
||||
@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/ArrowFunctionExpression1.ts ===
|
||||
var v = (public x: string) => { };
|
||||
>v : Symbol(v, Decl(ArrowFunctionExpression1.ts, 0, 3))
|
||||
>x : Symbol(x, Decl(ArrowFunctionExpression1.ts, 0, 9))
|
||||
|
||||
6
tests/baselines/reference/ArrowFunctionExpression1.types
Normal file
6
tests/baselines/reference/ArrowFunctionExpression1.types
Normal file
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/ArrowFunctionExpression1.ts ===
|
||||
var v = (public x: string) => { };
|
||||
>v : (public x: string) => void
|
||||
>(public x: string) => { } : (public x: string) => void
|
||||
>x : string
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts ===
|
||||
// all expected to be errors
|
||||
|
||||
class clodule1<T>{
|
||||
>clodule1 : Symbol(clodule1, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 2, 15))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule1.id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 2, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule1.value, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 4, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 2, 15))
|
||||
}
|
||||
|
||||
module clodule1 {
|
||||
>clodule1 : Symbol(clodule1, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 6, 1))
|
||||
|
||||
function f(x: T) { }
|
||||
>f : Symbol(f, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 8, 17))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 9, 15))
|
||||
}
|
||||
|
||||
class clodule2<T>{
|
||||
>clodule2 : Symbol(clodule2, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 10, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 16, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 12, 15))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule2.id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 12, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule2.value, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 14, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 12, 15))
|
||||
}
|
||||
|
||||
module clodule2 {
|
||||
>clodule2 : Symbol(clodule2, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 10, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 16, 1))
|
||||
|
||||
var x: T;
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 19, 7))
|
||||
|
||||
class D<U extends T>{
|
||||
>D : Symbol(D, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 19, 13))
|
||||
>U : Symbol(U, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 21, 12))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(D.id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 21, 25))
|
||||
|
||||
value: U;
|
||||
>value : Symbol(D.value, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 22, 19))
|
||||
>U : Symbol(U, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 21, 12))
|
||||
}
|
||||
}
|
||||
|
||||
class clodule3<T>{
|
||||
>clodule3 : Symbol(clodule3, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 25, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 31, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 27, 15))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule3.id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 27, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule3.value, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 29, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 27, 15))
|
||||
}
|
||||
|
||||
module clodule3 {
|
||||
>clodule3 : Symbol(clodule3, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 25, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 31, 1))
|
||||
|
||||
export var y = { id: T };
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 34, 14))
|
||||
>id : Symbol(id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 34, 20))
|
||||
}
|
||||
|
||||
class clodule4<T>{
|
||||
>clodule4 : Symbol(clodule4, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 35, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 41, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 37, 15))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule4.id, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 37, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule4.value, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 39, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 37, 15))
|
||||
}
|
||||
|
||||
module clodule4 {
|
||||
>clodule4 : Symbol(clodule4, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 35, 1), Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 41, 1))
|
||||
|
||||
class D {
|
||||
>D : Symbol(D, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 43, 17))
|
||||
|
||||
name: T;
|
||||
>name : Symbol(D.name, Decl(ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts, 44, 13))
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,103 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts ===
|
||||
// all expected to be errors
|
||||
|
||||
class clodule1<T>{
|
||||
>clodule1 : clodule1<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
module clodule1 {
|
||||
>clodule1 : typeof clodule1
|
||||
|
||||
function f(x: T) { }
|
||||
>f : (x: any) => void
|
||||
>x : any
|
||||
>T : No type information available!
|
||||
}
|
||||
|
||||
class clodule2<T>{
|
||||
>clodule2 : clodule2<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
module clodule2 {
|
||||
>clodule2 : typeof clodule2
|
||||
|
||||
var x: T;
|
||||
>x : any
|
||||
>T : No type information available!
|
||||
|
||||
class D<U extends T>{
|
||||
>D : D<U>
|
||||
>U : U
|
||||
>T : No type information available!
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: U;
|
||||
>value : U
|
||||
>U : U
|
||||
}
|
||||
}
|
||||
|
||||
class clodule3<T>{
|
||||
>clodule3 : clodule3<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
module clodule3 {
|
||||
>clodule3 : typeof clodule3
|
||||
|
||||
export var y = { id: T };
|
||||
>y : { id: any; }
|
||||
>{ id: T } : { id: any; }
|
||||
>id : any
|
||||
>T : any
|
||||
}
|
||||
|
||||
class clodule4<T>{
|
||||
>clodule4 : clodule4<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
}
|
||||
|
||||
module clodule4 {
|
||||
>clodule4 : typeof clodule4
|
||||
|
||||
class D {
|
||||
>D : D
|
||||
|
||||
name: T;
|
||||
>name : any
|
||||
>T : No type information available!
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 5, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 0, 14))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule.id, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 0, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule.value, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 1, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 0, 14))
|
||||
|
||||
static fn<U>(id: U) { }
|
||||
>fn : Symbol(clodule.fn, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 2, 13))
|
||||
>U : Symbol(U, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 4, 14))
|
||||
>id : Symbol(id, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 4, 17))
|
||||
>U : Symbol(U, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 4, 14))
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 5, 1))
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): T {
|
||||
>fn : Symbol(clodule.fn, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 7, 16))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 26))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 31))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts, 9, 26))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : clodule<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
|
||||
static fn<U>(id: U) { }
|
||||
>fn : <U>(id: U) => void
|
||||
>U : U
|
||||
>id : U
|
||||
>U : U
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : typeof clodule
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): T {
|
||||
>fn : <T>(x: T, y: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 5, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 0, 14))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule.id, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 0, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule.value, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 1, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 0, 14))
|
||||
|
||||
static fn(id: string) { }
|
||||
>fn : Symbol(clodule.fn, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 2, 13))
|
||||
>id : Symbol(id, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 4, 14))
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 5, 1))
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): T {
|
||||
>fn : Symbol(clodule.fn, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 7, 16))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 26))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 31))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 23))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts, 9, 26))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : clodule<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
|
||||
static fn(id: string) { }
|
||||
>fn : (id: string) => void
|
||||
>id : string
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : typeof clodule
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): T {
|
||||
>fn : <T>(x: T, y: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 5, 1))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 14))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(clodule.id, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 18))
|
||||
|
||||
value: T;
|
||||
>value : Symbol(clodule.value, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 1, 15))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 14))
|
||||
|
||||
private static sfn(id: string) { return 42; }
|
||||
>sfn : Symbol(clodule.sfn, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 2, 13))
|
||||
>id : Symbol(id, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 4, 23))
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 5, 1))
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): number {
|
||||
>fn : Symbol(fn, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 7, 16))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 9, 23))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 9, 26))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 9, 23))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 9, 31))
|
||||
>T : Symbol(T, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 9, 23))
|
||||
|
||||
return clodule.sfn('a');
|
||||
>clodule.sfn : Symbol(clodule.sfn, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 2, 13))
|
||||
>clodule : Symbol(clodule, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 0, 0), Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 5, 1))
|
||||
>sfn : Symbol(clodule.sfn, Decl(ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts ===
|
||||
class clodule<T> {
|
||||
>clodule : clodule<T>
|
||||
>T : T
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
value: T;
|
||||
>value : T
|
||||
>T : T
|
||||
|
||||
private static sfn(id: string) { return 42; }
|
||||
>sfn : (id: string) => number
|
||||
>id : string
|
||||
>42 : 42
|
||||
}
|
||||
|
||||
module clodule {
|
||||
>clodule : typeof clodule
|
||||
|
||||
// error: duplicate identifier expected
|
||||
export function fn<T>(x: T, y: T): number {
|
||||
>fn : <T>(x: T, y: T) => number
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : T
|
||||
>T : T
|
||||
|
||||
return clodule.sfn('a');
|
||||
>clodule.sfn('a') : number
|
||||
>clodule.sfn : (id: string) => number
|
||||
>clodule : typeof clodule
|
||||
>sfn : (id: string) => number
|
||||
>'a' : "a"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 4, 1))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 1, 16))
|
||||
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 1, 33))
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 1, 55))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 4, 1))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 3, 37))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 3, 43))
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 4, 1))
|
||||
|
||||
export function Origin() { return null; } //expected duplicate identifier error
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 6, 14))
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 8, 1))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 16, 5))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 13, 20))
|
||||
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 13, 37))
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 13, 59))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 16, 5))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 15, 41))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 15, 47))
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 16, 5))
|
||||
|
||||
export function Origin() { return ""; }//expected duplicate identifier error
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts, 18, 25))
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
|
||||
>Origin : () => Point
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export function Origin() { return null; } //expected duplicate identifier error
|
||||
>Origin : () => any
|
||||
>null : null
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : typeof A
|
||||
|
||||
export class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
|
||||
>Origin : () => Point
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export function Origin() { return ""; }//expected duplicate identifier error
|
||||
>Origin : () => string
|
||||
>"" : ""
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 4, 1))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 1, 16))
|
||||
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 1, 33))
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 1, 55))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 4, 1))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 3, 28))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 3, 34))
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 4, 1))
|
||||
|
||||
export var Origin = ""; //expected duplicate identifier error
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 7, 14))
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 8, 1))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 16, 5))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 13, 20))
|
||||
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 13, 37))
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 13, 59))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 16, 5))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 15, 32))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 15, 38))
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 16, 5))
|
||||
|
||||
export var Origin = ""; //expected duplicate identifier error
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts, 19, 18))
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Point
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export var Origin = ""; //expected duplicate identifier error
|
||||
>Origin : string
|
||||
>"" : ""
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : typeof A
|
||||
|
||||
export class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Point
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
>y : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export var Origin = ""; //expected duplicate identifier error
|
||||
>Origin : string
|
||||
>"" : ""
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/class.ts ===
|
||||
module X.Y {
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
>x : Symbol(x, Decl(class.ts, 2, 20))
|
||||
>y : Symbol(y, Decl(class.ts, 2, 30))
|
||||
|
||||
this.x = x;
|
||||
>this.x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
>this : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
>x : Symbol(x, Decl(class.ts, 2, 20))
|
||||
|
||||
this.y = y;
|
||||
>this.y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
>this : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
>y : Symbol(y, Decl(class.ts, 2, 30))
|
||||
}
|
||||
x: number;
|
||||
>x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts ===
|
||||
module X.Y {
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
export var Origin = new Point(0, 0);
|
||||
>Origin : Symbol(Origin, Decl(module.ts, 2, 18))
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
>cl : Symbol(cl, Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>X.Y.Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>X.Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
>cl : Symbol(cl, Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>X.Y.Point.Origin : Symbol(X.Y.Point.Origin, Decl(module.ts, 2, 18))
|
||||
>X.Y.Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>X.Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>Origin : Symbol(X.Y.Point.Origin, Decl(module.ts, 2, 18))
|
||||
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(A.id, Decl(simple.ts, 0, 9))
|
||||
}
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
export var Instance = new A();
|
||||
>Instance : Symbol(Instance, Decl(simple.ts, 5, 14))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>A.Instance : Symbol(A.Instance, Decl(simple.ts, 5, 14))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
>Instance : Symbol(A.Instance, Decl(simple.ts, 5, 14))
|
||||
|
||||
var a = new A();
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
var a: { id: string };
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>id : Symbol(id, Decl(simple.ts, 11, 8))
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/class.ts ===
|
||||
module X.Y {
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
|
||||
export class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
this.x = x;
|
||||
>this.x = x : number
|
||||
>this.x : number
|
||||
>this : this
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
this.y = y;
|
||||
>this.y = y : number
|
||||
>this.y : number
|
||||
>this : this
|
||||
>y : number
|
||||
>y : number
|
||||
}
|
||||
x: number;
|
||||
>x : number
|
||||
|
||||
y: number;
|
||||
>y : number
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts ===
|
||||
module X.Y {
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
|
||||
export module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export var Origin = new Point(0, 0);
|
||||
>Origin : Point
|
||||
>new Point(0, 0) : Point
|
||||
>Point : typeof Point
|
||||
>0 : 0
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
>cl : X.Y.Point
|
||||
>new X.Y.Point(1,1) : X.Y.Point
|
||||
>X.Y.Point : typeof X.Y.Point
|
||||
>X.Y : typeof X.Y
|
||||
>X : typeof X
|
||||
>Y : typeof X.Y
|
||||
>Point : typeof X.Y.Point
|
||||
>1 : 1
|
||||
>1 : 1
|
||||
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
>cl : X.Y.Point
|
||||
>X.Y.Point.Origin : X.Y.Point
|
||||
>X.Y.Point : typeof X.Y.Point
|
||||
>X.Y : typeof X.Y
|
||||
>X : typeof X
|
||||
>Y : typeof X.Y
|
||||
>Point : typeof X.Y.Point
|
||||
>Origin : X.Y.Point
|
||||
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
}
|
||||
|
||||
module A {
|
||||
>A : typeof A
|
||||
|
||||
export var Instance = new A();
|
||||
>Instance : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
>a : A
|
||||
>A.Instance : A
|
||||
>A : typeof A
|
||||
>Instance : A
|
||||
|
||||
var a = new A();
|
||||
>a : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
|
||||
var a: { id: string };
|
||||
>a : A
|
||||
>id : string
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/class.ts ===
|
||||
module X.Y {
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
>x : Symbol(x, Decl(class.ts, 2, 20))
|
||||
>y : Symbol(y, Decl(class.ts, 2, 30))
|
||||
|
||||
this.x = x;
|
||||
>this.x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
>this : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
>x : Symbol(x, Decl(class.ts, 2, 20))
|
||||
|
||||
this.y = y;
|
||||
>this.y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
>this : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
>y : Symbol(y, Decl(class.ts, 2, 30))
|
||||
}
|
||||
x: number;
|
||||
>x : Symbol(Point.x, Decl(class.ts, 5, 9))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(Point.y, Decl(class.ts, 6, 18))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts ===
|
||||
module X.Y {
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
export var Origin = new Point(0, 0);
|
||||
>Origin : Symbol(Origin, Decl(module.ts, 2, 18))
|
||||
>Point : Symbol(Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
>cl : Symbol(cl, Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>X.Y.Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>X.Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
>cl : Symbol(cl, Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>X.Y.Point.Origin : Symbol(X.Y.Point.Origin, Decl(module.ts, 2, 18))
|
||||
>X.Y.Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>X.Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>X : Symbol(X, Decl(class.ts, 0, 0), Decl(module.ts, 0, 0))
|
||||
>Y : Symbol(X.Y, Decl(class.ts, 0, 9), Decl(module.ts, 0, 9))
|
||||
>Point : Symbol(X.Y.Point, Decl(class.ts, 0, 12), Decl(module.ts, 0, 12))
|
||||
>Origin : Symbol(X.Y.Point.Origin, Decl(module.ts, 2, 18))
|
||||
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
id: string;
|
||||
>id : Symbol(A.id, Decl(simple.ts, 0, 9))
|
||||
}
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
export var Instance = new A();
|
||||
>Instance : Symbol(Instance, Decl(simple.ts, 5, 14))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>A.Instance : Symbol(A.Instance, Decl(simple.ts, 5, 14))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
>Instance : Symbol(A.Instance, Decl(simple.ts, 5, 14))
|
||||
|
||||
var a = new A();
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>A : Symbol(A, Decl(simple.ts, 0, 0), Decl(simple.ts, 2, 1))
|
||||
|
||||
var a: { id: string };
|
||||
>a : Symbol(a, Decl(simple.ts, 9, 3), Decl(simple.ts, 10, 3), Decl(simple.ts, 11, 3))
|
||||
>id : Symbol(id, Decl(simple.ts, 11, 8))
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/class.ts ===
|
||||
module X.Y {
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
|
||||
export class Point {
|
||||
>Point : Point
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
this.x = x;
|
||||
>this.x = x : number
|
||||
>this.x : number
|
||||
>this : this
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
this.y = y;
|
||||
>this.y = y : number
|
||||
>this.y : number
|
||||
>this : this
|
||||
>y : number
|
||||
>y : number
|
||||
}
|
||||
x: number;
|
||||
>x : number
|
||||
|
||||
y: number;
|
||||
>y : number
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts ===
|
||||
module X.Y {
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
|
||||
export module Point {
|
||||
>Point : typeof Point
|
||||
|
||||
export var Origin = new Point(0, 0);
|
||||
>Origin : Point
|
||||
>new Point(0, 0) : Point
|
||||
>Point : typeof Point
|
||||
>0 : 0
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
>cl : X.Y.Point
|
||||
>new X.Y.Point(1,1) : X.Y.Point
|
||||
>X.Y.Point : typeof X.Y.Point
|
||||
>X.Y : typeof X.Y
|
||||
>X : typeof X
|
||||
>Y : typeof X.Y
|
||||
>Point : typeof X.Y.Point
|
||||
>1 : 1
|
||||
>1 : 1
|
||||
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
>cl : X.Y.Point
|
||||
>X.Y.Point.Origin : X.Y.Point
|
||||
>X.Y.Point : typeof X.Y.Point
|
||||
>X.Y : typeof X.Y
|
||||
>X : typeof X
|
||||
>Y : typeof X.Y
|
||||
>Point : typeof X.Y.Point
|
||||
>Origin : X.Y.Point
|
||||
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
}
|
||||
|
||||
module A {
|
||||
>A : typeof A
|
||||
|
||||
export var Instance = new A();
|
||||
>Instance : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
>a : A
|
||||
>A.Instance : A
|
||||
>A : typeof A
|
||||
>Instance : A
|
||||
|
||||
var a = new A();
|
||||
>a : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
|
||||
var a: { id: string };
|
||||
>a : A
|
||||
>id : string
|
||||
|
||||
8
tests/baselines/reference/ClassDeclaration10.symbols
Normal file
8
tests/baselines/reference/ClassDeclaration10.symbols
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ClassDeclaration10.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration10.ts, 0, 0))
|
||||
|
||||
constructor();
|
||||
foo();
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration10.ts, 1, 17))
|
||||
}
|
||||
8
tests/baselines/reference/ClassDeclaration10.types
Normal file
8
tests/baselines/reference/ClassDeclaration10.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ClassDeclaration10.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor();
|
||||
foo();
|
||||
>foo : () => any
|
||||
}
|
||||
8
tests/baselines/reference/ClassDeclaration11.symbols
Normal file
8
tests/baselines/reference/ClassDeclaration11.symbols
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ClassDeclaration11.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration11.ts, 0, 0))
|
||||
|
||||
constructor();
|
||||
foo() { }
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration11.ts, 1, 17))
|
||||
}
|
||||
8
tests/baselines/reference/ClassDeclaration11.types
Normal file
8
tests/baselines/reference/ClassDeclaration11.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ClassDeclaration11.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor();
|
||||
foo() { }
|
||||
>foo : () => void
|
||||
}
|
||||
10
tests/baselines/reference/ClassDeclaration13.symbols
Normal file
10
tests/baselines/reference/ClassDeclaration13.symbols
Normal file
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/ClassDeclaration13.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration13.ts, 0, 0))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration13.ts, 0, 9))
|
||||
|
||||
bar() { }
|
||||
>bar : Symbol(C.bar, Decl(ClassDeclaration13.ts, 1, 9))
|
||||
}
|
||||
10
tests/baselines/reference/ClassDeclaration13.types
Normal file
10
tests/baselines/reference/ClassDeclaration13.types
Normal file
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/ClassDeclaration13.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo();
|
||||
>foo : () => any
|
||||
|
||||
bar() { }
|
||||
>bar : () => void
|
||||
}
|
||||
9
tests/baselines/reference/ClassDeclaration14.symbols
Normal file
9
tests/baselines/reference/ClassDeclaration14.symbols
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/ClassDeclaration14.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration14.ts, 0, 0))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration14.ts, 0, 9))
|
||||
|
||||
constructor();
|
||||
}
|
||||
9
tests/baselines/reference/ClassDeclaration14.types
Normal file
9
tests/baselines/reference/ClassDeclaration14.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/ClassDeclaration14.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo();
|
||||
>foo : () => any
|
||||
|
||||
constructor();
|
||||
}
|
||||
9
tests/baselines/reference/ClassDeclaration15.symbols
Normal file
9
tests/baselines/reference/ClassDeclaration15.symbols
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/ClassDeclaration15.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration15.ts, 0, 0))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration15.ts, 0, 9))
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
9
tests/baselines/reference/ClassDeclaration15.types
Normal file
9
tests/baselines/reference/ClassDeclaration15.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/ClassDeclaration15.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo();
|
||||
>foo : () => any
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration21.symbols
Normal file
7
tests/baselines/reference/ClassDeclaration21.symbols
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration21.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration21.ts, 0, 0))
|
||||
|
||||
0();
|
||||
1() { }
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration21.types
Normal file
7
tests/baselines/reference/ClassDeclaration21.types
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration21.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
0();
|
||||
1() { }
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration22.symbols
Normal file
7
tests/baselines/reference/ClassDeclaration22.symbols
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration22.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration22.ts, 0, 0))
|
||||
|
||||
"foo"();
|
||||
"bar"() { }
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration22.types
Normal file
7
tests/baselines/reference/ClassDeclaration22.types
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration22.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
"foo"();
|
||||
"bar"() { }
|
||||
}
|
||||
4
tests/baselines/reference/ClassDeclaration24.symbols
Normal file
4
tests/baselines/reference/ClassDeclaration24.symbols
Normal file
@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/ClassDeclaration24.ts ===
|
||||
class any {
|
||||
>any : Symbol(any, Decl(ClassDeclaration24.ts, 0, 0))
|
||||
}
|
||||
4
tests/baselines/reference/ClassDeclaration24.types
Normal file
4
tests/baselines/reference/ClassDeclaration24.types
Normal file
@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/ClassDeclaration24.ts ===
|
||||
class any {
|
||||
>any : any
|
||||
}
|
||||
26
tests/baselines/reference/ClassDeclaration25.symbols
Normal file
26
tests/baselines/reference/ClassDeclaration25.symbols
Normal file
@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/ClassDeclaration25.ts ===
|
||||
interface IList<T> {
|
||||
>IList : Symbol(IList, Decl(ClassDeclaration25.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(ClassDeclaration25.ts, 0, 16))
|
||||
|
||||
data(): T;
|
||||
>data : Symbol(IList.data, Decl(ClassDeclaration25.ts, 0, 20))
|
||||
>T : Symbol(T, Decl(ClassDeclaration25.ts, 0, 16))
|
||||
|
||||
next(): string;
|
||||
>next : Symbol(IList.next, Decl(ClassDeclaration25.ts, 1, 14))
|
||||
}
|
||||
class List<U> implements IList<U> {
|
||||
>List : Symbol(List, Decl(ClassDeclaration25.ts, 3, 1))
|
||||
>U : Symbol(U, Decl(ClassDeclaration25.ts, 4, 11))
|
||||
>IList : Symbol(IList, Decl(ClassDeclaration25.ts, 0, 0))
|
||||
>U : Symbol(U, Decl(ClassDeclaration25.ts, 4, 11))
|
||||
|
||||
data(): U;
|
||||
>data : Symbol(List.data, Decl(ClassDeclaration25.ts, 4, 35))
|
||||
>U : Symbol(U, Decl(ClassDeclaration25.ts, 4, 11))
|
||||
|
||||
next(): string;
|
||||
>next : Symbol(List.next, Decl(ClassDeclaration25.ts, 5, 14))
|
||||
}
|
||||
|
||||
26
tests/baselines/reference/ClassDeclaration25.types
Normal file
26
tests/baselines/reference/ClassDeclaration25.types
Normal file
@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/ClassDeclaration25.ts ===
|
||||
interface IList<T> {
|
||||
>IList : IList<T>
|
||||
>T : T
|
||||
|
||||
data(): T;
|
||||
>data : () => T
|
||||
>T : T
|
||||
|
||||
next(): string;
|
||||
>next : () => string
|
||||
}
|
||||
class List<U> implements IList<U> {
|
||||
>List : List<U>
|
||||
>U : U
|
||||
>IList : IList<T>
|
||||
>U : U
|
||||
|
||||
data(): U;
|
||||
>data : () => U
|
||||
>U : U
|
||||
|
||||
next(): string;
|
||||
>next : () => string
|
||||
}
|
||||
|
||||
11
tests/baselines/reference/ClassDeclaration26.symbols
Normal file
11
tests/baselines/reference/ClassDeclaration26.symbols
Normal file
@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/ClassDeclaration26.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration26.ts, 0, 0))
|
||||
|
||||
public const var export foo = 10;
|
||||
>var : Symbol(C.var, Decl(ClassDeclaration26.ts, 0, 9))
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration26.ts, 1, 20))
|
||||
|
||||
var constructor() { }
|
||||
>constructor : Symbol(constructor, Decl(ClassDeclaration26.ts, 3, 7))
|
||||
}
|
||||
13
tests/baselines/reference/ClassDeclaration26.types
Normal file
13
tests/baselines/reference/ClassDeclaration26.types
Normal file
@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/ClassDeclaration26.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
public const var export foo = 10;
|
||||
>var : any
|
||||
>foo : number
|
||||
>10 : 10
|
||||
|
||||
var constructor() { }
|
||||
>constructor : () => void
|
||||
>() { } : () => void
|
||||
}
|
||||
6
tests/baselines/reference/ClassDeclaration8.symbols
Normal file
6
tests/baselines/reference/ClassDeclaration8.symbols
Normal file
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/ClassDeclaration8.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration8.ts, 0, 0))
|
||||
|
||||
constructor();
|
||||
}
|
||||
6
tests/baselines/reference/ClassDeclaration8.types
Normal file
6
tests/baselines/reference/ClassDeclaration8.types
Normal file
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/ClassDeclaration8.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor();
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration9.symbols
Normal file
7
tests/baselines/reference/ClassDeclaration9.symbols
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration9.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(ClassDeclaration9.ts, 0, 0))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(C.foo, Decl(ClassDeclaration9.ts, 0, 9))
|
||||
}
|
||||
7
tests/baselines/reference/ClassDeclaration9.types
Normal file
7
tests/baselines/reference/ClassDeclaration9.types
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclaration9.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo();
|
||||
>foo : () => any
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts ===
|
||||
class AtomicNumbers {
|
||||
>AtomicNumbers : Symbol(AtomicNumbers, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts, 0, 0))
|
||||
|
||||
static const H = 1;
|
||||
>H : Symbol(AtomicNumbers.H, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts, 0, 21))
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts ===
|
||||
class AtomicNumbers {
|
||||
>AtomicNumbers : AtomicNumbers
|
||||
|
||||
static const H = 1;
|
||||
>H : number
|
||||
>1 : 1
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts ===
|
||||
type T = { x : number }
|
||||
>T : Symbol(T, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 10))
|
||||
|
||||
export interface I {
|
||||
>I : Symbol(I, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 23))
|
||||
|
||||
f: T;
|
||||
>f : Symbol(I.f, Decl(DeclarationErrorsNoEmitOnError.ts, 1, 20))
|
||||
>T : Symbol(T, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 0))
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts ===
|
||||
type T = { x : number }
|
||||
>T : { x: number; }
|
||||
>x : number
|
||||
|
||||
export interface I {
|
||||
>I : I
|
||||
|
||||
f: T;
|
||||
>f : { x: number; }
|
||||
>T : { x: number; }
|
||||
}
|
||||
4
tests/baselines/reference/ES3For-ofTypeCheck1.symbols
Normal file
4
tests/baselines/reference/ES3For-ofTypeCheck1.symbols
Normal file
@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts ===
|
||||
for (var v of "") { }
|
||||
>v : Symbol(v, Decl(ES3For-ofTypeCheck1.ts, 0, 8))
|
||||
|
||||
5
tests/baselines/reference/ES3For-ofTypeCheck1.types
Normal file
5
tests/baselines/reference/ES3For-ofTypeCheck1.types
Normal file
@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts ===
|
||||
for (var v of "") { }
|
||||
>v : string
|
||||
>"" : ""
|
||||
|
||||
8
tests/baselines/reference/ES3For-ofTypeCheck4.symbols
Normal file
8
tests/baselines/reference/ES3For-ofTypeCheck4.symbols
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts ===
|
||||
var union: string | string[];
|
||||
>union : Symbol(union, Decl(ES3For-ofTypeCheck4.ts, 0, 3))
|
||||
|
||||
for (const v of union) { }
|
||||
>v : Symbol(v, Decl(ES3For-ofTypeCheck4.ts, 1, 10))
|
||||
>union : Symbol(union, Decl(ES3For-ofTypeCheck4.ts, 0, 3))
|
||||
|
||||
8
tests/baselines/reference/ES3For-ofTypeCheck4.types
Normal file
8
tests/baselines/reference/ES3For-ofTypeCheck4.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts ===
|
||||
var union: string | string[];
|
||||
>union : string | string[]
|
||||
|
||||
for (const v of union) { }
|
||||
>v : string
|
||||
>union : string | string[]
|
||||
|
||||
7
tests/baselines/reference/ES5For-of1.symbols
Normal file
7
tests/baselines/reference/ES5For-of1.symbols
Normal file
@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts ===
|
||||
for (var v of ['a', 'b', 'c']) {
|
||||
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
|
||||
|
||||
console.log(v);
|
||||
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
|
||||
}
|
||||
15
tests/baselines/reference/ES5For-of1.types
Normal file
15
tests/baselines/reference/ES5For-of1.types
Normal file
@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts ===
|
||||
for (var v of ['a', 'b', 'c']) {
|
||||
>v : string
|
||||
>['a', 'b', 'c'] : string[]
|
||||
>'a' : "a"
|
||||
>'b' : "b"
|
||||
>'c' : "c"
|
||||
|
||||
console.log(v);
|
||||
>console.log(v) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>v : string
|
||||
}
|
||||
3
tests/baselines/reference/ES5For-of12.symbols
Normal file
3
tests/baselines/reference/ES5For-of12.symbols
Normal file
@ -0,0 +1,3 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts ===
|
||||
for ([""] of [[""]]) { }
|
||||
No type information for this code.
|
||||
8
tests/baselines/reference/ES5For-of12.types
Normal file
8
tests/baselines/reference/ES5For-of12.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts ===
|
||||
for ([""] of [[""]]) { }
|
||||
>[""] : [string]
|
||||
>"" : ""
|
||||
>[[""]] : string[][]
|
||||
>[""] : string[]
|
||||
>"" : ""
|
||||
|
||||
19
tests/baselines/reference/ES5For-of17.symbols
Normal file
19
tests/baselines/reference/ES5For-of17.symbols
Normal file
@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts ===
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 0, 8))
|
||||
|
||||
v;
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 0, 8))
|
||||
|
||||
for (let v of [v]) {
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12))
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12))
|
||||
|
||||
var x = v;
|
||||
>x : Symbol(x, Decl(ES5For-of17.ts, 3, 11))
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12))
|
||||
|
||||
v++;
|
||||
>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12))
|
||||
}
|
||||
}
|
||||
22
tests/baselines/reference/ES5For-of17.types
Normal file
22
tests/baselines/reference/ES5For-of17.types
Normal file
@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
|
||||
for (let v of [v]) {
|
||||
>v : any
|
||||
>[v] : any[]
|
||||
>v : any
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
|
||||
v++;
|
||||
>v++ : number
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
15
tests/baselines/reference/ES5For-of20.symbols
Normal file
15
tests/baselines/reference/ES5For-of20.symbols
Normal file
@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts ===
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of20.ts, 0, 8))
|
||||
|
||||
let v;
|
||||
>v : Symbol(v, Decl(ES5For-of20.ts, 1, 7))
|
||||
|
||||
for (let v of [v]) {
|
||||
>v : Symbol(v, Decl(ES5For-of20.ts, 2, 12))
|
||||
>v : Symbol(v, Decl(ES5For-of20.ts, 2, 12))
|
||||
|
||||
const v;
|
||||
>v : Symbol(v, Decl(ES5For-of20.ts, 3, 13))
|
||||
}
|
||||
}
|
||||
17
tests/baselines/reference/ES5For-of20.types
Normal file
17
tests/baselines/reference/ES5For-of20.types
Normal file
@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
let v;
|
||||
>v : any
|
||||
|
||||
for (let v of [v]) {
|
||||
>v : any
|
||||
>[v] : any[]
|
||||
>v : any
|
||||
|
||||
const v;
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
10
tests/baselines/reference/ES5For-of22.symbols
Normal file
10
tests/baselines/reference/ES5For-of22.symbols
Normal file
@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts ===
|
||||
for (var x of [1, 2, 3]) {
|
||||
>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8))
|
||||
|
||||
let _a = 0;
|
||||
>_a : Symbol(_a, Decl(ES5For-of22.ts, 1, 7))
|
||||
|
||||
console.log(x);
|
||||
>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8))
|
||||
}
|
||||
19
tests/baselines/reference/ES5For-of22.types
Normal file
19
tests/baselines/reference/ES5For-of22.types
Normal file
@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts ===
|
||||
for (var x of [1, 2, 3]) {
|
||||
>x : number
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
>3 : 3
|
||||
|
||||
let _a = 0;
|
||||
>_a : number
|
||||
>0 : 0
|
||||
|
||||
console.log(x);
|
||||
>console.log(x) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>x : number
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user