mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into trylessCatchesFinallyParseNicely
Conflicts: src/compiler/diagnosticMessages.json
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ TypeScript is currently accepting contributions in the form of bug fixes. A bug
|
||||
## Contributing features
|
||||
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
|
||||
|
||||
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggesion issue.
|
||||
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
|
||||
|
||||
## Legal
|
||||
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
|
||||
|
||||
+4207
-2609
File diff suppressed because one or more lines are too long
@@ -136,30 +136,27 @@ module ts {
|
||||
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
|
||||
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
|
||||
var exportKind = 0;
|
||||
var exportExcludes = 0;
|
||||
if (symbolKind & SymbolFlags.Value) {
|
||||
exportKind |= SymbolFlags.ExportValue;
|
||||
exportExcludes |= SymbolFlags.Value;
|
||||
}
|
||||
if (symbolKind & SymbolFlags.Type) {
|
||||
exportKind |= SymbolFlags.ExportType;
|
||||
exportExcludes |= SymbolFlags.Type;
|
||||
}
|
||||
if (symbolKind & SymbolFlags.Namespace) {
|
||||
exportKind |= SymbolFlags.ExportNamespace;
|
||||
exportExcludes |= SymbolFlags.Namespace;
|
||||
}
|
||||
if (node.flags & NodeFlags.Export || (node.kind !== SyntaxKind.ImportDeclaration && isAmbientContext(container))) {
|
||||
if (exportKind) {
|
||||
var local = declareSymbol(container.locals, undefined, node, exportKind, exportExcludes);
|
||||
var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);
|
||||
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
node.localSymbol = local;
|
||||
}
|
||||
else {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
}
|
||||
else {
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes | exportKind);
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+200
-47
@@ -4819,24 +4819,21 @@ module ts {
|
||||
error(signatureDeclarationNode, Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature);
|
||||
}
|
||||
|
||||
function checkFunctionOrConstructorSymbol(symbol: Symbol) {
|
||||
function getEffectiveFlagsForFunctionCheck(n: Node) {
|
||||
var flags = n.flags;
|
||||
// We want to determine if an overload is effectively ambient, which can happen if it
|
||||
// is nested in an ambient context. However, do not treat members of interfaces differently
|
||||
// based on whether the interface itself is in an ambient context. Interfaces should never
|
||||
// be considered ambient for purposes of comparing overload attributes.
|
||||
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) {
|
||||
if (!(flags & NodeFlags.Ambient)) {
|
||||
// It is nested in an ambient context, which means it is automatically exported
|
||||
flags |= NodeFlags.Export;
|
||||
}
|
||||
flags |= NodeFlags.Ambient;
|
||||
function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags) {
|
||||
var flags = n.flags;
|
||||
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) {
|
||||
if (!(flags & NodeFlags.Ambient)) {
|
||||
// It is nested in an ambient context, which means it is automatically exported
|
||||
flags |= NodeFlags.Export;
|
||||
}
|
||||
|
||||
return flags & flagsToCheck;
|
||||
flags |= NodeFlags.Ambient;
|
||||
}
|
||||
|
||||
return flags & flagsToCheck;
|
||||
}
|
||||
|
||||
function checkFunctionOrConstructorSymbol(symbol: Symbol) {
|
||||
|
||||
function checkFlagAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionDeclaration, flagsToCheck: NodeFlags, someOverloadFlags: NodeFlags, allOverloadFlags: NodeFlags): void {
|
||||
// Error if some overloads have a flag that is not shared by all overloads. To find the
|
||||
// deviations, we XOR someOverloadFlags with allOverloadFlags
|
||||
@@ -4849,10 +4846,10 @@ module ts {
|
||||
// the canonical signature only if it is in the same container as the first overload
|
||||
var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
|
||||
var canonicalFlags = implementationSharesContainerWithFirstOverload
|
||||
? getEffectiveFlagsForFunctionCheck(implementation)
|
||||
: getEffectiveFlagsForFunctionCheck(overloads[0]);
|
||||
? getEffectiveDeclarationFlags(implementation, flagsToCheck)
|
||||
: getEffectiveDeclarationFlags(overloads[0], flagsToCheck);
|
||||
forEach(overloads, o => {
|
||||
var deviation = getEffectiveFlagsForFunctionCheck(o) ^ canonicalFlags;
|
||||
var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags;
|
||||
if (deviation & NodeFlags.Export) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported);
|
||||
}
|
||||
@@ -4875,47 +4872,101 @@ module ts {
|
||||
var hasOverloads = false;
|
||||
var bodyDeclaration: FunctionDeclaration;
|
||||
var lastSeenNonAmbientDeclaration: FunctionDeclaration;
|
||||
var previousDeclaration: FunctionDeclaration;
|
||||
|
||||
var declarations = symbol.declarations;
|
||||
var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0;
|
||||
|
||||
function reportImplementationExpectedError(node: FunctionDeclaration): void {
|
||||
var seen = false;
|
||||
var subsequentNode = forEachChild(node.parent, c => {
|
||||
if (seen) {
|
||||
return c;
|
||||
}
|
||||
else {
|
||||
seen = c === node;
|
||||
}
|
||||
});
|
||||
if (subsequentNode) {
|
||||
if (subsequentNode.kind === node.kind) {
|
||||
var errorNode: Node = (<FunctionDeclaration>subsequentNode).name || subsequentNode;
|
||||
if (node.name && (<FunctionDeclaration>subsequentNode).name && node.name.text === (<FunctionDeclaration>subsequentNode).name.text) {
|
||||
// the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members
|
||||
Debug.assert(node.kind === SyntaxKind.Method);
|
||||
Debug.assert((node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static));
|
||||
var diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
||||
error(errorNode, diagnostic);
|
||||
return;
|
||||
}
|
||||
else if ((<FunctionDeclaration>subsequentNode).body) {
|
||||
error(errorNode, Diagnostics.Function_implementation_name_must_be_0, identifierToString(node.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
var errorNode: Node = node.name || node;
|
||||
if (isConstructor) {
|
||||
error(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
||||
}
|
||||
else {
|
||||
error(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
||||
}
|
||||
}
|
||||
|
||||
// when checking exported function declarations across modules check only duplicate implementations
|
||||
// names and consistensy of modifiers are verified when we check local symbol
|
||||
var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var node = <FunctionDeclaration>declarations[i];
|
||||
var inAmbientContext = isInAmbientContext(node);
|
||||
var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext;
|
||||
if (inAmbientContextOrInterface) {
|
||||
// check if declarations are consecutive only if they are non-ambient
|
||||
// 1. ambient declarations can be interleaved
|
||||
// i.e. this is legal
|
||||
// declare function foo();
|
||||
// declare function bar();
|
||||
// declare function foo();
|
||||
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
|
||||
previousDeclaration = undefined;
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.Method || node.kind === SyntaxKind.Constructor) {
|
||||
var currentNodeFlags = getEffectiveFlagsForFunctionCheck(node);
|
||||
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
|
||||
someNodeFlags |= currentNodeFlags;
|
||||
allNodeFlags &= currentNodeFlags;
|
||||
|
||||
var inAmbientContext = isInAmbientContext(node);
|
||||
var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext;
|
||||
if (!inAmbientContextOrInterface) {
|
||||
lastSeenNonAmbientDeclaration = node;
|
||||
if (node.body && bodyDeclaration) {
|
||||
if (isConstructor) {
|
||||
error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.Duplicate_function_implementation);
|
||||
}
|
||||
}
|
||||
else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) {
|
||||
reportImplementationExpectedError(previousDeclaration);
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
if (bodyDeclaration) {
|
||||
if (isConstructor) {
|
||||
error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.Duplicate_function_implementation);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!bodyDeclaration) {
|
||||
bodyDeclaration = node;
|
||||
}
|
||||
}
|
||||
else {
|
||||
hasOverloads = true;
|
||||
}
|
||||
|
||||
previousDeclaration = node;
|
||||
|
||||
if (!inAmbientContextOrInterface) {
|
||||
lastSeenNonAmbientDeclaration = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) {
|
||||
if (isConstructor) {
|
||||
error(lastSeenNonAmbientDeclaration, Diagnostics.Constructor_implementation_expected);
|
||||
}
|
||||
else {
|
||||
error(lastSeenNonAmbientDeclaration, Diagnostics.Function_implementation_expected);
|
||||
}
|
||||
if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) {
|
||||
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
|
||||
}
|
||||
|
||||
if (hasOverloads) {
|
||||
@@ -4951,18 +5002,101 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkExportsOnMergedDeclarations(node: Node) {
|
||||
var symbol: Symbol;
|
||||
|
||||
// Exports should be checked only if enclosing module contains both exported and non exported declarations.
|
||||
// In case if all declarations are non-exported check is unnecesary.
|
||||
|
||||
// if localSymbol is defined on node then node itself is exported - check is required
|
||||
var symbol = node.localSymbol;
|
||||
if (!symbol) {
|
||||
// local symbol is undefined => this declaration is non-exported.
|
||||
// however symbol might contain other declarations that are exported
|
||||
symbol = getSymbolOfNode(node);
|
||||
if (!(symbol.flags & SymbolFlags.Export)) {
|
||||
// this is a pure local symbol (all declarations are non-exported) - no need to check anything
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// run the check only for the first declaration in the list
|
||||
if (getDeclarationOfKind(symbol, node.kind) !== node) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace
|
||||
// to denote disjoint declarationSpaces (without making new enum type).
|
||||
var exportedDeclarationSpaces: SymbolFlags = 0;
|
||||
var nonExportedDeclarationSpaces: SymbolFlags = 0;
|
||||
forEach(symbol.declarations, d => {
|
||||
var declarationSpaces = getDeclarationSpaces(d);
|
||||
if (getEffectiveDeclarationFlags(d, NodeFlags.Export)) {
|
||||
exportedDeclarationSpaces |= declarationSpaces;
|
||||
}
|
||||
else {
|
||||
nonExportedDeclarationSpaces |= declarationSpaces;
|
||||
}
|
||||
});
|
||||
|
||||
var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces;
|
||||
|
||||
if (commonDeclarationSpace) {
|
||||
// declaration spaces for exported and non-exported declarations intersect
|
||||
forEach(symbol.declarations, d => {
|
||||
if (getDeclarationSpaces(d) & commonDeclarationSpace) {
|
||||
error(d.name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, identifierToString(d.name));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getDeclarationSpaces(d: Declaration): SymbolFlags {
|
||||
switch (d.kind) {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return SymbolFlags.ExportType;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return (<ModuleDeclaration>d).name.kind === SyntaxKind.StringLiteral || isInstantiated(d)
|
||||
? SymbolFlags.ExportNamespace | SymbolFlags.ExportValue
|
||||
: SymbolFlags.ExportNamespace;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return SymbolFlags.ExportType | SymbolFlags.ExportValue;
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
var result: SymbolFlags = 0;
|
||||
var target = resolveImport(getSymbolOfNode(d));
|
||||
forEach(target.declarations, d => { result |= getDeclarationSpaces(d); } )
|
||||
return result;
|
||||
default:
|
||||
return SymbolFlags.ExportValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionDeclaration(node: FunctionDeclaration) {
|
||||
checkSignatureDeclaration(node);
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var firstDeclaration = getDeclarationOfKind(symbol, node.kind);
|
||||
var symbol = getSymbolOfNode(node)
|
||||
// first we want to check the local symbol that contain this declaration
|
||||
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol
|
||||
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode
|
||||
var localSymbol = node.localSymbol || symbol;
|
||||
|
||||
var firstDeclaration = getDeclarationOfKind(localSymbol, node.kind);
|
||||
// Only type check the symbol once
|
||||
if (node === firstDeclaration) {
|
||||
checkFunctionOrConstructorSymbol(symbol);
|
||||
checkFunctionOrConstructorSymbol(localSymbol);
|
||||
}
|
||||
|
||||
if (symbol.parent) {
|
||||
// run check once for the first declaration
|
||||
if (getDeclarationOfKind(symbol, node.kind) === node) {
|
||||
// run check on export symbol to check that modifiers agree across all exported declarations
|
||||
checkFunctionOrConstructorSymbol(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
checkSourceElement(node.body);
|
||||
if (node.type) {
|
||||
if (node.type && !isAccessor(node.kind)) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
|
||||
}
|
||||
|
||||
@@ -5155,8 +5289,10 @@ module ts {
|
||||
function checkVariableDeclaration(node: VariableDeclaration) {
|
||||
checkSourceElement(node.type);
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
|
||||
var symbol = getSymbolOfNode(node);
|
||||
|
||||
var typeOfValueDeclaration = getTypeOfVariableOrParameterOrProperty(symbol);
|
||||
var type: Type;
|
||||
var useTypeFromValueDeclaration = node === symbol.valueDeclaration;
|
||||
@@ -5441,6 +5577,7 @@ module ts {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0);
|
||||
checkTypeParameters(node.typeParameters);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
|
||||
var staticType = <ObjectType>getTypeOfSymbol(symbol);
|
||||
@@ -5595,6 +5732,7 @@ module ts {
|
||||
function checkInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0);
|
||||
checkTypeParameters(node.typeParameters);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
var firstInterfaceDecl = <InterfaceDeclaration>getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration);
|
||||
if (symbol.declarations.length > 1) {
|
||||
@@ -5640,6 +5778,7 @@ module ts {
|
||||
function checkEnumDeclaration(node: EnumDeclaration) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Enum_name_cannot_be_0);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
var enumSymbol = getSymbolOfNode(node);
|
||||
var enumType = getDeclaredTypeOfSymbol(enumSymbol);
|
||||
var autoValue = 0;
|
||||
@@ -5711,6 +5850,7 @@ module ts {
|
||||
|
||||
function checkModuleDeclaration(node: ModuleDeclaration) {
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node)) {
|
||||
var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
||||
@@ -5734,6 +5874,13 @@ module ts {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
|
||||
function getFirstIdentifier(node: EntityName): Identifier {
|
||||
while (node.kind === SyntaxKind.QualifiedName) {
|
||||
node = (<QualifiedName>node).left;
|
||||
}
|
||||
return <Identifier>node;
|
||||
}
|
||||
|
||||
function checkImportDeclaration(node: ImportDeclaration) {
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
@@ -5744,8 +5891,15 @@ module ts {
|
||||
// Import declaration for an internal module
|
||||
if (target !== unknownSymbol) {
|
||||
if (target.flags & SymbolFlags.Value) {
|
||||
// Target is a value symbol, check that it can be evaluated as an expression
|
||||
checkExpression(node.entityName);
|
||||
// Target is a value symbol, check that it is not hidden by a local declaration with the same name and
|
||||
// ensure it can be evaluated as an expression
|
||||
var moduleName = getFirstIdentifier(node.entityName);
|
||||
if (resolveEntityName(node, moduleName, SymbolFlags.Value | SymbolFlags.Namespace).flags & SymbolFlags.Namespace) {
|
||||
checkExpression(node.entityName);
|
||||
}
|
||||
else {
|
||||
error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, identifierToString(moduleName));
|
||||
}
|
||||
}
|
||||
if (target.flags & SymbolFlags.Type) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Import_name_cannot_be_0);
|
||||
@@ -5755,7 +5909,6 @@ module ts {
|
||||
else {
|
||||
// Import declaration for an external module
|
||||
if (node.parent.kind === SyntaxKind.SourceFile) {
|
||||
// Parent is a source file, check that external modules are enabled
|
||||
target = resolveImport(symbol);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral) {
|
||||
|
||||
@@ -140,6 +140,7 @@ module ts {
|
||||
A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2163, category: DiagnosticCategory.Error, key: "A signature with an implementation cannot use a string literal type." },
|
||||
Interface_0_cannot_simultaneously_extend_types_1_and_2_Colon: { code: 2189, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':" },
|
||||
Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2190, category: DiagnosticCategory.Error, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." },
|
||||
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2192, category: DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." },
|
||||
super_cannot_be_referenced_in_constructor_arguments: { code: 2193, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in constructor arguments." },
|
||||
Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2194, category: DiagnosticCategory.Error, key: "Return type of constructor signature must be assignable to the instance type of the class" },
|
||||
Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2196, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." },
|
||||
@@ -157,9 +158,12 @@ module ts {
|
||||
Duplicate_number_index_signature: { code: 2233, category: DiagnosticCategory.Error, key: "Duplicate number index signature." },
|
||||
All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2234, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." },
|
||||
Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2235, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." },
|
||||
Constructor_implementation_expected: { code: 2240, category: DiagnosticCategory.Error, key: "Constructor implementation expected." },
|
||||
Function_implementation_name_must_be_0: { code: 2239, category: DiagnosticCategory.Error, key: "Function implementation name must be '{0}'." },
|
||||
Constructor_implementation_is_missing: { code: 2240, category: DiagnosticCategory.Error, key: "Constructor implementation is missing." },
|
||||
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2245, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
|
||||
A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2246, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." },
|
||||
Function_overload_must_be_static: { code: 2247, category: DiagnosticCategory.Error, key: "Function overload must be static." },
|
||||
Function_overload_must_not_be_static: { code: 2248, category: DiagnosticCategory.Error, key: "Function overload must not be static." },
|
||||
Circular_definition_of_import_alias_0: { code: 3000, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
|
||||
Cannot_find_name_0: { code: 3001, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
|
||||
Module_0_has_no_exported_member_1: { code: 3002, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
|
||||
@@ -211,6 +215,7 @@ module ts {
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option mapRoot cannot be specified without specifying sourcemap option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option sourceRoot cannot be specified without specifying sourcemap option." },
|
||||
Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -275,7 +280,7 @@ module ts {
|
||||
Types_of_parameters_0_and_1_are_incompatible_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" },
|
||||
Unknown_identifier_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Unknown identifier '{0}'." },
|
||||
Property_0_is_inaccessible: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." },
|
||||
Function_implementation_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation expected." },
|
||||
Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation is missing or not immediately following the declaration." },
|
||||
Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." },
|
||||
Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." },
|
||||
Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." },
|
||||
@@ -294,6 +299,7 @@ module ts {
|
||||
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: -9999999, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
|
||||
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: -9999999, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
|
||||
Import_declaration_conflicts_with_local_declaration_of_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
|
||||
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: -9999999, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
|
||||
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: -9999999, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: -9999999, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
|
||||
Argument_for_target_option_must_be_es3_or_es5: { code: -9999999, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3' or 'es5'." },
|
||||
|
||||
@@ -552,6 +552,10 @@
|
||||
"category": "Error",
|
||||
"code": 2190
|
||||
},
|
||||
"Individual declarations in merged declaration {0} must be all exported or all local.": {
|
||||
"category": "Error",
|
||||
"code": 2192
|
||||
},
|
||||
"'super' cannot be referenced in constructor arguments.":{
|
||||
"category": "Error",
|
||||
"code": 2193
|
||||
@@ -619,8 +623,12 @@
|
||||
"Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.": {
|
||||
"category": "Error",
|
||||
"code": 2235
|
||||
},
|
||||
"Constructor implementation expected.": {
|
||||
},
|
||||
"Function implementation name must be '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2239
|
||||
},
|
||||
"Constructor implementation is missing.": {
|
||||
"category": "Error",
|
||||
"code": 2240
|
||||
},
|
||||
@@ -632,7 +640,14 @@
|
||||
"category": "Error",
|
||||
"code": 2246
|
||||
},
|
||||
|
||||
"Function overload must be static.": {
|
||||
"category": "Error",
|
||||
"code": 2247
|
||||
},
|
||||
"Function overload must not be static.": {
|
||||
"category": "Error",
|
||||
"code": 2248
|
||||
},
|
||||
"Circular definition of import alias '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 3000
|
||||
@@ -840,6 +855,11 @@
|
||||
"code": 5039
|
||||
},
|
||||
|
||||
"Version {0}": {
|
||||
"category": "Message",
|
||||
"code": 6029
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
@@ -897,7 +917,6 @@
|
||||
"category": "Error",
|
||||
"code": 7020
|
||||
},
|
||||
|
||||
"Variable declaration list cannot be empty.": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
@@ -1118,7 +1137,7 @@
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"Function implementation expected.": {
|
||||
"Function implementation is missing or not immediately following the declaration.": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
@@ -1198,6 +1217,10 @@
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"Module '{0}' is hidden by a local declaration with the same name": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"Filename '{0}' differs from already included filename '{1}' only in casing": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
|
||||
+19
-4
@@ -2106,14 +2106,20 @@ module ts {
|
||||
function parseObjectLiteral(): ObjectLiteral {
|
||||
var node = <ObjectLiteral>createNode(SyntaxKind.ObjectLiteral);
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine;
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, TrailingCommaBehavior.Preserve);
|
||||
if (scanner.hasPrecedingLineBreak()) {
|
||||
node.flags |= NodeFlags.MultiLine;
|
||||
}
|
||||
|
||||
// ES3 itself does not accept a trailing comma in an object literal, however, we'd like to preserve it in ES5.
|
||||
var trailingCommaBehavior = languageVersion === ScriptTarget.ES3 ? TrailingCommaBehavior.Allow : TrailingCommaBehavior.Preserve;
|
||||
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, trailingCommaBehavior);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
|
||||
var seen: Map<SymbolFlags> = {};
|
||||
var Property = 1;
|
||||
var GetAccessor = 2;
|
||||
var SetAccesor = 4;
|
||||
var SetAccesor = 4;
|
||||
var GetOrSetAccessor = GetAccessor | SetAccesor;
|
||||
forEach(node.properties, (p: Declaration) => {
|
||||
if (p.kind === SyntaxKind.OmittedExpression) {
|
||||
@@ -2908,7 +2914,16 @@ module ts {
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
node.type = sig.type;
|
||||
node.body = parseBody(/* ignoreMissingOpenBrace */ false);
|
||||
|
||||
// A common error is to try to declare an accessor in an ambient class.
|
||||
if (inAmbientContext && canParseSemicolon()) {
|
||||
parseSemicolon();
|
||||
node.body = createMissingNode();
|
||||
}
|
||||
else {
|
||||
node.body = parseBody(/* ignoreMissingOpenBrace */ false);
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
+49
-36
@@ -9,6 +9,8 @@
|
||||
/// <reference path="commandLineParser.ts"/>
|
||||
|
||||
module ts {
|
||||
export var version = "1.1.0.0";
|
||||
|
||||
/// Checks to see if the locale is in the appropriate format,
|
||||
/// and if it is, attempt to set the appropriate language.
|
||||
function validateLocaleAndSetLanguage(locale: string, errors: Diagnostic[]): boolean {
|
||||
@@ -76,39 +78,47 @@ module ts {
|
||||
return count;
|
||||
}
|
||||
|
||||
function reportErrors(errors: Diagnostic[]) {
|
||||
function reportDiagnostic(error: Diagnostic) {
|
||||
if (error.file) {
|
||||
var loc = error.file.getLineAndCharacterFromPosition(error.start);
|
||||
sys.writeErr(error.file.filename + "(" + loc.line + "," + loc.character + "): " + error.messageText + sys.newLine);
|
||||
}
|
||||
else {
|
||||
sys.writeErr(error.messageText + sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
function reportDiagnostics(errors: Diagnostic[]) {
|
||||
for (var i = 0; i < errors.length; i++) {
|
||||
var error = errors[i];
|
||||
if (error.file) {
|
||||
var loc = error.file.getLineAndCharacterFromPosition(error.start);
|
||||
sys.writeErr(error.file.filename + "(" + loc.line + "," + loc.character + "): " + error.messageText + sys.newLine);
|
||||
}
|
||||
else {
|
||||
sys.writeErr(error.messageText + sys.newLine);
|
||||
}
|
||||
reportDiagnostic(errors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function padLeft(s: string, length: number) {
|
||||
while (s.length < length) s = " " + s;
|
||||
while (s.length < length) {
|
||||
s = " " + s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function padRight(s: string, length: number) {
|
||||
while (s.length < length) s = s + " ";
|
||||
while (s.length < length) {
|
||||
s = s + " ";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function reportDiagnostic(name: string, value: string) {
|
||||
function reportStatisticalValue(name: string, value: string) {
|
||||
sys.writeErr(padRight(name + ":", 12) + padLeft(value.toString(), 10) + sys.newLine);
|
||||
}
|
||||
|
||||
function reportDiagnosticCount(name: string, count: number) {
|
||||
reportDiagnostic(name, "" + count);
|
||||
function reportCountStatistic(name: string, count: number) {
|
||||
reportStatisticalValue(name, "" + count);
|
||||
}
|
||||
|
||||
function reportDiagnosticTime(name: string, time: number) {
|
||||
reportDiagnostic(name, (time / 1000).toFixed(2) + "s");
|
||||
function reportTimeStatistic(name: string, time: number) {
|
||||
reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
|
||||
}
|
||||
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost {
|
||||
@@ -120,7 +130,9 @@ module ts {
|
||||
var text = sys.readFile(filename, options.charset);
|
||||
}
|
||||
catch (e) {
|
||||
if (onError) onError(e.message);
|
||||
if (onError) {
|
||||
onError(e.message);
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
return text !== undefined ? createSourceFile(filename, text, languageVersion) : undefined;
|
||||
@@ -168,25 +180,26 @@ module ts {
|
||||
|
||||
export function executeCommandLine(args: string[]): number {
|
||||
var cmds = parseCommandLine(args);
|
||||
|
||||
if (cmds.options.locale) {
|
||||
validateLocaleAndSetLanguage(cmds.options.locale, cmds.errors);
|
||||
}
|
||||
|
||||
if (cmds.filenames.length === 0 && !(cmds.options.help || cmds.options.version)) {
|
||||
cmds.errors.push(createCompilerDiagnostic(Diagnostics.No_input_files_specified));
|
||||
}
|
||||
|
||||
if (cmds.options.version) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmds.filenames.length === 0 || cmds.options.help) {
|
||||
// TODO (drosen): Usage.
|
||||
}
|
||||
|
||||
// If a locale has been set but fails to load, act as if it was never specified,
|
||||
// but collect the errors to report along the way.
|
||||
if (cmds.options.locale) {
|
||||
validateLocaleAndSetLanguage(cmds.options.locale, cmds.errors);
|
||||
}
|
||||
|
||||
if (cmds.errors.length) {
|
||||
reportErrors(cmds.errors);
|
||||
reportDiagnostics(cmds.errors);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -209,19 +222,19 @@ module ts {
|
||||
errors = concatenate(semanticErrors, emitErrors);
|
||||
}
|
||||
|
||||
reportErrors(errors);
|
||||
reportDiagnostics(errors);
|
||||
if (cmds.options.diagnostics) {
|
||||
reportDiagnosticCount("Files", program.getSourceFiles().length);
|
||||
reportDiagnosticCount("Lines", countLines(program));
|
||||
reportDiagnosticCount("Nodes", checker ? checker.getNodeCount() : 0);
|
||||
reportDiagnosticCount("Identifiers", checker ? checker.getIdentifierCount() : 0);
|
||||
reportDiagnosticCount("Symbols", checker ? checker.getSymbolCount() : 0);
|
||||
reportDiagnosticCount("Types", checker ? checker.getTypeCount() : 0);
|
||||
reportDiagnosticTime("Parse time", bindStart - parseStart);
|
||||
reportDiagnosticTime("Bind time", checkStart - bindStart);
|
||||
reportDiagnosticTime("Check time", emitStart - checkStart);
|
||||
reportDiagnosticTime("Emit time", reportStart - emitStart);
|
||||
reportDiagnosticTime("Total time", reportStart - parseStart);
|
||||
reportCountStatistic("Files", program.getSourceFiles().length);
|
||||
reportCountStatistic("Lines", countLines(program));
|
||||
reportCountStatistic("Nodes", checker ? checker.getNodeCount() : 0);
|
||||
reportCountStatistic("Identifiers", checker ? checker.getIdentifierCount() : 0);
|
||||
reportCountStatistic("Symbols", checker ? checker.getSymbolCount() : 0);
|
||||
reportCountStatistic("Types", checker ? checker.getTypeCount() : 0);
|
||||
reportTimeStatistic("Parse time", bindStart - parseStart);
|
||||
reportTimeStatistic("Bind time", checkStart - bindStart);
|
||||
reportTimeStatistic("Check time", emitStart - checkStart);
|
||||
reportTimeStatistic("Emit time", reportStart - emitStart);
|
||||
reportTimeStatistic("Total time", reportStart - parseStart);
|
||||
}
|
||||
return errors.length ? 1 : 0;
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ module ts {
|
||||
symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
}
|
||||
|
||||
export interface NodeArray<T> extends Array<T>, TextRange { }
|
||||
@@ -699,6 +700,7 @@ module ts {
|
||||
|
||||
IsContainer = HasLocals | HasExports | HasMembers,
|
||||
PropertyOrAccessor = Property | Accessor,
|
||||
Export = ExportNamespace | ExportType | ExportValue,
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
foo() { }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/ClassDeclaration13.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
==== tests/cases/compiler/ClassDeclaration14.ts (2 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/ClassDeclaration15.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
constructor() { }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/ClassDeclaration21.ts (1 errors) ====
|
||||
class C {
|
||||
0();
|
||||
~~~~
|
||||
!!! Function implementation expected.
|
||||
1() { }
|
||||
~
|
||||
!!! Function implementation name must be '0'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/ClassDeclaration22.ts (1 errors) ====
|
||||
class C {
|
||||
"foo"();
|
||||
~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
"bar"() { }
|
||||
~~~~~
|
||||
!!! Function implementation name must be '"foo"'.
|
||||
}
|
||||
@@ -5,10 +5,10 @@
|
||||
}
|
||||
class List<U> implements IList<U> {
|
||||
data(): U;
|
||||
~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
next(): string;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/ClassDeclaration9.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/FunctionDeclaration3.ts (1 errors) ====
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -1,5 +1,5 @@
|
||||
==== tests/cases/compiler/FunctionDeclaration4.ts (1 errors) ====
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function bar() { }
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/FunctionDeclaration6.ts (1 errors) ====
|
||||
{
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/FunctionDeclaration7.ts (1 errors) ====
|
||||
module M {
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
==== tests/cases/compiler/ambientGetters.ts (3 errors) ====
|
||||
==== tests/cases/compiler/ambientGetters.ts (2 errors) ====
|
||||
|
||||
declare class A {
|
||||
get length() : number;
|
||||
~
|
||||
!!! '{' expected.
|
||||
~~~~~~
|
||||
!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~
|
||||
!!! An accessor cannot be declared in an ambient context.
|
||||
}
|
||||
|
||||
declare class B {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/anonymousModules.ts (12 errors) ====
|
||||
==== tests/cases/compiler/anonymousModules.ts (13 errors) ====
|
||||
module {
|
||||
~
|
||||
!!! ';' expected.
|
||||
@@ -18,13 +18,15 @@
|
||||
export var bar = 1;
|
||||
~~~~~~
|
||||
!!! Statement expected.
|
||||
~~~
|
||||
!!! Individual declarations in merged declaration bar must be all exported or all local.
|
||||
}
|
||||
~
|
||||
!!! Declaration or statement expected.
|
||||
|
||||
var bar = 2;
|
||||
~~~
|
||||
!!! Duplicate identifier 'bar'.
|
||||
!!! Individual declarations in merged declaration bar must be all exported or all local.
|
||||
|
||||
module {
|
||||
~
|
||||
|
||||
@@ -50,7 +50,7 @@ b3 = {
|
||||
g: function (s) {
|
||||
return 0;
|
||||
},
|
||||
m: 0,
|
||||
m: 0
|
||||
};
|
||||
b3 = {
|
||||
f: function (n) {
|
||||
@@ -58,13 +58,13 @@ b3 = {
|
||||
},
|
||||
g: function (s) {
|
||||
return 0;
|
||||
},
|
||||
}
|
||||
};
|
||||
b3 = {
|
||||
f: function (n) {
|
||||
return 0;
|
||||
},
|
||||
m: 0,
|
||||
m: 0
|
||||
};
|
||||
b3 = {
|
||||
f: function (n) {
|
||||
@@ -77,7 +77,7 @@ b3 = {
|
||||
n: 0,
|
||||
k: function (a) {
|
||||
return null;
|
||||
},
|
||||
}
|
||||
};
|
||||
b3 = {
|
||||
f: function (n) {
|
||||
@@ -89,5 +89,5 @@ b3 = {
|
||||
n: 0,
|
||||
k: function (a) {
|
||||
return null;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ====
|
||||
function foo(x: { id: number; name?: string; }): void;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
foo({ id: 1234 }); // Ok
|
||||
foo({ id: 1234, name: "hello" }); // Ok
|
||||
foo({ id: 1234, name: false }); // Error, name of wrong type
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
}
|
||||
|
||||
function Foo(); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Duplicate identifier 'Foo'.
|
||||
function F1(s:string);
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
}
|
||||
|
||||
function Foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Duplicate identifier 'Foo'.
|
||||
|
||||
function F1(s:string) {return s;}
|
||||
~~
|
||||
!!! Function implementation name must be 'Foo'.
|
||||
function F1(a:any) { return a;} // error - duplicate identifier
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Duplicate function implementation.
|
||||
|
||||
function Goo(s:string); // error - no implementation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
declare function Gar(s:String); // expect no error
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
function Foo(s:string):Foo;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
class Foo {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
function Foo(s:string):Foo;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
class Foo {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
function Foo(s:string):Foo;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Cannot find name 'Foo'.
|
||||
class Foo {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/classOverloadForFunction2.ts (2 errors) ====
|
||||
function bar(): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
class bar {}
|
||||
~~~
|
||||
!!! Duplicate identifier 'bar'.
|
||||
@@ -2,7 +2,7 @@
|
||||
class C {
|
||||
foo(): string;
|
||||
foo(x): number;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
bar(x): any { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
==== tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts (2 errors) ====
|
||||
class C {
|
||||
foo(): string;
|
||||
bar(x): any { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
foo(x): number;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -16,5 +16,5 @@ var Person = makeClass(
|
||||
var Person = makeClass({
|
||||
initialize: function (name) {
|
||||
this.name = name;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@@ -380,7 +380,7 @@ var bigObject = {
|
||||
var: 0,
|
||||
void: 0,
|
||||
while: 0,
|
||||
with: 0,
|
||||
with: 0
|
||||
};
|
||||
var bigClass = (function () {
|
||||
function bigClass() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/crashOnMethodSignatures.ts (1 errors) ====
|
||||
class A {
|
||||
a(completed: () => any): void;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ var m1;
|
||||
})(m1 || (m1 = {}));
|
||||
var d = {
|
||||
m1: { m: m1 },
|
||||
m2: { c: m1.c },
|
||||
m2: { c: m1.c }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
export function f(x:number)=>2*x;
|
||||
~~
|
||||
!!! Block or ';' expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! Cannot find name 'x'.
|
||||
export module X.Y.Z {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/duplicateSymbolsExportMatching.ts (8 errors) ====
|
||||
==== tests/cases/compiler/duplicateSymbolsExportMatching.ts (18 errors) ====
|
||||
module M {
|
||||
export interface E { }
|
||||
interface I { }
|
||||
@@ -23,23 +23,29 @@
|
||||
|
||||
module N2 {
|
||||
interface I { }
|
||||
~
|
||||
!!! Individual declarations in merged declaration I must be all exported or all local.
|
||||
export interface I { } // error
|
||||
~
|
||||
!!! Duplicate identifier 'I'.
|
||||
!!! Individual declarations in merged declaration I must be all exported or all local.
|
||||
export interface E { }
|
||||
~
|
||||
!!! Individual declarations in merged declaration E must be all exported or all local.
|
||||
interface E { } // error
|
||||
~
|
||||
!!! Duplicate identifier 'E'.
|
||||
!!! Individual declarations in merged declaration E must be all exported or all local.
|
||||
}
|
||||
|
||||
// Should report error only once for instantiated module
|
||||
module M {
|
||||
module inst {
|
||||
~~~~
|
||||
!!! Individual declarations in merged declaration inst must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
export module inst { // one error
|
||||
~~~~
|
||||
!!! Duplicate identifier 'inst'.
|
||||
!!! Individual declarations in merged declaration inst must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
}
|
||||
@@ -47,36 +53,50 @@
|
||||
// Variables of the same / different type
|
||||
module M2 {
|
||||
var v: string;
|
||||
~
|
||||
!!! Individual declarations in merged declaration v must be all exported or all local.
|
||||
export var v: string; // one error (visibility)
|
||||
~
|
||||
!!! Duplicate identifier 'v'.
|
||||
!!! Individual declarations in merged declaration v must be all exported or all local.
|
||||
var w: number;
|
||||
~
|
||||
!!! Individual declarations in merged declaration w must be all exported or all local.
|
||||
export var w: string; // two errors (visibility and type mismatch)
|
||||
~
|
||||
!!! Duplicate identifier 'w'.
|
||||
!!! Individual declarations in merged declaration w must be all exported or all local.
|
||||
}
|
||||
|
||||
module M {
|
||||
module F {
|
||||
~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
~
|
||||
!!! Individual declarations in merged declaration F must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
export function F() { } // Only one error for duplicate identifier (don't consider visibility)
|
||||
~
|
||||
!!! Duplicate identifier 'F'.
|
||||
!!! Individual declarations in merged declaration F must be all exported or all local.
|
||||
}
|
||||
|
||||
module M {
|
||||
class C { }
|
||||
~
|
||||
!!! Individual declarations in merged declaration C must be all exported or all local.
|
||||
module C { }
|
||||
~
|
||||
!!! Individual declarations in merged declaration C must be all exported or all local.
|
||||
export module C { // Two visibility errors (one for the clodule symbol, and one for the merged container symbol)
|
||||
~
|
||||
!!! Duplicate identifier 'C'.
|
||||
!!! Individual declarations in merged declaration C must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
}
|
||||
|
||||
// Top level
|
||||
interface D { }
|
||||
~
|
||||
!!! Individual declarations in merged declaration D must be all exported or all local.
|
||||
export interface D { }
|
||||
~
|
||||
!!! Duplicate identifier 'D'.
|
||||
!!! Individual declarations in merged declaration D must be all exported or all local.
|
||||
@@ -14,11 +14,11 @@
|
||||
~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
public getDay():number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
public getXDate():number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
// etc.
|
||||
|
||||
// Called as a function
|
||||
@@ -34,24 +34,23 @@
|
||||
constructor(value: number);
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
|
||||
static parse(string: string): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
static UTC(year: number, month: number): number;
|
||||
static UTC(year: number, month: number, date: number): number;
|
||||
static UTC(year: number, month: number, date: number, hours: number): number;
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number): number;
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number;
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
ms: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static now(): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
}
|
||||
~
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
}
|
||||
|
||||
function over();
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function overrr() {
|
||||
~~~~~~
|
||||
!!! Function implementation name must be 'over'.
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/functions/functionOverloadErrors.ts (19 errors) ====
|
||||
==== tests/cases/conformance/functions/functionOverloadErrors.ts (14 errors) ====
|
||||
//Function overload signature with initializer
|
||||
function fn1(x = 3);
|
||||
~~~~~
|
||||
@@ -86,26 +86,16 @@
|
||||
//Function overloads with differing export
|
||||
module M {
|
||||
export function fn1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Overload signatures must all be exported or not exported.
|
||||
function fn1(n: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Duplicate identifier 'fn1'.
|
||||
function fn1() { }
|
||||
~~~
|
||||
!!! Duplicate identifier 'fn1'.
|
||||
|
||||
function fn2(n: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Overload signatures must all be exported or not exported.
|
||||
export function fn2();
|
||||
~~~
|
||||
!!! Duplicate identifier 'fn2'.
|
||||
export function fn2() { }
|
||||
~~~
|
||||
!!! Duplicate identifier 'fn2'.
|
||||
}
|
||||
|
||||
//Function overloads with differing ambience
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/functionOverloadImplementationOfWrongName.ts (1 errors) ====
|
||||
function foo(x);
|
||||
function foo(x, y);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function bar() { }
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
@@ -1,6 +1,8 @@
|
||||
==== tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts (2 errors) ====
|
||||
function foo(x);
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
function foo(x, y);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -0,0 +1,6 @@
|
||||
==== tests/cases/compiler/functionOverloads1.ts (1 errors) ====
|
||||
function foo();
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
1+1;
|
||||
function foo():string { return "a" }
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/functionOverloads3.ts (1 errors) ====
|
||||
function foo():string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -5,8 +5,8 @@
|
||||
return ns.toString();
|
||||
}
|
||||
private foo(s: string): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
class e {
|
||||
@@ -15,6 +15,6 @@
|
||||
}
|
||||
private foo(s: string): string;
|
||||
private foo(n: number): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/gettersAndSettersErrors.ts (10 errors) ====
|
||||
==== tests/cases/compiler/gettersAndSettersErrors.ts (9 errors) ====
|
||||
class C {
|
||||
public get Foo() { return "foo";} // ok
|
||||
~~~
|
||||
@@ -16,8 +16,6 @@
|
||||
public set Goo(v:string):string {} // error - setters must not specify a return type
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~
|
||||
!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
}
|
||||
|
||||
class E {
|
||||
|
||||
@@ -374,34 +374,34 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
static tF() { }
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
@@ -410,18 +410,18 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tgF'.
|
||||
}
|
||||
~
|
||||
!!! '{' expected.
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
@@ -804,34 +804,34 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
static tF() { }
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
@@ -840,18 +840,18 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tgF'.
|
||||
}
|
||||
~
|
||||
!!! '{' expected.
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
@@ -894,34 +894,34 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
private set rsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
static tF() { }
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
@@ -930,18 +930,18 @@
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~~~~~~
|
||||
!!! '{' expected.
|
||||
~
|
||||
!!! A function implementation cannot be declared in an ambient context.
|
||||
static get tgF()
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~
|
||||
!!! Duplicate identifier 'tgF'.
|
||||
}
|
||||
~
|
||||
!!! '{' expected.
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class C {
|
||||
foo(): string;
|
||||
foo(x): number;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
x = 1;
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
class IDirectChildrenMap {
|
||||
// Decided to enforce a semicolon after declarations
|
||||
hasOwnProperty(objectId: number): boolean
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
[objectId: number]: IHeapObjectProperty[]
|
||||
}
|
||||
var directChildrenMap = <IDirectChildrenMap>{};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
==== tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ====
|
||||
class A {
|
||||
aProp: string;
|
||||
}
|
||||
module A {
|
||||
export interface X { s: string }
|
||||
export var a = 10;
|
||||
}
|
||||
|
||||
module B {
|
||||
var A = 1;
|
||||
import Y = A;
|
||||
~
|
||||
!!! Module 'A' is hidden by a local declaration with the same name
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
==== tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts (1 errors) ====
|
||||
module A {
|
||||
export interface X { s: string }
|
||||
export var a = 10;
|
||||
}
|
||||
|
||||
module B {
|
||||
var A = 1;
|
||||
import Y = A;
|
||||
~
|
||||
!!! Module 'A' is hidden by a local declaration with the same name
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
==== tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ====
|
||||
class A {
|
||||
aProp: string;
|
||||
}
|
||||
module A {
|
||||
export interface X { s: string }
|
||||
}
|
||||
|
||||
module B {
|
||||
var A = 1;
|
||||
import Y = A;
|
||||
~
|
||||
!!! Module 'A' is hidden by a local declaration with the same name
|
||||
}
|
||||
|
||||
+16
-16
@@ -1,36 +1,36 @@
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts (8 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static foo(); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Function overload must not be static.
|
||||
}
|
||||
|
||||
class D {
|
||||
static foo();
|
||||
~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
foo(); // error
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Function overload must be static.
|
||||
}
|
||||
|
||||
class E<T> {
|
||||
foo(x: T);
|
||||
~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static foo(x: number); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Function overload must not be static.
|
||||
}
|
||||
|
||||
class F<T> {
|
||||
static foo(x: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
foo(x: T); // error
|
||||
~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~~~
|
||||
!!! Function overload must be static.
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [mixedExports.ts]
|
||||
declare module M {
|
||||
function foo();
|
||||
export function foo();
|
||||
function foo();
|
||||
}
|
||||
|
||||
declare module M1 {
|
||||
export interface Foo {}
|
||||
interface Foo {}
|
||||
}
|
||||
|
||||
module A {
|
||||
interface X {x}
|
||||
export module X {}
|
||||
interface X {y}
|
||||
}
|
||||
|
||||
//// [mixedExports.js]
|
||||
@@ -1,35 +1,39 @@
|
||||
==== tests/cases/compiler/mixingStaticAndInstanceOverloads.ts (4 errors) ====
|
||||
==== tests/cases/compiler/mixingStaticAndInstanceOverloads.ts (6 errors) ====
|
||||
class C1 {
|
||||
// ERROR
|
||||
foo1(n: number);
|
||||
foo1(s: string);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static foo1(a) { }
|
||||
~~~~
|
||||
!!! Function overload must not be static.
|
||||
}
|
||||
class C2 {
|
||||
// ERROR
|
||||
static foo2(n: number);
|
||||
static foo2(s: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
foo2(a) { }
|
||||
~~~~
|
||||
!!! Function overload must be static.
|
||||
}
|
||||
class C3 {
|
||||
// ERROR
|
||||
foo3(n: number);
|
||||
static foo3(s: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function overload must not be static.
|
||||
foo3(a) { }
|
||||
~~~~
|
||||
!!! Function overload must be static.
|
||||
}
|
||||
class C4 {
|
||||
// ERROR
|
||||
static foo4(n: number);
|
||||
foo4(s: string);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function overload must be static.
|
||||
static foo4(a) { }
|
||||
~~~~
|
||||
!!! Function overload must not be static.
|
||||
}
|
||||
class C5 {
|
||||
// OK
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
==== tests/cases/compiler/multivar.ts (1 errors) ====
|
||||
==== tests/cases/compiler/multivar.ts (2 errors) ====
|
||||
var a,b,c;
|
||||
var x=1,y=2,z=3;
|
||||
|
||||
module m2 {
|
||||
|
||||
export var a, b2: number = 10, b;
|
||||
~~
|
||||
!!! Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
var m1;
|
||||
var a2, b22: number = 10, b222;
|
||||
var m3;
|
||||
@@ -22,7 +24,7 @@
|
||||
declare var d1, d2;
|
||||
var b2;
|
||||
~~
|
||||
!!! Duplicate identifier 'b2'.
|
||||
!!! Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
|
||||
declare var v1;
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ y = {
|
||||
var x;
|
||||
var y;
|
||||
x = {
|
||||
s: function (t) { return t * t; },
|
||||
s: function (t) { return t * t; }
|
||||
};
|
||||
x = {
|
||||
0: function (t) { return t * t; },
|
||||
0: function (t) { return t * t; }
|
||||
};
|
||||
y = {
|
||||
s: function (t) { return t * t; },
|
||||
s: function (t) { return t * t; }
|
||||
};
|
||||
y = {
|
||||
0: function (t) { return t * t; },
|
||||
0: function (t) { return t * t; }
|
||||
};
|
||||
|
||||
@@ -25,5 +25,5 @@ var s = $.extend({
|
||||
dataType: "json",
|
||||
converters: { "text json": "" },
|
||||
traditional: true,
|
||||
timeout: 12,
|
||||
timeout: 12
|
||||
}, "");
|
||||
|
||||
@@ -77,7 +77,7 @@ var r4 = a["~!@#$%^&*()_+{}|:'<>?\/.,`"];
|
||||
var b = {
|
||||
" ": 1,
|
||||
"a b": "",
|
||||
"~!@#$%^&*()_+{}|:'<>?\/.,`": 1,
|
||||
"~!@#$%^&*()_+{}|:'<>?\/.,`": 1
|
||||
};
|
||||
var r = b[" "];
|
||||
var r2 = b[" "];
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
!!! Block or ';' expected.
|
||||
~
|
||||
!!! Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
interface I2<T> {
|
||||
@@ -41,8 +41,8 @@
|
||||
!!! Block or ';' expected.
|
||||
~
|
||||
!!! Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/overloadModifiersMustAgree.ts (5 errors) ====
|
||||
==== tests/cases/compiler/overloadModifiersMustAgree.ts (4 errors) ====
|
||||
class baz {
|
||||
public foo();
|
||||
~~~
|
||||
@@ -10,10 +10,8 @@
|
||||
~~~
|
||||
!!! Overload signatures must all be ambient or non-ambient.
|
||||
export function bar(s: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Duplicate identifier 'bar'.
|
||||
!!! Overload signatures must all be exported or not exported.
|
||||
function bar(s?: string) { }
|
||||
|
||||
interface I {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
foo() { }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration13.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration14.ts (2 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration15.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
constructor() { }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration21.ts (1 errors) ====
|
||||
class C {
|
||||
0();
|
||||
~~~~
|
||||
!!! Function implementation expected.
|
||||
1() { }
|
||||
~
|
||||
!!! Function implementation name must be '0'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration22.ts (1 errors) ====
|
||||
class C {
|
||||
"foo"();
|
||||
~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
"bar"() { }
|
||||
~~~~~
|
||||
!!! Function implementation name must be '"foo"'.
|
||||
}
|
||||
@@ -5,10 +5,10 @@
|
||||
}
|
||||
class List<U> implements IList<U> {
|
||||
data(): U;
|
||||
~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
next(): string;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
class C {
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration9.ts (1 errors) ====
|
||||
class C {
|
||||
foo();
|
||||
~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -5,5 +5,5 @@
|
||||
~
|
||||
!!! '(' expected.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
!!! Constructor implementation is missing.
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
function =>
|
||||
~~
|
||||
!!! Identifier expected.
|
||||
~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -8,5 +8,5 @@
|
||||
!!! ',' expected.
|
||||
|
||||
!!! ')' expected.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -2,5 +2,5 @@
|
||||
function f() => 4;
|
||||
~~
|
||||
!!! Block or ';' expected.
|
||||
~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -2,8 +2,8 @@
|
||||
function f(p: A) => p;
|
||||
~~
|
||||
!!! Block or ';' expected.
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! Cannot find name 'A'.
|
||||
~
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
!!! Type expected.
|
||||
~
|
||||
!!! Identifier expected.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
~
|
||||
!!! Declaration or statement expected.
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration3.ts (1 errors) ====
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -1,5 +1,5 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration4.ts (1 errors) ====
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function bar() { }
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
@@ -1,7 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration6.ts (1 errors) ====
|
||||
{
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
function bar() { }
|
||||
~~~
|
||||
!!! Function implementation name must be 'foo'.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration7.ts (1 errors) ====
|
||||
module M {
|
||||
function foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration10.ts (2 errors) ====
|
||||
function data(): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
function next(): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/Accessors/parserSetAccessorWithTypeAnnotation1.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Accessors/parserSetAccessorWithTypeAnnotation1.ts (1 errors) ====
|
||||
class C {
|
||||
set foo(v): number {
|
||||
~~~
|
||||
!!! A 'set' accessor cannot have a return type annotation.
|
||||
~~~~~~
|
||||
!!! A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@
|
||||
function Foo () # { }
|
||||
|
||||
!!! Invalid character.
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
4+:5
|
||||
~
|
||||
!!! Expression expected.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
==== tests/cases/compiler/reboundIdentifierOnImportAlias.ts (1 errors) ====
|
||||
module Foo {
|
||||
export var x = "hello";
|
||||
}
|
||||
module Bar {
|
||||
var Foo = 1;
|
||||
import F = Foo;
|
||||
~~~
|
||||
!!! Module 'Foo' is hidden by a local declaration with the same name
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts (1 errors) ====
|
||||
==== tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts (2 errors) ====
|
||||
// all errors imported modules conflict with local variables
|
||||
|
||||
module A {
|
||||
@@ -12,6 +12,8 @@
|
||||
module B {
|
||||
var A = { x: 0, y: 0 };
|
||||
import Point = A;
|
||||
~
|
||||
!!! Module 'A' is hidden by a local declaration with the same name
|
||||
}
|
||||
|
||||
module X {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [sourceMap-SkippedNode.ts]
|
||||
try {
|
||||
// ...
|
||||
} finally {
|
||||
// N.B. No 'catch' block
|
||||
}
|
||||
|
||||
//// [sourceMap-SkippedNode.js]
|
||||
try {
|
||||
}
|
||||
finally {
|
||||
}
|
||||
//# sourceMappingURL=sourceMap-SkippedNode.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
//// [sourceMap-SkippedNode.js.map]
|
||||
{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAA,CAAC;AAED,CAAC;QAAC,CAAC;AAEH,CAAC"}
|
||||
@@ -0,0 +1,52 @@
|
||||
===================================================================
|
||||
JsFile: sourceMap-SkippedNode.js
|
||||
mapUrl: sourceMap-SkippedNode.js.map
|
||||
sourceRoot:
|
||||
sources: sourceMap-SkippedNode.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/sourceMap-SkippedNode.js
|
||||
sourceFile:sourceMap-SkippedNode.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>try {
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
1 >
|
||||
2 >
|
||||
3 > t
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(1, 1) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(1, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >ry {
|
||||
>// ...
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 2) Source(3, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>finally {
|
||||
1->^^^^^^^^
|
||||
2 > ^
|
||||
1->
|
||||
2 > f
|
||||
1->Emitted(3, 9) Source(3, 3) + SourceIndex(0)
|
||||
2 >Emitted(3, 10) Source(3, 4) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >inally {
|
||||
>// N.B. No 'catch' block
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(4, 1) Source(5, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 2) Source(5, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMap-SkippedNode.js.map
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
// just want to make sure this one doesn't crash the compiler
|
||||
function Foo();
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
~~~
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
class Foo {
|
||||
~~~
|
||||
!!! Duplicate identifier 'Foo'.
|
||||
|
||||
@@ -44,5 +44,5 @@ var b = {
|
||||
foo: function (x) {
|
||||
},
|
||||
foo: function (x) {
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -101,13 +101,13 @@ var A = (function () {
|
||||
this.prop4 = {
|
||||
a: function () {
|
||||
return this;
|
||||
},
|
||||
}
|
||||
};
|
||||
this.prop5 = function () {
|
||||
return {
|
||||
a: function () {
|
||||
return this;
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [trailingCommasES3.ts]
|
||||
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2 = { a: 1, b: 2, };
|
||||
var o3 = { a: 1, };
|
||||
var o4 = {};
|
||||
|
||||
var a1 = [1, 2];
|
||||
var a2 = [1, 2, ];
|
||||
var a3 = [1, ];
|
||||
var a4 = [];
|
||||
var a5 = [1, , ];
|
||||
var a6 = [, , ];
|
||||
|
||||
//// [trailingCommasES3.js]
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2 = { a: 1, b: 2 };
|
||||
var o3 = { a: 1 };
|
||||
var o4 = {};
|
||||
var a1 = [1, 2];
|
||||
var a2 = [1, 2, ];
|
||||
var a3 = [1, ];
|
||||
var a4 = [];
|
||||
var a5 = [1, , ];
|
||||
var a6 = [, , ];
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [trailingCommasES5.ts]
|
||||
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2 = { a: 1, b: 2, };
|
||||
var o3 = { a: 1, };
|
||||
var o4 = {};
|
||||
|
||||
var a1 = [1, 2];
|
||||
var a2 = [1, 2, ];
|
||||
var a3 = [1, ];
|
||||
var a4 = [];
|
||||
var a5 = [1, , ];
|
||||
var a6 = [, , ];
|
||||
|
||||
//// [trailingCommasES5.js]
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2 = { a: 1, b: 2, };
|
||||
var o3 = { a: 1, };
|
||||
var o4 = {};
|
||||
var a1 = [1, 2];
|
||||
var a2 = [1, 2, ];
|
||||
var a3 = [1, ];
|
||||
var a4 = [];
|
||||
var a5 = [1, , ];
|
||||
var a6 = [, , ];
|
||||
@@ -0,0 +1,16 @@
|
||||
declare module M {
|
||||
function foo();
|
||||
export function foo();
|
||||
function foo();
|
||||
}
|
||||
|
||||
declare module M1 {
|
||||
export interface Foo {}
|
||||
interface Foo {}
|
||||
}
|
||||
|
||||
module A {
|
||||
interface X {x}
|
||||
export module X {}
|
||||
interface X {y}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user