Merge branch 'master' into emitArrowFunctionES6
This commit is contained in:
commit
e4b206c4a2
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -43,3 +43,4 @@ scripts/word2md.js
|
|||
scripts/ior.js
|
||||
scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
|
|
|
@ -3408,9 +3408,9 @@ module ts {
|
|||
|
||||
// TYPE CHECKING
|
||||
|
||||
var subtypeRelation: Map<boolean> = {};
|
||||
var assignableRelation: Map<boolean> = {};
|
||||
var identityRelation: Map<boolean> = {};
|
||||
var subtypeRelation: Map<RelationComparisonResult> = {};
|
||||
var assignableRelation: Map<RelationComparisonResult> = {};
|
||||
var identityRelation: Map<RelationComparisonResult> = {};
|
||||
|
||||
function isTypeIdenticalTo(source: Type, target: Type): boolean {
|
||||
return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined);
|
||||
|
@ -3445,7 +3445,7 @@ module ts {
|
|||
function checkTypeRelatedTo(
|
||||
source: Type,
|
||||
target: Type,
|
||||
relation: Map<boolean>,
|
||||
relation: Map<RelationComparisonResult>,
|
||||
errorNode: Node,
|
||||
headMessage?: DiagnosticMessage,
|
||||
containingMessageChain?: DiagnosticMessageChain): boolean {
|
||||
|
@ -3453,7 +3453,7 @@ module ts {
|
|||
var errorInfo: DiagnosticMessageChain;
|
||||
var sourceStack: ObjectType[];
|
||||
var targetStack: ObjectType[];
|
||||
var maybeStack: Map<boolean>[];
|
||||
var maybeStack: Map<RelationComparisonResult>[];
|
||||
var expandingFlags: number;
|
||||
var depth = 0;
|
||||
var overflow = false;
|
||||
|
@ -3465,6 +3465,14 @@ module ts {
|
|||
error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
|
||||
}
|
||||
else if (errorInfo) {
|
||||
// If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution),
|
||||
// then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened,
|
||||
// request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context
|
||||
// where errors were being reported.
|
||||
if (errorInfo.next === undefined) {
|
||||
errorInfo = undefined;
|
||||
isRelatedTo(source, target, errorNode !== undefined, headMessage, /* elaborateErrors */ true);
|
||||
}
|
||||
if (containingMessageChain) {
|
||||
errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);
|
||||
}
|
||||
|
@ -3480,7 +3488,7 @@ module ts {
|
|||
// Ternary.True if they are related with no assumptions,
|
||||
// Ternary.Maybe if they are related with assumptions of other relationships, or
|
||||
// Ternary.False if they are not related.
|
||||
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
|
||||
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage, elaborateErrors = false): Ternary {
|
||||
var result: Ternary;
|
||||
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
|
||||
if (source === target) return Ternary.True;
|
||||
|
@ -3547,7 +3555,7 @@ module ts {
|
|||
// identity relation does not use apparent type
|
||||
var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source);
|
||||
if (sourceOrApparentType.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType &&
|
||||
(result = objectTypeRelatedTo(sourceOrApparentType, <ObjectType>target, reportStructuralErrors))) {
|
||||
(result = objectTypeRelatedTo(sourceOrApparentType, <ObjectType>target, reportStructuralErrors, elaborateErrors))) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
|
@ -3638,14 +3646,19 @@ module ts {
|
|||
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
|
||||
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
|
||||
// and issue an error. Otherwise, actually compare the structure of the two types.
|
||||
function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): Ternary {
|
||||
function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean, elaborateErrors = false): Ternary {
|
||||
if (overflow) {
|
||||
return Ternary.False;
|
||||
}
|
||||
var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
|
||||
var related = relation[id];
|
||||
//var related: RelationComparisonResult = undefined; // relation[id];
|
||||
if (related !== undefined) {
|
||||
return related ? Ternary.True : Ternary.False;
|
||||
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
|
||||
// errors, we can use the cached value. Otherwise, recompute the relation
|
||||
if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) {
|
||||
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
|
||||
}
|
||||
}
|
||||
if (depth > 0) {
|
||||
for (var i = 0; i < depth; i++) {
|
||||
|
@ -3668,7 +3681,7 @@ module ts {
|
|||
sourceStack[depth] = source;
|
||||
targetStack[depth] = target;
|
||||
maybeStack[depth] = {};
|
||||
maybeStack[depth][id] = true;
|
||||
maybeStack[depth][id] = RelationComparisonResult.Succeeded;
|
||||
depth++;
|
||||
var saveExpandingFlags = expandingFlags;
|
||||
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) expandingFlags |= 1;
|
||||
|
@ -3696,13 +3709,13 @@ module ts {
|
|||
if (result) {
|
||||
var maybeCache = maybeStack[depth];
|
||||
// If result is definitely true, copy assumptions to global cache, else copy to next level up
|
||||
var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1];
|
||||
copyMap(/*source*/maybeCache, /*target*/destinationCache);
|
||||
var destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1];
|
||||
copyMap(maybeCache, destinationCache);
|
||||
}
|
||||
else {
|
||||
// A false result goes straight into global cache (when something is false under assumptions it
|
||||
// will also be false without assumptions)
|
||||
relation[id] = false;
|
||||
relation[id] = reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -5966,7 +5979,7 @@ module ts {
|
|||
return typeArgumentsAreAssignable;
|
||||
}
|
||||
|
||||
function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map<boolean>, excludeArgument: boolean[], reportErrors: boolean) {
|
||||
function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map<RelationComparisonResult>, excludeArgument: boolean[], reportErrors: boolean) {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
var argType: Type;
|
||||
|
@ -6026,11 +6039,41 @@ module ts {
|
|||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* In a 'super' call, type arguments are not provided within the CallExpression node itself.
|
||||
* Instead, they must be fetched from the class declaration's base type node.
|
||||
*
|
||||
* If 'node' is a 'super' call (e.g. super(...), new super(...)), then we attempt to fetch
|
||||
* the type arguments off the containing class's first heritage clause (if one exists). Note that if
|
||||
* type arguments are supplied on the 'super' call, they are ignored (though this is syntactically incorrect).
|
||||
*
|
||||
* In all other cases, the call's explicit type arguments are returned.
|
||||
*/
|
||||
function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] {
|
||||
if (callExpression.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
var containingClass = <ClassDeclaration>getAncestor(callExpression, SyntaxKind.ClassDeclaration);
|
||||
var baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass);
|
||||
return baseClassTypeNode && baseClassTypeNode.typeArguments;
|
||||
}
|
||||
else {
|
||||
// Ordinary case - simple function invocation.
|
||||
return callExpression.typeArguments;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveCall(node: CallLikeExpression, signatures: Signature[], candidatesOutArray: Signature[]): Signature {
|
||||
var isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression;
|
||||
|
||||
var typeArguments = isTaggedTemplate ? undefined : (<CallExpression>node).typeArguments;
|
||||
forEach(typeArguments, checkSourceElement);
|
||||
var typeArguments: TypeNode[];
|
||||
|
||||
if (!isTaggedTemplate) {
|
||||
typeArguments = getEffectiveTypeArguments(<CallExpression>node);
|
||||
|
||||
// We already perform checking on the type arguments on the class declaration itself.
|
||||
if ((<CallExpression>node).expression.kind !== SyntaxKind.SuperKeyword) {
|
||||
forEach(typeArguments, checkSourceElement);
|
||||
}
|
||||
}
|
||||
|
||||
var candidates = candidatesOutArray || [];
|
||||
// collectCandidates fills up the candidates array directly
|
||||
|
@ -6160,7 +6203,7 @@ module ts {
|
|||
|
||||
return resolveErrorCall(node);
|
||||
|
||||
function chooseOverload(candidates: Signature[], relation: Map<boolean>) {
|
||||
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>) {
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
if (!hasCorrectArity(node, args, candidates[i])) {
|
||||
continue;
|
||||
|
|
|
@ -2427,28 +2427,20 @@ module ts {
|
|||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
if (!isObjectLiteralMethod(node)) {
|
||||
return;
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(": function ");
|
||||
}
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
emit(node.initializer);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
|
||||
// module m {
|
||||
|
@ -2465,7 +2457,6 @@ module ts {
|
|||
// Short-hand, { x }, is equivalent of normal form { x: x }
|
||||
emitExpressionIdentifier(node.name);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
|
||||
|
@ -2685,14 +2676,11 @@ module ts {
|
|||
}
|
||||
|
||||
function emitExpressionStatement(node: ExpressionStatement) {
|
||||
emitLeadingComments(node);
|
||||
emitParenthesized(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitIfStatement(node: IfStatement) {
|
||||
emitLeadingComments(node);
|
||||
var endPos = emitToken(SyntaxKind.IfKeyword, node.pos);
|
||||
write(" ");
|
||||
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
|
@ -2710,7 +2698,6 @@ module ts {
|
|||
emitEmbeddedStatement(node.elseStatement);
|
||||
}
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDoStatement(node: DoStatement) {
|
||||
|
@ -2798,11 +2785,9 @@ module ts {
|
|||
}
|
||||
|
||||
function emitReturnStatement(node: ReturnStatement) {
|
||||
emitLeadingComments(node);
|
||||
emitToken(SyntaxKind.ReturnKeyword, node.pos);
|
||||
emitOptional(" ", node.expression);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitWithStatement(node: WhileStatement) {
|
||||
|
@ -3126,7 +3111,6 @@ module ts {
|
|||
}
|
||||
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
if (isBindingPattern(node.name)) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
emitDestructuring(node);
|
||||
|
@ -3140,11 +3124,9 @@ module ts {
|
|||
emitModuleMemberName(node);
|
||||
emitOptional(" = ", node.initializer);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitVariableStatement(node: VariableStatement) {
|
||||
emitLeadingComments(node);
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
if (isLet(node.declarationList)) {
|
||||
write("let ");
|
||||
|
@ -3158,11 +3140,9 @@ module ts {
|
|||
}
|
||||
emitCommaList(node.declarationList.declarations);
|
||||
write(";");
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitParameter(node: ParameterDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
var name = createTempVariable(node);
|
||||
|
@ -3183,7 +3163,6 @@ module ts {
|
|||
emit(node.name);
|
||||
emitOptional(" = ", node.initializer);
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
|
||||
|
@ -3256,11 +3235,9 @@ module ts {
|
|||
}
|
||||
|
||||
function emitAccessor(node: AccessorDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
write(node.kind === SyntaxKind.GetAccessor ? "get " : "set ");
|
||||
emit(node.name);
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function shouldEmitAsArrowFunction(node: FunctionLikeDeclaration): boolean {
|
||||
|
@ -3364,7 +3341,10 @@ module ts {
|
|||
write(" ");
|
||||
emitStart(node.body);
|
||||
write("return ");
|
||||
emitNode(node.body);
|
||||
|
||||
// Don't emit comments on this body. We'll have already taken care of it above
|
||||
// when we called emitDetachedComments.
|
||||
emitNode(node.body, /*disableComments:*/ true);
|
||||
emitEnd(node.body);
|
||||
write(";");
|
||||
emitTempDeclarations(/*newLine*/ false);
|
||||
|
@ -3381,7 +3361,7 @@ module ts {
|
|||
writeLine();
|
||||
emitLeadingComments(node.body);
|
||||
write("return ");
|
||||
emit(node.body);
|
||||
emit(node.body, /*disableComments:*/ true);
|
||||
write(";");
|
||||
emitTrailingComments(node.body);
|
||||
}
|
||||
|
@ -3562,7 +3542,6 @@ module ts {
|
|||
}
|
||||
|
||||
function emitClassDeclaration(node: ClassDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
write(" = (function (");
|
||||
|
@ -3612,7 +3591,6 @@ module ts {
|
|||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
|
||||
function emitConstructorOfClass() {
|
||||
var saveTempCount = tempCount;
|
||||
|
@ -3691,13 +3669,17 @@ module ts {
|
|||
emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
|
||||
var isConstEnum = isConst(node);
|
||||
return !isConstEnum || compilerOptions.preserveConstEnums;
|
||||
}
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
// const enums are completely erased during compilation.
|
||||
var isConstEnum = isConst(node);
|
||||
if (isConstEnum && !compilerOptions.preserveConstEnums) {
|
||||
if (!shouldEmitEnumDeclaration(node)) {
|
||||
return;
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
|
@ -3714,7 +3696,7 @@ module ts {
|
|||
write(") {");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
emitEnumMemberDeclarations(isConstEnum);
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
|
@ -3735,32 +3717,27 @@ module ts {
|
|||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitEnumMemberDeclarations(isConstEnum: boolean) {
|
||||
forEach(node.members, member => {
|
||||
writeLine();
|
||||
emitLeadingComments(member);
|
||||
emitStart(member);
|
||||
write(resolver.getLocalNameOfContainer(node));
|
||||
write("[");
|
||||
write(resolver.getLocalNameOfContainer(node));
|
||||
write("[");
|
||||
emitExpressionForPropertyName(member.name);
|
||||
write("] = ");
|
||||
if (member.initializer && !isConstEnum) {
|
||||
emit(member.initializer);
|
||||
}
|
||||
else {
|
||||
write(resolver.getEnumMemberValue(member).toString());
|
||||
}
|
||||
write("] = ");
|
||||
emitExpressionForPropertyName(member.name);
|
||||
emitEnd(member);
|
||||
write(";");
|
||||
emitTrailingComments(member);
|
||||
});
|
||||
function emitEnumMember(node: EnumMember) {
|
||||
var enumParent = <EnumDeclaration>node.parent;
|
||||
emitStart(node);
|
||||
write(resolver.getLocalNameOfContainer(enumParent));
|
||||
write("[");
|
||||
write(resolver.getLocalNameOfContainer(enumParent));
|
||||
write("[");
|
||||
emitExpressionForPropertyName(node.name);
|
||||
write("] = ");
|
||||
if (node.initializer && !isConst(enumParent)) {
|
||||
emit(node.initializer);
|
||||
}
|
||||
else {
|
||||
write(resolver.getEnumMemberValue(node).toString());
|
||||
}
|
||||
write("] = ");
|
||||
emitExpressionForPropertyName(node.name);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
|
||||
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration: ModuleDeclaration): ModuleDeclaration {
|
||||
|
@ -3770,14 +3747,18 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function shouldEmitModuleDeclaration(node: ModuleDeclaration) {
|
||||
return isInstantiatedModule(node, compilerOptions.preserveConstEnums);
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
// Emit only if this module is non-ambient.
|
||||
var shouldEmit = isInstantiatedModule(node, compilerOptions.preserveConstEnums);
|
||||
var shouldEmit = shouldEmitModuleDeclaration(node);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
|
@ -3822,7 +3803,6 @@ module ts {
|
|||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitImportDeclaration(node: ImportDeclaration) {
|
||||
|
@ -4012,7 +3992,7 @@ module ts {
|
|||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emitNode(node: Node): void {
|
||||
function emitNode(node: Node, disableComments?:boolean): void {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
@ -4020,6 +4000,46 @@ module ts {
|
|||
if (node.flags & NodeFlags.Ambient) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node);
|
||||
if (emitComments) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
|
||||
emitJavaScriptWorker(node);
|
||||
|
||||
if (emitComments) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitLeadingAndTrailingComments(node: Node) {
|
||||
switch (node.kind) {
|
||||
// All of these entities are emitted in a specialized fashion. As such, we allow
|
||||
// the specilized methods for each to handle the comments on the nodes.
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
// Only emit the leading/trailing comments for a module if we're actually
|
||||
// emitting the module as well.
|
||||
return shouldEmitModuleDeclaration(<ModuleDeclaration>node);
|
||||
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
// Only emit the leading/trailing comments for an enum if we're actually
|
||||
// emitting the module as well.
|
||||
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
|
||||
}
|
||||
|
||||
// Emit comments for everything else.
|
||||
return true;
|
||||
}
|
||||
|
||||
function emitJavaScriptWorker(node: Node) {
|
||||
// Check if the node can be emitted regardless of the ScriptTarget
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
|
@ -4157,6 +4177,8 @@ module ts {
|
|||
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return emitEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.EnumMember:
|
||||
return emitEnumMember(<EnumMember>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
return emitModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
|
@ -4186,17 +4208,19 @@ module ts {
|
|||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
var leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(node.pos)) {
|
||||
// get comments without detached comments
|
||||
leadingComments = getLeadingCommentsWithoutDetachedComments();
|
||||
if (node.parent) {
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
var leadingComments: CommentRange[];
|
||||
if (hasDetachedComments(node.pos)) {
|
||||
// get comments without detached comments
|
||||
leadingComments = getLeadingCommentsWithoutDetachedComments();
|
||||
}
|
||||
else {
|
||||
// get the leading comments from the node
|
||||
leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile);
|
||||
}
|
||||
return leadingComments;
|
||||
}
|
||||
else {
|
||||
// get the leading comments from the node
|
||||
leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile);
|
||||
}
|
||||
return leadingComments;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4209,10 +4233,12 @@ module ts {
|
|||
|
||||
function emitTrailingDeclarationComments(node: Node) {
|
||||
// Emit the trailing comments only if the parent's end doesn't match
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
|
||||
var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end);
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
if (node.parent) {
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
|
||||
var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end);
|
||||
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
|
||||
emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -332,6 +332,12 @@ module ts {
|
|||
HasAggregatedChildData = 1 << 6
|
||||
}
|
||||
|
||||
export const enum RelationComparisonResult {
|
||||
Succeeded = 1, // Should be truthy
|
||||
Failed = 2,
|
||||
FailedAndReported = 3
|
||||
}
|
||||
|
||||
export interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module TypeScript {
|
||||
export interface Logger {
|
||||
log(s: string): void;
|
||||
}
|
||||
|
||||
export class NullLogger implements Logger {
|
||||
public log(s: string): void {
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,266 +0,0 @@
|
|||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path="references.ts" />
|
||||
|
||||
module TypeScript {
|
||||
export interface IOptions {
|
||||
name?: string;
|
||||
flag?: boolean;
|
||||
short?: string;
|
||||
usage?: {
|
||||
locCode: string; // DiagnosticCode
|
||||
args: string[]
|
||||
};
|
||||
set?: (s: string) => void;
|
||||
type?: string; // DiagnosticCode
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
export class OptionsParser {
|
||||
private DEFAULT_SHORT_FLAG = "-";
|
||||
private DEFAULT_LONG_FLAG = "--";
|
||||
|
||||
private printedVersion: boolean = false;
|
||||
|
||||
// Find the option record for the given string. Returns null if not found.
|
||||
private findOption(arg: string) {
|
||||
var upperCaseArg = arg && arg.toUpperCase();
|
||||
|
||||
for (var i = 0; i < this.options.length; i++) {
|
||||
var current = this.options[i];
|
||||
|
||||
if (upperCaseArg === (current.short && current.short.toUpperCase()) ||
|
||||
upperCaseArg === (current.name && current.name.toUpperCase())) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public unnamed: string[] = [];
|
||||
|
||||
public options: IOptions[] = [];
|
||||
|
||||
constructor(public host: IEnvironment, public version: string) {
|
||||
}
|
||||
|
||||
public printUsage() {
|
||||
this.printVersion();
|
||||
|
||||
var optionsWord = getLocalizedText(DiagnosticCode.options, null);
|
||||
var fileWord = getLocalizedText(DiagnosticCode.file1, null);
|
||||
var tscSyntax = "tsc [" + optionsWord + "] [" + fileWord + " ..]";
|
||||
var syntaxHelp = getLocalizedText(DiagnosticCode.Syntax_0, [tscSyntax]);
|
||||
this.host.standardOut.WriteLine(syntaxHelp);
|
||||
this.host.standardOut.WriteLine("");
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Examples, null) + " tsc hello.ts");
|
||||
this.host.standardOut.WriteLine(" tsc --out foo.js foo.ts");
|
||||
this.host.standardOut.WriteLine(" tsc @args.txt");
|
||||
this.host.standardOut.WriteLine("");
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Options, null));
|
||||
|
||||
var output: string[][] = [];
|
||||
var maxLength = 0;
|
||||
var i = 0;
|
||||
|
||||
this.options = this.options.sort(function (a, b) {
|
||||
var aName = a.name.toLowerCase();
|
||||
var bName = b.name.toLowerCase();
|
||||
|
||||
if (aName > bName) {
|
||||
return 1;
|
||||
} else if (aName < bName) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Build up output array
|
||||
for (i = 0; i < this.options.length; i++) {
|
||||
var option = this.options[i];
|
||||
|
||||
if (option.experimental) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!option.usage) {
|
||||
break;
|
||||
}
|
||||
|
||||
var usageString = " ";
|
||||
var type = option.type ? (" " + TypeScript.getLocalizedText(option.type, null)) : "";
|
||||
|
||||
if (option.short) {
|
||||
usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", ";
|
||||
}
|
||||
|
||||
usageString += this.DEFAULT_LONG_FLAG + option.name + type;
|
||||
|
||||
output.push([usageString, TypeScript.getLocalizedText(option.usage.locCode, option.usage.args)]);
|
||||
|
||||
if (usageString.length > maxLength) {
|
||||
maxLength = usageString.length;
|
||||
}
|
||||
}
|
||||
|
||||
var fileDescription = getLocalizedText(DiagnosticCode.Insert_command_line_options_and_files_from_a_file, null);
|
||||
output.push([" @<" + fileWord + ">", fileDescription]);
|
||||
|
||||
// Print padded output
|
||||
for (i = 0; i < output.length; i++) {
|
||||
this.host.standardOut.WriteLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
public printVersion() {
|
||||
if (!this.printedVersion) {
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Version_0, [this.version]));
|
||||
this.printedVersion = true;
|
||||
}
|
||||
}
|
||||
|
||||
public option(name: string, config: IOptions, short?: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = false;
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
public flag(name: string, config: IOptions, short?: string) {
|
||||
if (!config) {
|
||||
config = <any>short;
|
||||
short = null;
|
||||
}
|
||||
|
||||
config.name = name;
|
||||
config.short = short;
|
||||
config.flag = true;
|
||||
|
||||
this.options.push(config);
|
||||
}
|
||||
|
||||
// Parse an arguments string
|
||||
public parseString(argString: string) {
|
||||
var position = 0;
|
||||
var tokens = argString.match(/\s+|"|[^\s"]+/g);
|
||||
|
||||
function peek() {
|
||||
return tokens[position];
|
||||
}
|
||||
|
||||
function consume() {
|
||||
return tokens[position++];
|
||||
}
|
||||
|
||||
function consumeQuotedString() {
|
||||
var value = '';
|
||||
consume(); // skip opening quote.
|
||||
|
||||
var token = peek();
|
||||
|
||||
while (token && token !== '"') {
|
||||
consume();
|
||||
|
||||
value += token;
|
||||
|
||||
token = peek();
|
||||
}
|
||||
|
||||
consume(); // skip ending quote;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var args: string[] = [];
|
||||
var currentArg = '';
|
||||
|
||||
while (position < tokens.length) {
|
||||
var token = peek();
|
||||
|
||||
if (token === '"') {
|
||||
currentArg += consumeQuotedString();
|
||||
} else if (token.match(/\s/)) {
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
currentArg = '';
|
||||
}
|
||||
|
||||
consume();
|
||||
} else {
|
||||
consume();
|
||||
currentArg += token;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentArg.length > 0) {
|
||||
args.push(currentArg);
|
||||
}
|
||||
|
||||
this.parse(args);
|
||||
}
|
||||
|
||||
// Parse arguments as they come from the platform: split into arguments.
|
||||
public parse(args: string[]) {
|
||||
var position = 0;
|
||||
|
||||
function consume() {
|
||||
return args[position++];
|
||||
}
|
||||
|
||||
while (position < args.length) {
|
||||
var current = consume();
|
||||
var match = current.match(/^(--?|@)(.*)/);
|
||||
var value: any = null;
|
||||
|
||||
if (match) {
|
||||
if (match[1] === '@') {
|
||||
this.parseString(this.host.readFile(match[2], null).contents);
|
||||
} else {
|
||||
var arg = match[2];
|
||||
var option = this.findOption(arg);
|
||||
|
||||
if (option === null) {
|
||||
this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Unknown_compiler_option_0, [arg]));
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"]));
|
||||
} else {
|
||||
if (!option.flag) {
|
||||
value = consume();
|
||||
if (value === undefined) {
|
||||
// No value provided
|
||||
this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Option_0_specified_without_1, [arg, getLocalizedText(option.type, null)]));
|
||||
this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"]));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
option.set(value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.unnamed.push(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,736 +0,0 @@
|
|||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='typescript.ts'/>
|
||||
///<reference path='io.ts'/>
|
||||
///<reference path='optionsParser.ts'/>
|
||||
|
||||
module TypeScript {
|
||||
class SourceFile {
|
||||
constructor(public scriptSnapshot: IScriptSnapshot, public byteOrderMark: ByteOrderMark) {
|
||||
}
|
||||
}
|
||||
|
||||
class DiagnosticsLogger implements ILogger {
|
||||
constructor(public ioHost: IEnvironment) {
|
||||
}
|
||||
public information(): boolean { return false; }
|
||||
public debug(): boolean { return false; }
|
||||
public warning(): boolean { return false; }
|
||||
public error(): boolean { return false; }
|
||||
public fatal(): boolean { return false; }
|
||||
public log(s: string): void {
|
||||
this.ioHost.standardOut.WriteLine(s);
|
||||
}
|
||||
}
|
||||
|
||||
export class BatchCompiler implements IReferenceResolverHost {
|
||||
public compilerVersion = "1.0.1.0";
|
||||
private inputFiles: string[] = [];
|
||||
private compilationSettings: ImmutableCompilationSettings;
|
||||
private resolvedFiles: IResolvedFile[] = [];
|
||||
private fileNameToSourceFile = new StringHashTable<SourceFile>();
|
||||
private hasErrors: boolean = false;
|
||||
private logger: ILogger = null;
|
||||
|
||||
constructor(private ioHost: IEnvironment) {
|
||||
}
|
||||
|
||||
// Begin batch compilation
|
||||
public batchCompile() {
|
||||
// Parse command line options
|
||||
if (this.parseOptions()) {
|
||||
var start = new Date().getTime();
|
||||
|
||||
if (this.compilationSettings.gatherDiagnostics()) {
|
||||
this.logger = new DiagnosticsLogger(this.ioHost);
|
||||
} else {
|
||||
this.logger = new NullLogger();
|
||||
}
|
||||
|
||||
if (this.compilationSettings.watch()) {
|
||||
// Watch will cause the program to stick around as long as the files exist
|
||||
this.watchFiles();
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve the compilation environemnt
|
||||
this.resolve();
|
||||
|
||||
this.compile();
|
||||
|
||||
if (this.compilationSettings.gatherDiagnostics()) {
|
||||
this.logger.log("");
|
||||
this.logger.log("File resolution time: " + TypeScript.fileResolutionTime);
|
||||
this.logger.log(" file read: " + TypeScript.fileResolutionIOTime);
|
||||
this.logger.log(" scan imports: " + TypeScript.fileResolutionScanImportsTime);
|
||||
this.logger.log(" import search: " + TypeScript.fileResolutionImportFileSearchTime);
|
||||
this.logger.log(" get lib.d.ts: " + TypeScript.fileResolutionGetDefaultLibraryTime);
|
||||
|
||||
this.logger.log("SyntaxTree parse time: " + TypeScript.syntaxTreeParseTime);
|
||||
this.logger.log("Syntax Diagnostics time: " + TypeScript.syntaxDiagnosticsTime);
|
||||
this.logger.log("Create declarations time: " + TypeScript.createDeclarationsTime);
|
||||
this.logger.log("");
|
||||
this.logger.log("Type check time: " + TypeScript.typeCheckTime);
|
||||
this.logger.log("");
|
||||
this.logger.log("Emit time: " + TypeScript.emitTime);
|
||||
this.logger.log("Declaration emit time: " + TypeScript.declarationEmitTime);
|
||||
|
||||
this.logger.log("Total number of symbols created: " + TypeScript.pullSymbolID);
|
||||
this.logger.log("Specialized types created: " + TypeScript.nSpecializationsCreated);
|
||||
this.logger.log("Specialized signatures created: " + TypeScript.nSpecializedSignaturesCreated);
|
||||
|
||||
this.logger.log(" IsExternallyVisibleTime: " + TypeScript.declarationEmitIsExternallyVisibleTime);
|
||||
this.logger.log(" TypeSignatureTime: " + TypeScript.declarationEmitTypeSignatureTime);
|
||||
this.logger.log(" GetBoundDeclTypeTime: " + TypeScript.declarationEmitGetBoundDeclTypeTime);
|
||||
this.logger.log(" IsOverloadedCallSignatureTime: " + TypeScript.declarationEmitIsOverloadedCallSignatureTime);
|
||||
this.logger.log(" FunctionDeclarationGetSymbolTime: " + TypeScript.declarationEmitFunctionDeclarationGetSymbolTime);
|
||||
this.logger.log(" GetBaseTypeTime: " + TypeScript.declarationEmitGetBaseTypeTime);
|
||||
this.logger.log(" GetAccessorFunctionTime: " + TypeScript.declarationEmitGetAccessorFunctionTime);
|
||||
this.logger.log(" GetTypeParameterSymbolTime: " + TypeScript.declarationEmitGetTypeParameterSymbolTime);
|
||||
this.logger.log(" GetImportDeclarationSymbolTime: " + TypeScript.declarationEmitGetImportDeclarationSymbolTime);
|
||||
|
||||
this.logger.log("Emit write file time: " + TypeScript.emitWriteFileTime);
|
||||
|
||||
this.logger.log("Compiler resolve path time: " + TypeScript.compilerResolvePathTime);
|
||||
this.logger.log("Compiler directory name time: " + TypeScript.compilerDirectoryNameTime);
|
||||
this.logger.log("Compiler directory exists time: " + TypeScript.compilerDirectoryExistsTime);
|
||||
this.logger.log("Compiler file exists time: " + TypeScript.compilerFileExistsTime);
|
||||
|
||||
this.logger.log("IO host resolve path time: " + TypeScript.ioHostResolvePathTime);
|
||||
this.logger.log("IO host directory name time: " + TypeScript.ioHostDirectoryNameTime);
|
||||
this.logger.log("IO host create directory structure time: " + TypeScript.ioHostCreateDirectoryStructureTime);
|
||||
this.logger.log("IO host write file time: " + TypeScript.ioHostWriteFileTime);
|
||||
|
||||
this.logger.log("Node make directory time: " + TypeScript.nodeMakeDirectoryTime);
|
||||
this.logger.log("Node writeFileSync time: " + TypeScript.nodeWriteFileSyncTime);
|
||||
this.logger.log("Node createBuffer time: " + TypeScript.nodeCreateBufferTime);
|
||||
|
||||
this.logger.log("Total time: " + (new Date().getTime() - start));
|
||||
}
|
||||
}
|
||||
|
||||
// Exit with the appropriate error code
|
||||
this.ioHost.quit(this.hasErrors ? 1 : 0);
|
||||
}
|
||||
|
||||
private resolve() {
|
||||
// Resolve file dependencies, if requested
|
||||
var includeDefaultLibrary = !this.compilationSettings.noLib();
|
||||
var resolvedFiles: IResolvedFile[] = [];
|
||||
|
||||
var start = new Date().getTime();
|
||||
|
||||
if (!this.compilationSettings.noResolve()) {
|
||||
// Resolve references
|
||||
var resolutionResults = ReferenceResolver.resolve(this.inputFiles, this, this.compilationSettings.useCaseSensitiveFileResolution());
|
||||
resolvedFiles = resolutionResults.resolvedFiles;
|
||||
|
||||
// Only include the library if useDefaultLib is set to true and did not see any 'no-default-lib' comments
|
||||
includeDefaultLibrary = !this.compilationSettings.noLib() && !resolutionResults.seenNoDefaultLibTag;
|
||||
|
||||
// Populate any diagnostic messages generated during resolution
|
||||
resolutionResults.diagnostics.forEach(d => this.addDiagnostic(d));
|
||||
}
|
||||
else {
|
||||
for (var i = 0, n = this.inputFiles.length; i < n; i++) {
|
||||
var inputFile = this.inputFiles[i];
|
||||
var referencedFiles: string[] = [];
|
||||
var importedFiles: string[] = [];
|
||||
|
||||
// If declaration files are going to be emitted, preprocess the file contents and add in referenced files as well
|
||||
if (this.compilationSettings.generateDeclarationFiles()) {
|
||||
var references = getReferencedFiles(inputFile, this.getScriptSnapshot(inputFile));
|
||||
for (var j = 0; j < references.length; j++) {
|
||||
referencedFiles.push(references[j].path);
|
||||
}
|
||||
|
||||
inputFile = this.resolvePath(inputFile);
|
||||
}
|
||||
|
||||
resolvedFiles.push({
|
||||
path: inputFile,
|
||||
referencedFiles: referencedFiles,
|
||||
importedFiles: importedFiles
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var defaultLibStart = new Date().getTime();
|
||||
if (includeDefaultLibrary) {
|
||||
var libraryResolvedFile: IResolvedFile = {
|
||||
path: this.getDefaultLibraryFilePath(),
|
||||
referencedFiles: [],
|
||||
importedFiles: []
|
||||
};
|
||||
|
||||
// Prepend the library to the resolved list
|
||||
resolvedFiles = [libraryResolvedFile].concat(resolvedFiles);
|
||||
}
|
||||
TypeScript.fileResolutionGetDefaultLibraryTime += new Date().getTime() - defaultLibStart;
|
||||
|
||||
this.resolvedFiles = resolvedFiles;
|
||||
|
||||
TypeScript.fileResolutionTime = new Date().getTime() - start;
|
||||
}
|
||||
|
||||
// Returns true if compilation failed from some reason.
|
||||
private compile(): void {
|
||||
var compiler = new TypeScriptCompiler(this.logger, this.compilationSettings);
|
||||
|
||||
this.resolvedFiles.forEach(resolvedFile => {
|
||||
var sourceFile = this.getSourceFile(resolvedFile.path);
|
||||
compiler.addFile(resolvedFile.path, sourceFile.scriptSnapshot, sourceFile.byteOrderMark, /*version:*/ 0, /*isOpen:*/ false, resolvedFile.referencedFiles);
|
||||
});
|
||||
|
||||
for (var it = compiler.compile((path: string) => this.resolvePath(path)); it.moveNext();) {
|
||||
var result = it.current();
|
||||
|
||||
result.diagnostics.forEach(d => this.addDiagnostic(d));
|
||||
if (!this.tryWriteOutputFiles(result.outputFiles)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse command line options
|
||||
private parseOptions() {
|
||||
var opts = new OptionsParser(this.ioHost, this.compilerVersion);
|
||||
|
||||
var mutableSettings = new CompilationSettings();
|
||||
opts.option('out', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Concatenate_and_emit_output_to_single_file,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.file2,
|
||||
set: (str) => {
|
||||
mutableSettings.outFileOption = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('outDir', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Redirect_output_structure_to_the_directory,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.DIRECTORY,
|
||||
set: (str) => {
|
||||
mutableSettings.outDirOption = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('sourcemap', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Generates_corresponding_0_file,
|
||||
args: ['.map']
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.mapSourceFiles = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('mapRoot', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.LOCATION,
|
||||
set: (str) => {
|
||||
mutableSettings.mapRoot = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('sourceRoot', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.LOCATION,
|
||||
set: (str) => {
|
||||
mutableSettings.sourceRoot = str;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('declaration', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Generates_corresponding_0_file,
|
||||
args: ['.d.ts']
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.generateDeclarationFiles = true;
|
||||
}
|
||||
}, 'd');
|
||||
|
||||
if (this.ioHost.watchFile) {
|
||||
opts.flag('watch', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Watch_input_files,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.watch = true;
|
||||
}
|
||||
}, 'w');
|
||||
}
|
||||
|
||||
opts.flag('propagateEnumConstants', {
|
||||
experimental: true,
|
||||
set: () => { mutableSettings.propagateEnumConstants = true; }
|
||||
});
|
||||
|
||||
opts.flag('removeComments', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Do_not_emit_comments_to_output,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.removeComments = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noResolve', {
|
||||
experimental: true,
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Skip_resolution_and_preprocessing,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.noResolve = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noLib', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.noLib = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('diagnostics', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.gatherDiagnostics = true;
|
||||
}
|
||||
});
|
||||
|
||||
opts.option('target', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_ECMAScript_target_version_0_default_or_1,
|
||||
args: ['ES3', 'ES5']
|
||||
},
|
||||
type: DiagnosticCode.VERSION,
|
||||
set: (type) => {
|
||||
type = type.toLowerCase();
|
||||
|
||||
if (type === 'es3') {
|
||||
mutableSettings.codeGenTarget = LanguageVersion.EcmaScript3;
|
||||
}
|
||||
else if (type === 'es5') {
|
||||
mutableSettings.codeGenTarget = LanguageVersion.EcmaScript5;
|
||||
}
|
||||
else {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["target", "ES3", "ES5"]));
|
||||
}
|
||||
}
|
||||
}, 't');
|
||||
|
||||
opts.option('module', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_module_code_generation_0_or_1,
|
||||
args: ['commonjs', 'amd']
|
||||
},
|
||||
type: DiagnosticCode.KIND,
|
||||
set: (type) => {
|
||||
type = type.toLowerCase();
|
||||
|
||||
if (type === 'commonjs') {
|
||||
mutableSettings.moduleGenTarget = ModuleGenTarget.Synchronous;
|
||||
}
|
||||
else if (type === 'amd') {
|
||||
mutableSettings.moduleGenTarget = ModuleGenTarget.Asynchronous;
|
||||
}
|
||||
else {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["module", "commonjs", "amd"]));
|
||||
}
|
||||
}
|
||||
}, 'm');
|
||||
|
||||
var needsHelp = false;
|
||||
opts.flag('help', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Print_this_message,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
needsHelp = true;
|
||||
}
|
||||
}, 'h');
|
||||
|
||||
opts.flag('useCaseSensitiveFileResolution', {
|
||||
experimental: true,
|
||||
set: () => {
|
||||
mutableSettings.useCaseSensitiveFileResolution = true;
|
||||
}
|
||||
});
|
||||
var shouldPrintVersionOnly = false;
|
||||
opts.flag('version', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Print_the_compiler_s_version_0,
|
||||
args: [this.compilerVersion]
|
||||
},
|
||||
set: () => {
|
||||
shouldPrintVersionOnly = true;
|
||||
}
|
||||
}, 'v');
|
||||
|
||||
var locale: string = null;
|
||||
opts.option('locale', {
|
||||
experimental: true,
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_locale_for_errors_and_messages_For_example_0_or_1,
|
||||
args: ['en', 'ja-jp']
|
||||
},
|
||||
type: DiagnosticCode.STRING,
|
||||
set: (value) => {
|
||||
locale = value;
|
||||
}
|
||||
});
|
||||
|
||||
opts.flag('noImplicitAny', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
|
||||
args: null
|
||||
},
|
||||
set: () => {
|
||||
mutableSettings.noImplicitAny = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (Environment.supportsCodePage()) {
|
||||
opts.option('codepage', {
|
||||
usage: {
|
||||
locCode: DiagnosticCode.Specify_the_codepage_to_use_when_opening_source_files,
|
||||
args: null
|
||||
},
|
||||
type: DiagnosticCode.NUMBER,
|
||||
set: (arg) => {
|
||||
mutableSettings.codepage = parseInt(arg, 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
opts.parse(this.ioHost.arguments);
|
||||
|
||||
this.compilationSettings = ImmutableCompilationSettings.fromCompilationSettings(mutableSettings);
|
||||
|
||||
if (locale) {
|
||||
if (!this.setLocale(locale)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.inputFiles.push.apply(this.inputFiles, opts.unnamed);
|
||||
|
||||
if (shouldPrintVersionOnly) {
|
||||
opts.printVersion();
|
||||
return false;
|
||||
}
|
||||
// If no source files provided to compiler - print usage information
|
||||
else if (this.inputFiles.length === 0 || needsHelp) {
|
||||
opts.printUsage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.hasErrors;
|
||||
}
|
||||
|
||||
private setLocale(locale: string): boolean {
|
||||
var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
|
||||
if (!matchResult) {
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, ['en', 'ja-jp']));
|
||||
return false;
|
||||
}
|
||||
|
||||
var language = matchResult[1];
|
||||
var territory = matchResult[3];
|
||||
|
||||
// First try the entire locale, then fall back to just language if that's all we have.
|
||||
if (!this.setLanguageAndTerritory(language, territory) &&
|
||||
!this.setLanguageAndTerritory(language, null)) {
|
||||
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Unsupported_locale_0, [locale]));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private setLanguageAndTerritory(language: string, territory: string): boolean {
|
||||
|
||||
var compilerFilePath = this.ioHost.executingFilePath();
|
||||
var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath);
|
||||
|
||||
var filePath = IOUtils.combine(containingDirectoryPath, language);
|
||||
if (territory) {
|
||||
filePath = filePath + "-" + territory;
|
||||
}
|
||||
|
||||
filePath = this.resolvePath(IOUtils.combine(filePath, "diagnosticMessages.generated.json"));
|
||||
|
||||
if (!this.fileExists(filePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var fileContents = this.ioHost.readFile(filePath, this.compilationSettings.codepage());
|
||||
TypeScript.LocalizedDiagnosticMessages = JSON.parse(fileContents.contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle -watch switch
|
||||
private watchFiles() {
|
||||
if (!this.ioHost.watchFile) {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(null, null, 0, 0, DiagnosticCode.Current_host_does_not_support_0_option, ['-w[atch]']));
|
||||
return;
|
||||
}
|
||||
|
||||
var lastResolvedFileSet: string[] = []
|
||||
var watchers: { [x: string]: IFileWatcher; } = {};
|
||||
var firstTime = true;
|
||||
|
||||
var addWatcher = (fileName: string) => {
|
||||
if (!watchers[fileName]) {
|
||||
var watcher = this.ioHost.watchFile(fileName, onWatchedFileChange);
|
||||
watchers[fileName] = watcher;
|
||||
}
|
||||
};
|
||||
|
||||
var removeWatcher = (fileName: string) => {
|
||||
if (watchers[fileName]) {
|
||||
watchers[fileName].close();
|
||||
delete watchers[fileName];
|
||||
}
|
||||
};
|
||||
|
||||
var onWatchedFileChange = () => {
|
||||
// Clean errors for previous compilation
|
||||
this.hasErrors = false;
|
||||
|
||||
// Clear out any source file data we've cached.
|
||||
this.fileNameToSourceFile = new StringHashTable<SourceFile>();
|
||||
|
||||
// Resolve file dependencies, if requested
|
||||
this.resolve();
|
||||
|
||||
// Check if any new files were added to the environment as a result of the file change
|
||||
var oldFiles = lastResolvedFileSet;
|
||||
var newFiles = this.resolvedFiles.map(resolvedFile => resolvedFile.path).sort();
|
||||
|
||||
var i = 0, j = 0;
|
||||
while (i < oldFiles.length && j < newFiles.length) {
|
||||
|
||||
var compareResult = oldFiles[i].localeCompare(newFiles[j]);
|
||||
if (compareResult === 0) {
|
||||
// No change here
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
else if (compareResult < 0) {
|
||||
// Entry in old list does not exist in the new one, it was removed
|
||||
removeWatcher(oldFiles[i]);
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
// Entry in new list does exist in the new one, it was added
|
||||
addWatcher(newFiles[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// All remaining unmatched items in the old list have been removed
|
||||
for (var k = i; k < oldFiles.length; k++) {
|
||||
removeWatcher(oldFiles[k]);
|
||||
}
|
||||
|
||||
// All remaing unmatched items in the new list have been added
|
||||
for (k = j; k < newFiles.length; k++) {
|
||||
addWatcher(newFiles[k]);
|
||||
}
|
||||
|
||||
// Update the state
|
||||
lastResolvedFileSet = newFiles;
|
||||
|
||||
// Print header
|
||||
if (!firstTime) {
|
||||
var fileNames = "";
|
||||
for (var k = 0; k < lastResolvedFileSet.length; k++) {
|
||||
fileNames += Environment.newLine + " " + lastResolvedFileSet[k];
|
||||
}
|
||||
this.ioHost.standardError.WriteLine(getLocalizedText(DiagnosticCode.NL_Recompiling_0, [fileNames]));
|
||||
}
|
||||
else {
|
||||
firstTime = false;
|
||||
}
|
||||
|
||||
// Trigger a new compilation
|
||||
this.compile();
|
||||
};
|
||||
|
||||
// Switch to using stdout for all error messages
|
||||
this.ioHost.standardOut = this.ioHost.standardOut;
|
||||
|
||||
onWatchedFileChange();
|
||||
}
|
||||
|
||||
private getSourceFile(fileName: string): SourceFile {
|
||||
var sourceFile: SourceFile = this.fileNameToSourceFile.lookup(fileName);
|
||||
if (!sourceFile) {
|
||||
// Attempt to read the file
|
||||
var fileInformation: FileInformation;
|
||||
|
||||
try {
|
||||
fileInformation = this.ioHost.readFile(fileName, this.compilationSettings.codepage());
|
||||
}
|
||||
catch (e) {
|
||||
this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Cannot_read_file_0_1, [fileName, e.message]));
|
||||
fileInformation = new FileInformation("", ByteOrderMark.None);
|
||||
}
|
||||
|
||||
var snapshot = ScriptSnapshot.fromString(fileInformation.contents);
|
||||
var sourceFile = new SourceFile(snapshot, fileInformation.byteOrderMark);
|
||||
this.fileNameToSourceFile.add(fileName, sourceFile);
|
||||
}
|
||||
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
private getDefaultLibraryFilePath(): string {
|
||||
var compilerFilePath = this.ioHost.executingFilePath();
|
||||
var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath);
|
||||
var libraryFilePath = this.resolvePath(IOUtils.combine(containingDirectoryPath, "lib.d.ts"));
|
||||
|
||||
return libraryFilePath;
|
||||
}
|
||||
|
||||
/// IReferenceResolverHost methods
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot {
|
||||
return this.getSourceFile(fileName).scriptSnapshot;
|
||||
}
|
||||
|
||||
resolveRelativePath(path: string, directory: string): string {
|
||||
var unQuotedPath = stripStartAndEndQuotes(path);
|
||||
var normalizedPath: string;
|
||||
|
||||
if (isRooted(unQuotedPath) || !directory) {
|
||||
normalizedPath = unQuotedPath;
|
||||
} else {
|
||||
normalizedPath = IOUtils.combine(directory, unQuotedPath);
|
||||
}
|
||||
|
||||
// get the absolute path
|
||||
normalizedPath = this.resolvePath(normalizedPath);
|
||||
|
||||
// Switch to forward slashes
|
||||
normalizedPath = switchToForwardSlashes(normalizedPath);
|
||||
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
private fileExistsCache = createIntrinsicsObject<boolean>();
|
||||
|
||||
fileExists(path: string): boolean {
|
||||
var exists = this.fileExistsCache[path];
|
||||
if (exists === undefined) {
|
||||
var start = new Date().getTime();
|
||||
exists = this.ioHost.fileExists(path);
|
||||
this.fileExistsCache[path] = exists;
|
||||
TypeScript.compilerFileExistsTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
getParentDirectory(path: string): string {
|
||||
var start = new Date().getTime();
|
||||
var result = this.ioHost.directoryName(path);
|
||||
TypeScript.compilerDirectoryNameTime += new Date().getTime() - start;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private addDiagnostic(diagnostic: Diagnostic): void {
|
||||
var diagnosticInfo = diagnostic.info();
|
||||
if (diagnosticInfo.category === DiagnosticCategory.Error) {
|
||||
this.hasErrors = true;
|
||||
}
|
||||
|
||||
this.ioHost.standardError.Write(TypeScriptCompiler.getFullDiagnosticText(diagnostic, path => this.resolvePath(path)));
|
||||
}
|
||||
|
||||
private tryWriteOutputFiles(outputFiles: OutputFile[]): boolean {
|
||||
for (var i = 0, n = outputFiles.length; i < n; i++) {
|
||||
var outputFile = outputFiles[i];
|
||||
|
||||
try {
|
||||
this.writeFile(outputFile.name, outputFile.text, outputFile.writeByteOrderMark);
|
||||
}
|
||||
catch (e) {
|
||||
this.addDiagnostic(
|
||||
new Diagnostic(outputFile.name, null, 0, 0, DiagnosticCode.Emit_Error_0, [e.message]));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
writeFile(fileName: string, contents: string, writeByteOrderMark: boolean): void {
|
||||
var start = new Date().getTime();
|
||||
IOUtils.writeFileAndFolderStructure(this.ioHost, fileName, contents, writeByteOrderMark);
|
||||
TypeScript.emitWriteFileTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
directoryExists(path: string): boolean {
|
||||
var start = new Date().getTime();
|
||||
var result = this.ioHost.directoryExists(path);
|
||||
TypeScript.compilerDirectoryExistsTime += new Date().getTime() - start;
|
||||
return result;
|
||||
}
|
||||
|
||||
// For performance reasons we cache the results of resolvePath. This avoids costly lookup
|
||||
// on the disk once we've already resolved a path once.
|
||||
private resolvePathCache = createIntrinsicsObject<string>();
|
||||
|
||||
resolvePath(path: string): string {
|
||||
var cachedValue = this.resolvePathCache[path];
|
||||
if (!cachedValue) {
|
||||
var start = new Date().getTime();
|
||||
cachedValue = this.ioHost.absolutePath(path);
|
||||
this.resolvePathCache[path] = cachedValue;
|
||||
TypeScript.compilerResolvePathTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
return cachedValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Start the batch compilation using the current hosts IO
|
||||
var batch = new TypeScript.BatchCompiler(Environment);
|
||||
batch.batchCompile();
|
||||
}
|
|
@ -402,19 +402,13 @@ module TypeScript {
|
|||
Option_0_specified_without_1: "Option '{0}' specified without '{1}'",
|
||||
codepage_option_not_supported_on_current_platform: "'codepage' option not supported on current platform.",
|
||||
Concatenate_and_emit_output_to_single_file: "Concatenate and emit output to single file.",
|
||||
Generates_corresponding_0_file: "Generates corresponding {0} file.",
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: "Specifies the location where debugger should locate map files instead of generated locations.",
|
||||
Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: "Specifies the location where debugger should locate TypeScript files instead of source locations.",
|
||||
Watch_input_files: "Watch input files.",
|
||||
Redirect_output_structure_to_the_directory: "Redirect output structure to the directory.",
|
||||
Do_not_emit_comments_to_output: "Do not emit comments to output.",
|
||||
Skip_resolution_and_preprocessing: "Skip resolution and preprocessing.",
|
||||
Specify_ECMAScript_target_version_0_default_or_1: "Specify ECMAScript target version: '{0}' (default), or '{1}'",
|
||||
Specify_module_code_generation_0_or_1: "Specify module code generation: '{0}' or '{1}'",
|
||||
Print_this_message: "Print this message.",
|
||||
Print_the_compiler_s_version_0: "Print the compiler's version: {0}",
|
||||
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: "Allow use of deprecated '{0}' keyword when referencing an external module.",
|
||||
Specify_locale_for_errors_and_messages_For_example_0_or_1: "Specify locale for errors and messages. For example '{0}' or '{1}'",
|
||||
Syntax_0: "Syntax: {0}",
|
||||
options: "options",
|
||||
file1: "file",
|
||||
|
@ -431,7 +425,6 @@ module TypeScript {
|
|||
LOCATION: "LOCATION",
|
||||
DIRECTORY: "DIRECTORY",
|
||||
NUMBER: "NUMBER",
|
||||
Specify_the_codepage_to_use_when_opening_source_files: "Specify the codepage to use when opening source files.",
|
||||
Additional_locations: "Additional locations:",
|
||||
This_version_of_the_Javascript_runtime_does_not_support_the_0_function: "This version of the Javascript runtime does not support the '{0}' function.",
|
||||
Unknown_rule: "Unknown rule.",
|
||||
|
|
|
@ -335,36 +335,44 @@ module ts {
|
|||
var paramTag = "@param";
|
||||
var jsDocCommentParts: SymbolDisplayPart[] = [];
|
||||
|
||||
ts.forEach(declarations, declaration => {
|
||||
var sourceFileOfDeclaration = getSourceFileOfNode(declaration);
|
||||
// If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments
|
||||
if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) {
|
||||
ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedParamJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
ts.forEach(declarations, (declaration, indexOfDeclaration) => {
|
||||
// Make sure we are collecting doc comment from declaration once,
|
||||
// In case of union property there might be same declaration multiple times
|
||||
// which only varies in type parameter
|
||||
// Eg. var a: Array<string> | Array<number>; a.length
|
||||
// The property length will have two declarations of property length coming
|
||||
// from Array<T> - Array<string> and Array<number>
|
||||
if (indexOf(declarations, declaration) === indexOfDeclaration) {
|
||||
var sourceFileOfDeclaration = getSourceFileOfNode(declaration);
|
||||
// If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments
|
||||
if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) {
|
||||
ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedParamJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If this is left side of dotted module declaration, there is no doc comments associated with this node
|
||||
if (declaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>declaration).body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
return;
|
||||
}
|
||||
// If this is left side of dotted module declaration, there is no doc comments associated with this node
|
||||
if (declaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>declaration).body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is dotted module name, get the doc comments from the parent
|
||||
while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) {
|
||||
declaration = <ModuleDeclaration>declaration.parent;
|
||||
}
|
||||
// If this is dotted module name, get the doc comments from the parent
|
||||
while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) {
|
||||
declaration = <ModuleDeclaration>declaration.parent;
|
||||
}
|
||||
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
ts.forEach(getJsDocCommentTextRange(
|
||||
declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment);
|
||||
}
|
||||
});
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
ts.forEach(getJsDocCommentTextRange(
|
||||
declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return jsDocCommentParts;
|
||||
|
|
7
src/services/syntax/SyntaxGenerator.d.ts
vendored
7
src/services/syntax/SyntaxGenerator.d.ts
vendored
|
@ -383,19 +383,13 @@ declare module TypeScript {
|
|||
Option_0_specified_without_1: string;
|
||||
codepage_option_not_supported_on_current_platform: string;
|
||||
Concatenate_and_emit_output_to_single_file: string;
|
||||
Generates_corresponding_0_file: string;
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: string;
|
||||
Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: string;
|
||||
Watch_input_files: string;
|
||||
Redirect_output_structure_to_the_directory: string;
|
||||
Do_not_emit_comments_to_output: string;
|
||||
Skip_resolution_and_preprocessing: string;
|
||||
Specify_ECMAScript_target_version_0_default_or_1: string;
|
||||
Specify_module_code_generation_0_or_1: string;
|
||||
Print_this_message: string;
|
||||
Print_the_compiler_s_version_0: string;
|
||||
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: string;
|
||||
Specify_locale_for_errors_and_messages_For_example_0_or_1: string;
|
||||
Syntax_0: string;
|
||||
options: string;
|
||||
file1: string;
|
||||
|
@ -412,7 +406,6 @@ declare module TypeScript {
|
|||
LOCATION: string;
|
||||
DIRECTORY: string;
|
||||
NUMBER: string;
|
||||
Specify_the_codepage_to_use_when_opening_source_files: string;
|
||||
Additional_locations: string;
|
||||
This_version_of_the_Javascript_runtime_does_not_support_the_0_function: string;
|
||||
Unknown_rule: string;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'.
|
||||
Property 'length' is missing in type 'B'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/arrayAssignmentTest3.ts (1 errors) ====
|
||||
|
@ -16,5 +17,6 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of t
|
|||
var xx = new a(null, 7, new B());
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'.
|
||||
!!! error TS2345: Property 'length' is missing in type 'B'.
|
||||
|
||||
|
|
@ -103,6 +103,7 @@ var __extends = this.__extends || function (d, b) {
|
|||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
// Arrow function used in with statement
|
||||
with (window) {
|
||||
var p = function () { return this; };
|
||||
}
|
||||
|
@ -142,6 +143,7 @@ var M;
|
|||
// Repeat above for module members that are functions? (necessary to redo all of them?)
|
||||
var M2;
|
||||
(function (M2) {
|
||||
// Arrow function used in with statement
|
||||
with (window) {
|
||||
var p = function () { return this; };
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of typ
|
|||
tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
Types of parameters 's' and 'n' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
|
||||
|
@ -23,8 +26,11 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ
|
|||
foo3((s:string) => { });
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
!!! error TS2345: Types of parameters 's' and 'n' are incompatible.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
foo3((n) => { return; });
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
!!! error TS2345: Type 'void' is not assignable to type 'number'.
|
||||
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'.
|
||||
Index signature is missing in type 'Foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts (1 errors) ====
|
||||
|
@ -19,4 +20,5 @@ tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5):
|
|||
Biz(new Foo());
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'.
|
||||
!!! error TS2345: Index signature is missing in type 'Foo'.
|
||||
|
|
@ -31,7 +31,7 @@ var e2;
|
|||
(function (e2) {
|
||||
e2[e2["One"] = 0] = "One";
|
||||
})(e2 || (e2 = {}));
|
||||
;
|
||||
; // error
|
||||
var e2 = (function () {
|
||||
function e2() {
|
||||
}
|
||||
|
|
|
@ -47,5 +47,5 @@ var i3;
|
|||
(function (i3) {
|
||||
i3[i3["One"] = 0] = "One";
|
||||
})(i3 || (i3 = {}));
|
||||
;
|
||||
; // error
|
||||
//import i4 = require(''); // error
|
||||
|
|
|
@ -124,21 +124,21 @@ var m1d;
|
|||
var m1d = 1; // error
|
||||
function m2() {
|
||||
}
|
||||
;
|
||||
; // ok since the module is not instantiated
|
||||
var m2a;
|
||||
(function (m2a) {
|
||||
var y = 2;
|
||||
})(m2a || (m2a = {}));
|
||||
function m2a() {
|
||||
}
|
||||
;
|
||||
; // error since the module is instantiated
|
||||
var m2b;
|
||||
(function (m2b) {
|
||||
m2b.y = 2;
|
||||
})(m2b || (m2b = {}));
|
||||
function m2b() {
|
||||
}
|
||||
;
|
||||
; // error since the module is instantiated
|
||||
// should be errors to have function first
|
||||
function m2c() {
|
||||
}
|
||||
|
|
|
@ -31,21 +31,21 @@ module m2g { export class C { foo() { } } }
|
|||
//// [augmentedTypesModules2.js]
|
||||
function m2() {
|
||||
}
|
||||
;
|
||||
; // ok since the module is not instantiated
|
||||
var m2a;
|
||||
(function (m2a) {
|
||||
var y = 2;
|
||||
})(m2a || (m2a = {}));
|
||||
function m2a() {
|
||||
}
|
||||
;
|
||||
; // error since the module is instantiated
|
||||
var m2b;
|
||||
(function (m2b) {
|
||||
m2b.y = 2;
|
||||
})(m2b || (m2b = {}));
|
||||
function m2b() {
|
||||
}
|
||||
;
|
||||
; // error since the module is instantiated
|
||||
function m2c() {
|
||||
}
|
||||
;
|
||||
|
@ -59,7 +59,7 @@ var m2cc;
|
|||
})(m2cc || (m2cc = {}));
|
||||
function m2cc() {
|
||||
}
|
||||
;
|
||||
; // error to have module first
|
||||
function m2f() {
|
||||
}
|
||||
;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,59): error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
|
||||
Type 'B' is not assignable to type 'C'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ====
|
||||
|
@ -23,3 +24,4 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
|
|||
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
|
||||
!!! error TS2345: Type 'B' is not assignable to type 'C'.
|
|
@ -1,5 +1,7 @@
|
|||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,43): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
Type 'T' is not assignable to type 'S'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,29): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
Type 'T' is not assignable to type 'S'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
@ -15,11 +17,13 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
|
|||
(new Chain(t)).then(tt => s).then(ss => t);
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
!!! error TS2345: Type 'T' is not assignable to type 'S'.
|
||||
|
||||
// But error to try to climb up the chain
|
||||
(new Chain(s)).then(ss => t);
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
!!! error TS2345: Type 'T' is not assignable to type 'S'.
|
||||
|
||||
// Staying at T or S should be fine
|
||||
(new Chain(t)).then(tt => t).then(tt => t).then(tt => t);
|
||||
|
|
|
@ -22,6 +22,7 @@ function foo1<T1, T2>()
|
|||
|
||||
|
||||
//// [commaOperatorOtherValidOperation.js]
|
||||
//Comma operator in for loop
|
||||
for (var i = 0, j = 10; i < j; i++, j--) {
|
||||
}
|
||||
//Comma operator in fuction arguments and return
|
||||
|
|
|
@ -8,4 +8,8 @@ var Person = makeClass(
|
|||
);
|
||||
|
||||
//// [commentsOnObjectLiteral1.js]
|
||||
var Person = makeClass({});
|
||||
var Person = makeClass(
|
||||
/**
|
||||
@scope Person
|
||||
*/
|
||||
{});
|
||||
|
|
|
@ -66,7 +66,9 @@ var n = 30;
|
|||
/** var deckaration with comment on type as well*/
|
||||
var y = 20;
|
||||
/// var deckaration with comment on type as well
|
||||
var yy = 20;
|
||||
var yy =
|
||||
/// value comment
|
||||
20;
|
||||
/** comment2 */
|
||||
var z = function (x, y) { return x + y; };
|
||||
var z2;
|
||||
|
|
|
@ -189,6 +189,7 @@ while (false) {
|
|||
label2: label3: label4: const c = 0;
|
||||
n = c;
|
||||
}
|
||||
// Try/catch/finally
|
||||
try {
|
||||
const c = 0;
|
||||
n = c;
|
||||
|
@ -201,12 +202,14 @@ finally {
|
|||
const c = 0;
|
||||
n = c;
|
||||
}
|
||||
// Switch
|
||||
switch (0) {
|
||||
case 0:
|
||||
const c = 0;
|
||||
n = c;
|
||||
break;
|
||||
}
|
||||
// blocks
|
||||
{
|
||||
const c = 0;
|
||||
n = c;
|
||||
|
|
|
@ -20,6 +20,7 @@ for (const c = 0; c < 10; n = c ) {
|
|||
const c = "string";
|
||||
var n;
|
||||
var b;
|
||||
// for scope
|
||||
for (const c = 0; c < 10; n = c) {
|
||||
// for block
|
||||
const c = false;
|
||||
|
|
|
@ -153,6 +153,7 @@ if (true) {
|
|||
while (false) {
|
||||
label2: label3: label4: const c9 = 0;
|
||||
}
|
||||
// Try/catch/finally
|
||||
try {
|
||||
const c10 = 0;
|
||||
}
|
||||
|
@ -162,6 +163,7 @@ catch (e) {
|
|||
finally {
|
||||
const c12 = 0;
|
||||
}
|
||||
// Switch
|
||||
switch (0) {
|
||||
case 0:
|
||||
const c13 = 0;
|
||||
|
@ -170,6 +172,7 @@ switch (0) {
|
|||
const c14 = 0;
|
||||
break;
|
||||
}
|
||||
// blocks
|
||||
{
|
||||
const c15 = 0;
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
Type 'string' is not assignable to type 'Date'.
|
||||
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
Type 'string' is not assignable to type 'Date'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts (2 errors) ====
|
||||
|
@ -21,7 +23,9 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32):
|
|||
var r5 = _.forEach<number>(c2, f);
|
||||
~
|
||||
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
|
||||
var r6 = _.forEach<number>(c2, (x) => { return x.toFixed() });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Index signature is missing in type '{ x: string; }'.
|
||||
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
|
||||
Index signature is missing in type '{ x: string; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ====
|
||||
|
@ -19,3 +20,4 @@ tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Ar
|
|||
f(obj2); // Error - indexer doesn't match
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
|
||||
!!! error TS2345: Index signature is missing in type '{ x: string; }'.
|
|
@ -6,6 +6,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(9
|
|||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(13,21): error TS2339: Property 'b' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(17,21): error TS2339: Property 'c' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
|
||||
Types of property '2' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts (8 errors) ====
|
||||
|
@ -46,6 +48,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(2
|
|||
var x = new C1(undefined, [0, undefined, ""]);
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
|
||||
!!! error TS2345: Types of property '2' are incompatible.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'boolean'.
|
||||
var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
|
||||
|
||||
var y = new C1(10, [0, "", true]);
|
||||
|
|
52
tests/baselines/reference/elaboratedErrors.errors.txt
Normal file
52
tests/baselines/reference/elaboratedErrors.errors.txt
Normal file
|
@ -0,0 +1,52 @@
|
|||
tests/cases/compiler/elaboratedErrors.ts(10,7): error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
|
||||
Types of property 'read' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/elaboratedErrors.ts(20,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
||||
Property 'x' is missing in type 'Beta'.
|
||||
tests/cases/compiler/elaboratedErrors.ts(21,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
||||
tests/cases/compiler/elaboratedErrors.ts(24,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
||||
Property 'y' is missing in type 'Alpha'.
|
||||
tests/cases/compiler/elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/elaboratedErrors.ts (5 errors) ====
|
||||
interface FileSystem {
|
||||
read: number;
|
||||
}
|
||||
|
||||
function fn(s: WorkerFS): void;
|
||||
function fn(s: FileSystem): void;
|
||||
function fn(s: FileSystem|WorkerFS) { }
|
||||
|
||||
// This should issue a large error, not a small one
|
||||
class WorkerFS implements FileSystem {
|
||||
~~~~~~~~
|
||||
!!! error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
|
||||
!!! error TS2420: Types of property 'read' are incompatible.
|
||||
!!! error TS2420: Type 'string' is not assignable to type 'number'.
|
||||
read: string;
|
||||
}
|
||||
|
||||
interface Alpha { x: string; }
|
||||
interface Beta { y: number; }
|
||||
var x: Alpha;
|
||||
var y: Beta;
|
||||
|
||||
// Only one of these errors should be large
|
||||
x = y;
|
||||
~
|
||||
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
||||
!!! error TS2322: Property 'x' is missing in type 'Beta'.
|
||||
x = y;
|
||||
~
|
||||
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
||||
|
||||
// Only one of these errors should be large
|
||||
y = x;
|
||||
~
|
||||
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
||||
!!! error TS2322: Property 'y' is missing in type 'Alpha'.
|
||||
y = x;
|
||||
~
|
||||
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
||||
|
45
tests/baselines/reference/elaboratedErrors.js
Normal file
45
tests/baselines/reference/elaboratedErrors.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
//// [elaboratedErrors.ts]
|
||||
interface FileSystem {
|
||||
read: number;
|
||||
}
|
||||
|
||||
function fn(s: WorkerFS): void;
|
||||
function fn(s: FileSystem): void;
|
||||
function fn(s: FileSystem|WorkerFS) { }
|
||||
|
||||
// This should issue a large error, not a small one
|
||||
class WorkerFS implements FileSystem {
|
||||
read: string;
|
||||
}
|
||||
|
||||
interface Alpha { x: string; }
|
||||
interface Beta { y: number; }
|
||||
var x: Alpha;
|
||||
var y: Beta;
|
||||
|
||||
// Only one of these errors should be large
|
||||
x = y;
|
||||
x = y;
|
||||
|
||||
// Only one of these errors should be large
|
||||
y = x;
|
||||
y = x;
|
||||
|
||||
|
||||
//// [elaboratedErrors.js]
|
||||
function fn(s) {
|
||||
}
|
||||
// This should issue a large error, not a small one
|
||||
var WorkerFS = (function () {
|
||||
function WorkerFS() {
|
||||
}
|
||||
return WorkerFS;
|
||||
})();
|
||||
var x;
|
||||
var y;
|
||||
// Only one of these errors should be large
|
||||
x = y;
|
||||
x = y;
|
||||
// Only one of these errors should be large
|
||||
y = x;
|
||||
y = x;
|
|
@ -204,19 +204,20 @@ constructorTestObject.arg\u0031 = 1;
|
|||
constructorTestObject.arg2 = 'string';
|
||||
constructorTestObject.arg\u0033 = true;
|
||||
constructorTestObject.arg4 = 2;
|
||||
// Lables
|
||||
l\u0061bel1: while (false) {
|
||||
while (false)
|
||||
continue label1;
|
||||
continue label1; // it will go to next iteration of outer loop
|
||||
}
|
||||
label2: while (false) {
|
||||
while (false)
|
||||
continue l\u0061bel2;
|
||||
continue l\u0061bel2; // it will go to next iteration of outer loop
|
||||
}
|
||||
label3: while (false) {
|
||||
while (false)
|
||||
continue label3;
|
||||
continue label3; // it will go to next iteration of outer loop
|
||||
}
|
||||
l\u0061bel4: while (false) {
|
||||
while (false)
|
||||
continue l\u0061bel4;
|
||||
continue l\u0061bel4; // it will go to next iteration of outer loop
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
Property 'a' is missing in type 'Boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
|
||||
|
@ -6,6 +7,7 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument o
|
|||
var x = new foo(true); // Should error
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
!!! error TS2345: Property 'a' is missing in type 'Boolean'.
|
||||
var y = new foo({a: "test", b: 42}); // Should be OK
|
||||
var z: number = y.test.b;
|
||||
==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ====
|
||||
|
|
|
@ -93,6 +93,7 @@ var M;
|
|||
}
|
||||
M.F2 = F2;
|
||||
})(M || (M = {}));
|
||||
// all of these are errors
|
||||
for (var a;;) {
|
||||
}
|
||||
for (var a = 1;;) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
Property 'a' is missing in type 'Number'.
|
||||
tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
||||
|
@ -14,6 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do
|
|||
foo(4);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
!!! error TS2345: Property 'a' is missing in type 'Number'.
|
||||
foo();
|
||||
~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
|
||||
Property 'apply' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'string[]' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '<U, V>(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
@ -11,6 +14,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
|||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'void' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
||||
|
||||
|
@ -22,6 +26,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
|||
foo(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
|
||||
!!! error TS2345: Property 'apply' is missing in type 'Number'.
|
||||
foo(() => { }, 1);
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
@ -49,6 +54,8 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
|||
var r2 = foo2((x: string[]) => x);
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'string[]' is not assignable to type 'string'.
|
||||
var r6 = foo2(C);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
@ -78,6 +85,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
|||
foo2(x);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'void' is not assignable to type 'string'.
|
||||
foo2(y);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(24,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(53,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(69,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(85,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<boolean>'.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ====
|
||||
|
@ -31,6 +39,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
|
|||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -62,6 +72,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
|
|||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -80,6 +92,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
|
|||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -98,5 +112,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
|
|||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<boolean>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'boolean'.
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
|
||||
Property 'toDateString' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (2 errors) ====
|
||||
|
@ -18,4 +19,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
|
|||
var r4 = foo<Date, Date>(1); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
|
||||
!!! error TS2345: Property 'toDateString' is missing in type 'Number'.
|
||||
var r5 = foo<Date, Date>(new Date()); // no error
|
|
@ -1,5 +1,9 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'.
|
||||
Types of property 'cb' are incompatible.
|
||||
Type 'new <T>(x: T, y: T) => string' is not assignable to type 'new (t: any) => string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'.
|
||||
Types of property 'cb' are incompatible.
|
||||
Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts (2 errors) ====
|
||||
|
@ -16,10 +20,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
|
|||
var r2 = foo(arg2); // error
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ cb: new <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'.
|
||||
!!! error TS2345: Types of property 'cb' are incompatible.
|
||||
!!! error TS2345: Type 'new <T>(x: T, y: T) => string' is not assignable to type 'new (t: any) => string'.
|
||||
var arg3: { cb: new (x: string, y: number) => string };
|
||||
var r3 = foo(arg3); // error
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'.
|
||||
!!! error TS2345: Types of property 'cb' are incompatible.
|
||||
!!! error TS2345: Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'.
|
||||
|
||||
function foo2<T, U>(arg: { cb: new(t: T, t2: T) => U }) {
|
||||
return new arg.cb(null, null);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
|
||||
Property 'y' is missing in type '{ x: number; z?: number; }'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
|
||||
Property 'z' is missing in type '{ x: number; y?: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts (2 errors) ====
|
||||
|
@ -26,10 +28,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
|
||||
!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'.
|
||||
var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b
|
||||
~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
|
||||
!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'.
|
||||
|
||||
function other<T>(x: T) {
|
||||
var r6 = foo((a: T) => a, (b: T) => b); // T => T
|
||||
|
|
|
@ -3,10 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
Types of parameters 'a' and 'x' are incompatible.
|
||||
Type 'T' is not assignable to type 'Date'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,36): error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'.
|
||||
Type 'F' is not assignable to type 'E'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
Types of parameters 'a' and 'x' are incompatible.
|
||||
Type 'T' is not assignable to type 'Date'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find name 'U'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'.
|
||||
|
||||
|
@ -46,6 +51,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
var r7 = foo2((a: T) => a, (b: T) => b); // error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
!!! error TS2345: Types of parameters 'a' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'T' is not assignable to type 'Date'.
|
||||
var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date
|
||||
}
|
||||
|
||||
|
@ -60,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'.
|
||||
!!! error TS2345: Type 'F' is not assignable to type 'E'.
|
||||
}
|
||||
|
||||
module TU {
|
||||
|
@ -89,6 +97,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
var r7 = foo2((a: T) => a, (b: T) => b);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
!!! error TS2345: Types of parameters 'a' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'T' is not assignable to type 'Date'.
|
||||
var r7b = foo2((a) => a, (b) => b);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
|
||||
|
@ -40,6 +41,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
|||
~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'.
|
||||
!!! error TS2453: Type 'boolean' is not assignable to type 'string'.
|
||||
var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error
|
||||
~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
|
||||
Property 'y' is missing in type '{ x: number; z?: number; }'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
|
||||
Property 'z' is missing in type '{ x: number; y?: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts (2 errors) ====
|
||||
|
@ -20,10 +22,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon
|
|||
~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
|
||||
!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'.
|
||||
var r2 = foo(b, a); // { x: number; z?: number; };
|
||||
~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
|
||||
!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'.
|
||||
|
||||
var x: { x: number; };
|
||||
var y: { x?: number; };
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'.
|
||||
Types have separate declarations of a private property 'x'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ====
|
||||
|
@ -26,4 +27,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
|
|||
~~~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'.
|
||||
!!! error TS2453: Types have separate declarations of a private property 'x'.
|
||||
var r2 = foo(c1, c1); // ok
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'.
|
||||
Property 'y' is missing in type 'Derived2'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
|
||||
|
||||
|
@ -25,6 +26,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
|
|||
~
|
||||
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'.
|
||||
!!! error TS2453: Property 'y' is missing in type 'Derived2'.
|
||||
|
||||
function f2<T extends Base, U extends { x: T; y: T }>(a: U) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -15,7 +15,8 @@ var s3 = s2.func(num => num.toString())
|
|||
|
||||
|
||||
//// [genericChainedCalls.js]
|
||||
var r1 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }).func(function (num) { return num.toString(); });
|
||||
var r1 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }) // error, number doesn't have a length
|
||||
.func(function (num) { return num.toString(); });
|
||||
var s1 = v1.func(function (num) { return num.toString(); });
|
||||
var s2 = s1.func(function (str) { return str.length; }); // should also error
|
||||
var s3 = s2.func(function (num) { return num.toString(); });
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
Type 'string' is not assignable to type 'Date'.
|
||||
tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
Type 'string' is not assignable to type 'Date'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericCombinators2.ts (2 errors) ====
|
||||
|
@ -20,6 +22,8 @@ tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of ty
|
|||
var r5a = _.map<number, string, Date>(c2, (x, y) => { return x.toFixed() });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
|
||||
var r5b = _.map<number, string, Date>(c2, rf1);
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
|
|
@ -2,6 +2,7 @@ tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a
|
|||
tests/cases/compiler/genericConstraint2.ts(11,7): error TS2420: Class 'ComparableString' incorrectly implements interface 'Comparable<string>'.
|
||||
Property 'comparer' is missing in type 'ComparableString'.
|
||||
tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable<any>'.
|
||||
Property 'comparer' is missing in type 'ComparableString'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericConstraint2.ts (3 errors) ====
|
||||
|
@ -33,3 +34,4 @@ tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'Comparabl
|
|||
var c = compare<ComparableString>(a, b);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable<any>'.
|
||||
!!! error TS2344: Property 'comparer' is missing in type 'ComparableString'.
|
|
@ -4,6 +4,7 @@ tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 's
|
|||
tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
|
||||
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericRestArgs.ts (4 errors) ====
|
||||
|
@ -29,3 +30,4 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '
|
|||
var a2Gc = makeArrayG<any[]>(1, ""); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
|
||||
!!! error TS2345: Property 'length' is missing in type 'Number'.
|
|
@ -18,22 +18,22 @@ function foo(x) {
|
|||
;
|
||||
function bar(x, y) {
|
||||
}
|
||||
;
|
||||
; // error at "y"; no error at "x"
|
||||
function func2(a, b, c) {
|
||||
}
|
||||
;
|
||||
; // error at "a,b,c"
|
||||
function func3() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
;
|
||||
; // error at "args"
|
||||
function func4(z, w) {
|
||||
if (z === void 0) { z = null; }
|
||||
if (w === void 0) { w = undefined; }
|
||||
}
|
||||
;
|
||||
; // error at "z,w"
|
||||
// these shouldn't be errors
|
||||
function noError1(x, y) {
|
||||
if (x === void 0) { x = 3; }
|
||||
|
|
|
@ -16,7 +16,7 @@ var x1: any; var y1 = new x1;
|
|||
var x; // error at "x"
|
||||
function func(k) {
|
||||
}
|
||||
;
|
||||
; //error at "k"
|
||||
func(x);
|
||||
// this shouldn't be an error
|
||||
var bar = 3;
|
||||
|
|
|
@ -15,6 +15,7 @@ class C {
|
|||
|
||||
|
||||
//// [implicitAnyInCatch.js]
|
||||
// this should not be an error
|
||||
try {
|
||||
}
|
||||
catch (error) {
|
||||
|
|
|
@ -15,6 +15,8 @@ tests/cases/compiler/incompatibleTypes.ts(33,7): error TS2420: Class 'C4' incorr
|
|||
Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
Property 'a' is missing in type '{ c: { b: string; }; d: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'.
|
||||
Types of property 'p1' are incompatible.
|
||||
Type '() => string' is not assignable to type '(s: string) => number'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
|
||||
Property 'c' is missing in type '{ e: number; f: number; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
|
@ -88,6 +90,8 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
|||
if1(c1);
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'.
|
||||
!!! error TS2345: Types of property 'p1' are incompatible.
|
||||
!!! error TS2345: Type '() => string' is not assignable to type '(s: string) => number'.
|
||||
|
||||
|
||||
function of1(n: { a: { a: string; }; b: string; }): number;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
|
||||
Index signature is missing in type 'NumberMap<Function>'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts (1 errors) ====
|
||||
|
@ -22,5 +23,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureType
|
|||
var v1 = stringMapToArray(numberMap); // Error expected here
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
|
||||
!!! error TS2345: Index signature is missing in type 'NumberMap<Function>'.
|
||||
var v1 = stringMapToArray(stringMap); // Ok
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
tests/cases/compiler/interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'.
|
||||
Types of parameters 'a' and 'a' are incompatible.
|
||||
Type 'IFrenchEye' is not assignable to type 'IEye'.
|
||||
tests/cases/compiler/interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'.
|
||||
tests/cases/compiler/interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'.
|
||||
Property 'coleur' is missing in type 'IEye'.
|
||||
tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'.
|
||||
Type 'IEye' is not assignable to type 'IFrenchEye'.
|
||||
|
||||
|
@ -40,6 +43,8 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy
|
|||
x=x.sort(CompareYeux); // parameter mismatch
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'.
|
||||
!!! error TS2345: Types of parameters 'a' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'IFrenchEye' is not assignable to type 'IEye'.
|
||||
// type of z inferred from specialized array type
|
||||
var z=x.sort(CompareEyes); // ok
|
||||
|
||||
|
@ -54,6 +59,7 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy
|
|||
eeks[j]=z[j]; // nope: element assignment
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'.
|
||||
!!! error TS2322: Property 'coleur' is missing in type 'IEye'.
|
||||
}
|
||||
eeks=z; // nope: array assignment
|
||||
~~~~
|
||||
|
|
|
@ -205,6 +205,7 @@ for (let l = 0; n = l; l++) {
|
|||
}
|
||||
for (let l in {}) {
|
||||
}
|
||||
// Try/catch/finally
|
||||
try {
|
||||
let l = 0;
|
||||
n = l;
|
||||
|
@ -217,12 +218,14 @@ finally {
|
|||
let l = 0;
|
||||
n = l;
|
||||
}
|
||||
// Switch
|
||||
switch (0) {
|
||||
case 0:
|
||||
let l = 0;
|
||||
n = l;
|
||||
break;
|
||||
}
|
||||
// blocks
|
||||
{
|
||||
let l = 0;
|
||||
n = l;
|
||||
|
|
|
@ -173,6 +173,7 @@ if (true) {
|
|||
while (false) {
|
||||
label2: label3: label4: let l9 = 0;
|
||||
}
|
||||
// Try/catch/finally
|
||||
try {
|
||||
let l10 = 0;
|
||||
}
|
||||
|
@ -182,6 +183,7 @@ catch (e) {
|
|||
finally {
|
||||
let l12 = 0;
|
||||
}
|
||||
// Switch
|
||||
switch (0) {
|
||||
case 0:
|
||||
let l13 = 0;
|
||||
|
@ -190,6 +192,7 @@ switch (0) {
|
|||
let l14 = 0;
|
||||
break;
|
||||
}
|
||||
// blocks
|
||||
{
|
||||
let l15 = 0;
|
||||
{
|
||||
|
@ -247,6 +250,7 @@ var o = {
|
|||
let l29 = 0;
|
||||
}
|
||||
};
|
||||
// labels
|
||||
label: let l30 = 0;
|
||||
{
|
||||
label2: let l31 = 0;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
tests/cases/compiler/maxConstraints.ts(5,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
|
||||
Property 'compareTo' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/maxConstraints.ts (2 errors) ====
|
||||
|
@ -15,3 +16,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu
|
|||
var maxResult = max2(1, 2);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
|
||||
!!! error TS2345: Property 'compareTo' is missing in type 'Number'.
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts(7,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'.
|
||||
Property 'a' is missing in type '{ name: string; id: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts (1 errors) ====
|
||||
|
@ -11,4 +12,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
|||
foo(person); // error
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'.
|
||||
!!! error TS2345: Property 'a' is missing in type '{ name: string; id: number; }'.
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(2,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts (2 errors) ====
|
||||
|
@ -15,3 +17,5 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): er
|
|||
foo([false, 0, ""]);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
!!! error TS2345: Types of property '0' are incompatible.
|
||||
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
|
|
@ -1,4 +1,6 @@
|
|||
tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(9,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts (1 errors) ====
|
||||
|
@ -13,3 +15,5 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.
|
|||
foo([false, 0, ""]);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
!!! error TS2345: Types of property '0' are incompatible.
|
||||
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.
|
|
@ -16,5 +16,7 @@ var r2: I1<number> = v1.func(num => num.toString()) // Correctly returns an I1<s
|
|||
|
||||
//// [overEagerReturnTypeSpecialization.js]
|
||||
//Note: Below simpler repro
|
||||
var r1 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }); // should error
|
||||
var r2 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }); // should be ok
|
||||
var r1 = v1.func(function (num) { return num.toString(); }) // Correctly returns an I1<string>
|
||||
.func(function (str) { return str.length; }); // should error
|
||||
var r2 = v1.func(function (num) { return num.toString(); }) // Correctly returns an I1<string>
|
||||
.func(function (str) { return str.length; }); // should be ok
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/overloadResolutionOverCTLambda.ts(2,5): error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadResolutionOverCTLambda.ts (1 errors) ====
|
||||
|
@ -6,3 +7,4 @@ tests/cases/compiler/overloadResolutionOverCTLambda.ts(2,5): error TS2345: Argum
|
|||
foo(a => a); // can not convert (number)=>bool to (number)=>number
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'boolean'.
|
|
@ -1,8 +1,11 @@
|
|||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'.
|
||||
Property 'x' is missing in type 'D'.
|
||||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'.
|
||||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'D' is not assignable to type 'B'.
|
||||
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): error TS2344: Type 'D' does not satisfy the constraint 'A'.
|
||||
|
||||
|
||||
|
@ -25,6 +28,7 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12):
|
|||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'.
|
||||
!!! error TS2345: Property 'x' is missing in type 'D'.
|
||||
|
||||
var result2: number = foo(x => new G<typeof x>(x)); // x has type D, new G(x) fails, so first overload is picked.
|
||||
~~~~~~~
|
||||
|
@ -43,4 +47,6 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12):
|
|||
});
|
||||
~
|
||||
!!! error TS2345: Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'D' is not assignable to type 'B'.
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,6): error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
Type '{}' is not assignable to type '{ a: number; b: number; }'.
|
||||
tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'.
|
||||
tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'.
|
||||
tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'.
|
||||
|
||||
|
||||
|
@ -13,11 +15,13 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cann
|
|||
func(s => ({})); // Error for no applicable overload (object type is missing a and b)
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
!!! error TS2345: Type '{}' is not assignable to type '{ a: number; b: number; }'.
|
||||
func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error)
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'blah'.
|
||||
func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
!!! error TS2345: Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'blah'.
|
|
@ -1,5 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(7,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type '(x: string) => string' is not assignable to type 'string'.
|
||||
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type '(x: string) => string' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts (2 errors) ====
|
||||
|
@ -12,7 +14,9 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5):
|
|||
foo(() => g);
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'.
|
||||
foo(x);
|
||||
~
|
||||
!!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'.
|
||||
|
|
@ -19,6 +19,13 @@ do {
|
|||
//// [parserSbp_7.9_A9_T3.js]
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/**
|
||||
* Check Do-While Statement for automatic semicolon insertion
|
||||
*
|
||||
* @path bestPractice/Sbp_7.9_A9_T3.js
|
||||
* @description Execute do { \n ; \n }while(false) true
|
||||
*/
|
||||
//CHECK#1
|
||||
do {
|
||||
;
|
||||
} while (false);
|
||||
|
|
|
@ -19,7 +19,7 @@ var Chain = (function () {
|
|||
Chain.prototype.then = function (cb) {
|
||||
var result = cb(this.value);
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(function (x) { return result; }).then(function (x) { return "abc"; }).then(function (x) { return x.length; }); // No error
|
||||
var z = this.then(function (x) { return result; }) /*S*/.then(function (x) { return "abc"; }) /*string*/.then(function (x) { return x.length; }); // No error
|
||||
return new Chain(result);
|
||||
};
|
||||
return Chain;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type 'string' is not assignable to type 'Function'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseChaining1.ts (1 errors) ====
|
||||
|
@ -11,6 +12,7 @@ tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '
|
|||
var z = this.then(x => result)/*S*/.then(x => "abc")/*Function*/.then(x => x.length)/*number*/; // Should error on "abc" because it is not a Function
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ var Chain2 = (function () {
|
|||
Chain2.prototype.then = function (cb) {
|
||||
var result = cb(this.value);
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(function (x) { return result; }).then(function (x) { return "abc"; }).then(function (x) { return x.length; }); // Should error on "abc" because it is not a Function
|
||||
var z = this.then(function (x) { return result; }) /*S*/.then(function (x) { return "abc"; }) /*Function*/.then(function (x) { return x.length; }); // Should error on "abc" because it is not a Function
|
||||
return new Chain2(result);
|
||||
};
|
||||
return Chain2;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type 'string' is not assignable to type 'Function'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseChaining2.ts (1 errors) ====
|
||||
|
@ -11,6 +12,7 @@ tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '
|
|||
var z = this.then(x => result).then(x => "abc").then(x => x.length);
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,18 @@
|
|||
tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(84,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(88,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
|
@ -12,9 +22,17 @@ tests/cases/compiler/promisePermutations.ts(100,19): error TS2345: Argument of t
|
|||
tests/cases/compiler/promisePermutations.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
tests/cases/compiler/promisePermutations.ts(102,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
|
@ -34,10 +52,19 @@ tests/cases/compiler/promisePermutations.ts(144,12): error TS2453: The type argu
|
|||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/promisePermutations.ts(152,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
Types of property 'then' are incompatible.
|
||||
Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
|
||||
tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(158,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promisePermutations.ts (33 errors) ====
|
||||
|
@ -117,6 +144,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
|
|||
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
|
||||
var r4: IPromise<string>;
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
|
@ -124,17 +153,25 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
|
|||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
|
@ -175,17 +212,25 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
|
|||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
|
@ -258,22 +303,31 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
|
|||
~~~~~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
!!! error TS2453: Types of property 'then' are incompatible.
|
||||
!!! error TS2453: Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
|
||||
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r11: IPromise<number>;
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
|
||||
var r12 = testFunction12(x => x);
|
||||
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
|
@ -12,9 +22,17 @@ tests/cases/compiler/promisePermutations2.ts(99,19): error TS2345: Argument of t
|
|||
tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(108,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
|
@ -34,10 +52,19 @@ tests/cases/compiler/promisePermutations2.ts(143,12): error TS2453: The type arg
|
|||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/promisePermutations2.ts(151,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
Types of property 'then' are incompatible.
|
||||
Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '<U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise<U>'.
|
||||
tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promisePermutations2.ts (33 errors) ====
|
||||
|
@ -116,6 +143,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
|
|||
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // Should error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
|
||||
var r4: IPromise<string>;
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
|
@ -123,17 +152,25 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
|
|||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
|
@ -174,17 +211,25 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
|
|||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
|
@ -257,22 +302,31 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
|
|||
~~~~~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
!!! error TS2453: Types of property 'then' are incompatible.
|
||||
!!! error TS2453: Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '<U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise<U>'.
|
||||
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r11: IPromise<number>;
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
|
||||
var r12 = testFunction12(x => x);
|
||||
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
tests/cases/compiler/promisePermutations3.ts(68,69): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'x' and 'value' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
|
@ -13,9 +25,17 @@ tests/cases/compiler/promisePermutations3.ts(99,19): error TS2345: Argument of t
|
|||
tests/cases/compiler/promisePermutations3.ts(100,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(108,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
Types of parameters 'cb' and 'value' are incompatible.
|
||||
Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
|
@ -35,11 +55,21 @@ tests/cases/compiler/promisePermutations3.ts(143,12): error TS2453: The type arg
|
|||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/promisePermutations3.ts(151,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
Types of property 'then' are incompatible.
|
||||
Type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
|
||||
tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<any>'.
|
||||
Type 'IPromise<any>' is not assignable to type 'Promise<any>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promisePermutations3.ts (35 errors) ====
|
||||
|
@ -113,6 +143,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
var r3b = r3.then(testFunction3, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
var s3: Promise<number>;
|
||||
var s3a = s3.then(testFunction3, testFunction3, testFunction3);
|
||||
var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P);
|
||||
|
@ -120,6 +152,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
|
||||
|
||||
var r4: IPromise<string>;
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
|
@ -127,17 +161,25 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
|
@ -178,17 +220,25 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
|
||||
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
|
@ -261,22 +311,31 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
~~~~~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
|
||||
!!! error TS2453: Types of property 'then' are incompatible.
|
||||
!!! error TS2453: Type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
|
||||
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r11: IPromise<number>;
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
|
||||
|
||||
var r12 = testFunction12(x => x);
|
||||
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok
|
||||
|
@ -285,4 +344,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
|
|||
var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<any>'.
|
||||
!!! error TS2345: Type 'IPromise<any>' is not assignable to type 'Promise<any>'.
|
||||
var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok
|
|
@ -2,6 +2,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot
|
|||
tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2304: Cannot find name 'domNode'.
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2304: Cannot find name 'mode'.
|
||||
tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
|
||||
Property 'getInitialState' is missing in type 'Window'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/recursiveClassReferenceTest.ts (4 errors) ====
|
||||
|
@ -108,6 +109,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume
|
|||
return new State(self);
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
|
||||
!!! error TS2345: Property 'getInitialState' is missing in type 'Window'.
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ var f = (x: string) => f(x);
|
|||
// number unless otherwise specified
|
||||
var n1 = n1++;
|
||||
var n2 = n2 + n2;
|
||||
var n3 = n3 + n3;
|
||||
var n3 /* any */ = n3 + n3;
|
||||
// string unless otherwise specified
|
||||
var s1 = s1 + '';
|
||||
var s2 = s2 + s2;
|
||||
var s2 /* any */ = s2 + s2;
|
||||
var s3 = s3 + s3;
|
||||
var s4 = '' + s4;
|
||||
// boolean unless otherwise specified
|
||||
|
|
|
@ -19,9 +19,9 @@ catch (ex1) {
|
|||
try {
|
||||
}
|
||||
catch (ex1) {
|
||||
}
|
||||
} // should not error
|
||||
try {
|
||||
}
|
||||
catch (ex1) {
|
||||
}
|
||||
} // should not error
|
||||
var x = ex1; // should error
|
||||
|
|
|
@ -57,9 +57,9 @@ var Foo;
|
|||
var greeter = new Greeter("Hello, world!");
|
||||
var str = greeter.greet();
|
||||
function foo2(greeting) {
|
||||
var restGreetings = [];
|
||||
var restGreetings /* more greeting */ = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
restGreetings[_i - 1] = arguments[_i];
|
||||
restGreetings /* more greeting */[_i - 1] = arguments[_i];
|
||||
}
|
||||
var greeters = []; /* inline block comment */
|
||||
greeters[0] = new Greeter(greeting);
|
||||
|
@ -69,6 +69,7 @@ var Foo;
|
|||
return greeters;
|
||||
}
|
||||
var b = foo2("Hello", "World", "!");
|
||||
// This is simple signle line comment
|
||||
for (var j = 0; j < b.length; j++) {
|
||||
b[j].greet();
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
//// [sourceMapValidationClasses.js.map]
|
||||
{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":["Foo","Foo.Bar","Foo.Bar.Greeter","Foo.Bar.Greeter.constructor","Foo.Bar.Greeter.greet","Foo.Bar.foo","Foo.Bar.foo2"],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAACA,IAAAA,GAAGA,CAmCbA;IAnCUA,WAAAA,GAAGA,EAACA,CAACA;QACZC,YAAYA,CAACA;QAEbA,IAAMA,OAAOA;YACTC,SADEA,OAAOA,CACUA,QAAgBA;gBAAhBC,aAAQA,GAARA,QAAQA,CAAQA;YACnCA,CAACA;YAEDD,uBAAKA,GAALA;gBACIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;YAC5CA,CAACA;YACLF,cAACA;QAADA,CAACA,AAPDD,IAOCA;QAGDA,SAASA,GAAGA,CAACA,QAAgBA;YACzBI,MAAMA,CAACA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;QACjCA,CAACA;QAEDJ,IAAIA,OAAOA,GAAGA,IAAIA,OAAOA,CAACA,eAAeA,CAACA,CAACA;QAC3CA,IAAIA,GAAGA,GAAGA,OAAOA,CAACA,KAAKA,EAAEA,CAACA;QAE1BA,SAASA,IAAIA,CAACA,QAAgBA;YAAEK,uBAA8CA;iBAA9CA,WAA8CA,CAA9CA,sBAA8CA,CAA9CA,IAA8CA;gBAA9CA,sCAA8CA;;YAC1EA,IAAIA,QAAQA,GAAcA,EAAEA,EAAEA,0BAA0BA,AAA3BA;YAC7BA,QAAQA,CAACA,CAACA,CAACA,GAAGA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;YACpCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,aAAaA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;gBAC5CA,QAAQA,CAACA,IAAIA,CAACA,IAAIA,OAAOA,CAACA,aAAaA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACjDA,CAACA;YAEDA,MAAMA,CAACA,QAAQA,CAACA;QACpBA,CAACA;QAEDL,IAAIA,CAACA,GAAGA,IAAIA,CAACA,OAAOA,EAAEA,OAAOA,EAAEA,GAAGA,CAACA,CAACA;QAEpCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,CAACA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;YAChCA,CAACA,CAACA,CAACA,CAACA,CAACA,KAAKA,EAAEA,CAACA;QACjBA,CAACA;IACLA,CAACA,EAnCUD,GAAGA,GAAHA,OAAGA,KAAHA,OAAGA,QAmCbA;AAADA,CAACA,EAnCM,GAAG,KAAH,GAAG,QAmCT"}
|
||||
{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":["Foo","Foo.Bar","Foo.Bar.Greeter","Foo.Bar.Greeter.constructor","Foo.Bar.Greeter.greet","Foo.Bar.foo","Foo.Bar.foo2"],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAACA,IAAAA,GAAGA,CAmCbA;IAnCUA,WAAAA,GAAGA,EAACA,CAACA;QACZC,YAAYA,CAACA;QAEbA,IAAMA,OAAOA;YACTC,SADEA,OAAOA,CACUA,QAAgBA;gBAAhBC,aAAQA,GAARA,QAAQA,CAAQA;YACnCA,CAACA;YAEDD,uBAAKA,GAALA;gBACIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;YAC5CA,CAACA;YACLF,cAACA;QAADA,CAACA,AAPDD,IAOCA;QAGDA,SAASA,GAAGA,CAACA,QAAgBA;YACzBI,MAAMA,CAACA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;QACjCA,CAACA;QAEDJ,IAAIA,OAAOA,GAAGA,IAAIA,OAAOA,CAACA,eAAeA,CAACA,CAACA;QAC3CA,IAAIA,GAAGA,GAAGA,OAAOA,CAACA,KAAKA,EAAEA,CAACA;QAE1BA,SAASA,IAAIA,CAACA,QAAgBA;YAAEK,kBAAiBA,mBAAmBA,MAAUA;iBAA9CA,WAA8CA,CAA9CA,sBAA8CA,CAA9CA,IAA8CA;gBAA9CA,cAAiBA,mBAAmBA,yBAAUA;;YAC1EA,IAAIA,QAAQA,GAAcA,EAAEA,EAAEA,0BAA0BA,AAA3BA;YAC7BA,QAAQA,CAACA,CAACA,CAACA,GAAGA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;YACpCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,aAAaA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;gBAC5CA,QAAQA,CAACA,IAAIA,CAACA,IAAIA,OAAOA,CAACA,aAAaA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACjDA,CAACA;YAEDA,MAAMA,CAACA,QAAQA,CAACA;QACpBA,CAACA;QAEDL,IAAIA,CAACA,GAAGA,IAAIA,CAACA,OAAOA,EAAEA,OAAOA,EAAEA,GAAGA,CAACA,CAACA;QAEpCA,AADAA,qCAAqCA;QACrCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,CAACA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;YAChCA,CAACA,CAACA,CAACA,CAACA,CAACA,KAAKA,EAAEA,CAACA;QACjBA,CAACA;IACLA,CAACA,EAnCUD,GAAGA,GAAHA,OAAGA,KAAHA,OAAGA,QAmCbA;AAADA,CAACA,EAnCM,GAAG,KAAH,GAAG,QAmCT"}
|
|
@ -433,7 +433,7 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
3 > ^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^
|
||||
6 > ^^^^^^->
|
||||
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
|
@ -447,14 +447,20 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
4 >Emitted(20, 23) Source(21, 19) + SourceIndex(0) name (Foo.Bar)
|
||||
5 >Emitted(20, 31) Source(21, 35) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> var restGreetings = [];
|
||||
>>> var restGreetings /* more greeting */ = [];
|
||||
1->^^^^^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
2 > ^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^
|
||||
5 > ^^^^^->
|
||||
1->,
|
||||
2 > ...restGreetings /* more greeting */: string[]
|
||||
2 > ...restGreetings
|
||||
3 > /* more greeting */
|
||||
4 > : string[]
|
||||
1->Emitted(21, 13) Source(21, 37) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
2 >Emitted(21, 36) Source(21, 83) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
2 >Emitted(21, 31) Source(21, 54) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
3 >Emitted(21, 50) Source(21, 73) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
4 >Emitted(21, 56) Source(21, 83) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
---
|
||||
>>> for (var _i = 1; _i < arguments.length; _i++) {
|
||||
1->^^^^^^^^^^^^^^^^^
|
||||
|
@ -463,6 +469,7 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
4 > ^^^^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^
|
||||
6 > ^^^^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
2 > ...restGreetings /* more greeting */: string[]
|
||||
3 >
|
||||
|
@ -476,13 +483,19 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
5 >Emitted(22, 53) Source(21, 37) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
6 >Emitted(22, 57) Source(21, 83) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
---
|
||||
>>> restGreetings[_i - 1] = arguments[_i];
|
||||
1 >^^^^^^^^^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
2 > ...restGreetings /* more greeting */: string[]
|
||||
1 >Emitted(23, 17) Source(21, 37) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
2 >Emitted(23, 55) Source(21, 83) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
>>> restGreetings /* more greeting */[_i - 1] = arguments[_i];
|
||||
1->^^^^^^^^^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
2 > ...restGreetings
|
||||
3 > /* more greeting */
|
||||
4 > : string[]
|
||||
1->Emitted(23, 17) Source(21, 37) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
2 >Emitted(23, 31) Source(21, 54) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
3 >Emitted(23, 50) Source(21, 73) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
4 >Emitted(23, 75) Source(21, 83) + SourceIndex(0) name (Foo.Bar.foo2)
|
||||
---
|
||||
>>> }
|
||||
>>> var greeters = []; /* inline block comment */
|
||||
|
@ -717,7 +730,7 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
11> ^^^
|
||||
12> ^
|
||||
13> ^
|
||||
14> ^->
|
||||
14> ^^->
|
||||
1->
|
||||
>
|
||||
>
|
||||
|
@ -747,8 +760,21 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
12>Emitted(32, 44) Source(31, 40) + SourceIndex(0) name (Foo.Bar)
|
||||
13>Emitted(32, 45) Source(31, 41) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> for (var j = 0; j < b.length; j++) {
|
||||
>>> // This is simple signle line comment
|
||||
1->^^^^^^^^
|
||||
2 >
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
> // This is simple signle line comment
|
||||
>
|
||||
2 >
|
||||
3 > // This is simple signle line comment
|
||||
1->Emitted(33, 9) Source(33, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(33, 9) Source(32, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(33, 46) Source(32, 42) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> for (var j = 0; j < b.length; j++) {
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
|
@ -768,8 +794,7 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
18> ^^
|
||||
19> ^^
|
||||
20> ^
|
||||
1->
|
||||
> // This is simple signle line comment
|
||||
1 >
|
||||
>
|
||||
2 > for
|
||||
3 >
|
||||
|
@ -790,26 +815,26 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
18> ++
|
||||
19> )
|
||||
20> {
|
||||
1->Emitted(33, 9) Source(33, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(33, 12) Source(33, 8) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(33, 13) Source(33, 9) + SourceIndex(0) name (Foo.Bar)
|
||||
4 >Emitted(33, 14) Source(33, 10) + SourceIndex(0) name (Foo.Bar)
|
||||
5 >Emitted(33, 17) Source(33, 13) + SourceIndex(0) name (Foo.Bar)
|
||||
6 >Emitted(33, 18) Source(33, 14) + SourceIndex(0) name (Foo.Bar)
|
||||
7 >Emitted(33, 19) Source(33, 15) + SourceIndex(0) name (Foo.Bar)
|
||||
8 >Emitted(33, 22) Source(33, 18) + SourceIndex(0) name (Foo.Bar)
|
||||
9 >Emitted(33, 23) Source(33, 19) + SourceIndex(0) name (Foo.Bar)
|
||||
10>Emitted(33, 25) Source(33, 21) + SourceIndex(0) name (Foo.Bar)
|
||||
11>Emitted(33, 26) Source(33, 22) + SourceIndex(0) name (Foo.Bar)
|
||||
12>Emitted(33, 29) Source(33, 25) + SourceIndex(0) name (Foo.Bar)
|
||||
13>Emitted(33, 30) Source(33, 26) + SourceIndex(0) name (Foo.Bar)
|
||||
14>Emitted(33, 31) Source(33, 27) + SourceIndex(0) name (Foo.Bar)
|
||||
15>Emitted(33, 37) Source(33, 33) + SourceIndex(0) name (Foo.Bar)
|
||||
16>Emitted(33, 39) Source(33, 35) + SourceIndex(0) name (Foo.Bar)
|
||||
17>Emitted(33, 40) Source(33, 36) + SourceIndex(0) name (Foo.Bar)
|
||||
18>Emitted(33, 42) Source(33, 38) + SourceIndex(0) name (Foo.Bar)
|
||||
19>Emitted(33, 44) Source(33, 40) + SourceIndex(0) name (Foo.Bar)
|
||||
20>Emitted(33, 45) Source(33, 41) + SourceIndex(0) name (Foo.Bar)
|
||||
1 >Emitted(34, 9) Source(33, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(34, 12) Source(33, 8) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(34, 13) Source(33, 9) + SourceIndex(0) name (Foo.Bar)
|
||||
4 >Emitted(34, 14) Source(33, 10) + SourceIndex(0) name (Foo.Bar)
|
||||
5 >Emitted(34, 17) Source(33, 13) + SourceIndex(0) name (Foo.Bar)
|
||||
6 >Emitted(34, 18) Source(33, 14) + SourceIndex(0) name (Foo.Bar)
|
||||
7 >Emitted(34, 19) Source(33, 15) + SourceIndex(0) name (Foo.Bar)
|
||||
8 >Emitted(34, 22) Source(33, 18) + SourceIndex(0) name (Foo.Bar)
|
||||
9 >Emitted(34, 23) Source(33, 19) + SourceIndex(0) name (Foo.Bar)
|
||||
10>Emitted(34, 25) Source(33, 21) + SourceIndex(0) name (Foo.Bar)
|
||||
11>Emitted(34, 26) Source(33, 22) + SourceIndex(0) name (Foo.Bar)
|
||||
12>Emitted(34, 29) Source(33, 25) + SourceIndex(0) name (Foo.Bar)
|
||||
13>Emitted(34, 30) Source(33, 26) + SourceIndex(0) name (Foo.Bar)
|
||||
14>Emitted(34, 31) Source(33, 27) + SourceIndex(0) name (Foo.Bar)
|
||||
15>Emitted(34, 37) Source(33, 33) + SourceIndex(0) name (Foo.Bar)
|
||||
16>Emitted(34, 39) Source(33, 35) + SourceIndex(0) name (Foo.Bar)
|
||||
17>Emitted(34, 40) Source(33, 36) + SourceIndex(0) name (Foo.Bar)
|
||||
18>Emitted(34, 42) Source(33, 38) + SourceIndex(0) name (Foo.Bar)
|
||||
19>Emitted(34, 44) Source(33, 40) + SourceIndex(0) name (Foo.Bar)
|
||||
20>Emitted(34, 45) Source(33, 41) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> b[j].greet();
|
||||
1 >^^^^^^^^^^^^
|
||||
|
@ -831,15 +856,15 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
7 > greet
|
||||
8 > ()
|
||||
9 > ;
|
||||
1 >Emitted(34, 13) Source(34, 9) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(34, 14) Source(34, 10) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(34, 15) Source(34, 11) + SourceIndex(0) name (Foo.Bar)
|
||||
4 >Emitted(34, 16) Source(34, 12) + SourceIndex(0) name (Foo.Bar)
|
||||
5 >Emitted(34, 17) Source(34, 13) + SourceIndex(0) name (Foo.Bar)
|
||||
6 >Emitted(34, 18) Source(34, 14) + SourceIndex(0) name (Foo.Bar)
|
||||
7 >Emitted(34, 23) Source(34, 19) + SourceIndex(0) name (Foo.Bar)
|
||||
8 >Emitted(34, 25) Source(34, 21) + SourceIndex(0) name (Foo.Bar)
|
||||
9 >Emitted(34, 26) Source(34, 22) + SourceIndex(0) name (Foo.Bar)
|
||||
1 >Emitted(35, 13) Source(34, 9) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(35, 14) Source(34, 10) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(35, 15) Source(34, 11) + SourceIndex(0) name (Foo.Bar)
|
||||
4 >Emitted(35, 16) Source(34, 12) + SourceIndex(0) name (Foo.Bar)
|
||||
5 >Emitted(35, 17) Source(34, 13) + SourceIndex(0) name (Foo.Bar)
|
||||
6 >Emitted(35, 18) Source(34, 14) + SourceIndex(0) name (Foo.Bar)
|
||||
7 >Emitted(35, 23) Source(34, 19) + SourceIndex(0) name (Foo.Bar)
|
||||
8 >Emitted(35, 25) Source(34, 21) + SourceIndex(0) name (Foo.Bar)
|
||||
9 >Emitted(35, 26) Source(34, 22) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^^^^^
|
||||
|
@ -848,8 +873,8 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(35, 9) Source(35, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(35, 10) Source(35, 6) + SourceIndex(0) name (Foo.Bar)
|
||||
1 >Emitted(36, 9) Source(35, 5) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(36, 10) Source(35, 6) + SourceIndex(0) name (Foo.Bar)
|
||||
---
|
||||
>>> })(Bar = Foo.Bar || (Foo.Bar = {}));
|
||||
1->^^^^
|
||||
|
@ -906,15 +931,15 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
> b[j].greet();
|
||||
> }
|
||||
> }
|
||||
1->Emitted(36, 5) Source(36, 1) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(36, 6) Source(36, 2) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(36, 8) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
4 >Emitted(36, 11) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
5 >Emitted(36, 14) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
6 >Emitted(36, 21) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
7 >Emitted(36, 26) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
8 >Emitted(36, 33) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
9 >Emitted(36, 41) Source(36, 2) + SourceIndex(0) name (Foo)
|
||||
1->Emitted(37, 5) Source(36, 1) + SourceIndex(0) name (Foo.Bar)
|
||||
2 >Emitted(37, 6) Source(36, 2) + SourceIndex(0) name (Foo.Bar)
|
||||
3 >Emitted(37, 8) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
4 >Emitted(37, 11) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
5 >Emitted(37, 14) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
6 >Emitted(37, 21) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
7 >Emitted(37, 26) Source(1, 12) + SourceIndex(0) name (Foo)
|
||||
8 >Emitted(37, 33) Source(1, 15) + SourceIndex(0) name (Foo)
|
||||
9 >Emitted(37, 41) Source(36, 2) + SourceIndex(0) name (Foo)
|
||||
---
|
||||
>>>})(Foo || (Foo = {}));
|
||||
1 >
|
||||
|
@ -967,12 +992,12 @@ sourceFile:sourceMapValidationClasses.ts
|
|||
> b[j].greet();
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(37, 1) Source(36, 1) + SourceIndex(0) name (Foo)
|
||||
2 >Emitted(37, 2) Source(36, 2) + SourceIndex(0) name (Foo)
|
||||
3 >Emitted(37, 4) Source(1, 8) + SourceIndex(0)
|
||||
4 >Emitted(37, 7) Source(1, 11) + SourceIndex(0)
|
||||
5 >Emitted(37, 12) Source(1, 8) + SourceIndex(0)
|
||||
6 >Emitted(37, 15) Source(1, 11) + SourceIndex(0)
|
||||
7 >Emitted(37, 23) Source(36, 2) + SourceIndex(0)
|
||||
1 >Emitted(38, 1) Source(36, 1) + SourceIndex(0) name (Foo)
|
||||
2 >Emitted(38, 2) Source(36, 2) + SourceIndex(0) name (Foo)
|
||||
3 >Emitted(38, 4) Source(1, 8) + SourceIndex(0)
|
||||
4 >Emitted(38, 7) Source(1, 11) + SourceIndex(0)
|
||||
5 >Emitted(38, 12) Source(1, 8) + SourceIndex(0)
|
||||
6 >Emitted(38, 15) Source(1, 11) + SourceIndex(0)
|
||||
7 >Emitted(38, 23) Source(36, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapValidationClasses.js.map
|
|
@ -1,2 +1,2 @@
|
|||
//// [sourceMapValidationEnums.js.map]
|
||||
{"version":3,"file":"sourceMapValidationEnums.js","sourceRoot":"","sources":["sourceMapValidationEnums.ts"],"names":["e","e2","e3"],"mappings":"AAAA,IAAK,CAIJ;AAJD,WAAK,CAAC;IACFA,mBAACA;IACDA,mBAACA;IACDA,mBAACA;AACLA,CAACA,EAJI,CAAC,KAAD,CAAC,QAIL;AACD,IAAK,EAKJ;AALD,WAAK,EAAE;IACHC,aAAIA,EAAEA,OAAAA;IACNA,aAAIA,EAAEA,OAAAA;IACNA,sBAACA;IACDA,wBAAEA;AACNA,CAACA,EALI,EAAE,KAAF,EAAE,QAKN;AACD,IAAK,EACJ;AADD,WAAK,EAAE;AACPC,CAACA,EADI,EAAE,KAAF,EAAE,QACN"}
|
||||
{"version":3,"file":"sourceMapValidationEnums.js","sourceRoot":"","sources":["sourceMapValidationEnums.ts"],"names":["e","e2","e3"],"mappings":"AAAA,IAAK,CAIJ;AAJD,WAAK,CAAC;IACFA,mBAACA,CAAAA;IACDA,mBAACA,CAAAA;IACDA,mBAACA,CAAAA;AACLA,CAACA,EAJI,CAAC,KAAD,CAAC,QAIL;AACD,IAAK,EAKJ;AALD,WAAK,EAAE;IACHC,aAAIA,EAAEA,OAAAA,CAAAA;IACNA,aAAIA,EAAEA,OAAAA,CAAAA;IACNA,sBAACA,CAAAA;IACDA,wBAAEA,CAAAA;AACNA,CAACA,EALI,EAAE,KAAF,EAAE,QAKN;AACD,IAAK,EACJ;AADD,WAAK,EAAE;AACPC,CAACA,EADI,EAAE,KAAF,EAAE,QACN"}
|
|
@ -39,31 +39,40 @@ sourceFile:sourceMapValidationEnums.ts
|
|||
>>> e[e["x"] = 0] = "x";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^->
|
||||
3 > ^
|
||||
4 > ^->
|
||||
1-> {
|
||||
>
|
||||
2 > x
|
||||
3 >
|
||||
1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) name (e)
|
||||
2 >Emitted(3, 24) Source(2, 6) + SourceIndex(0) name (e)
|
||||
3 >Emitted(3, 25) Source(2, 6) + SourceIndex(0) name (e)
|
||||
---
|
||||
>>> e[e["y"] = 1] = "y";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^->
|
||||
3 > ^
|
||||
4 > ^->
|
||||
1->,
|
||||
>
|
||||
2 > y
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(3, 5) + SourceIndex(0) name (e)
|
||||
2 >Emitted(4, 24) Source(3, 6) + SourceIndex(0) name (e)
|
||||
3 >Emitted(4, 25) Source(3, 6) + SourceIndex(0) name (e)
|
||||
---
|
||||
>>> e[e["x"] = 2] = "x";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
1->,
|
||||
>
|
||||
2 > x
|
||||
3 >
|
||||
1->Emitted(5, 5) Source(4, 5) + SourceIndex(0) name (e)
|
||||
2 >Emitted(5, 24) Source(4, 6) + SourceIndex(0) name (e)
|
||||
3 >Emitted(5, 25) Source(4, 6) + SourceIndex(0) name (e)
|
||||
---
|
||||
>>>})(e || (e = {}));
|
||||
1 >
|
||||
|
@ -128,51 +137,63 @@ sourceFile:sourceMapValidationEnums.ts
|
|||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^
|
||||
4 > ^^^^^^^
|
||||
5 > ^^->
|
||||
5 > ^
|
||||
6 > ^->
|
||||
1-> {
|
||||
>
|
||||
2 > x =
|
||||
3 > 10
|
||||
4 >
|
||||
5 >
|
||||
1->Emitted(9, 5) Source(7, 5) + SourceIndex(0) name (e2)
|
||||
2 >Emitted(9, 18) Source(7, 9) + SourceIndex(0) name (e2)
|
||||
3 >Emitted(9, 20) Source(7, 11) + SourceIndex(0) name (e2)
|
||||
4 >Emitted(9, 27) Source(7, 11) + SourceIndex(0) name (e2)
|
||||
5 >Emitted(9, 28) Source(7, 11) + SourceIndex(0) name (e2)
|
||||
---
|
||||
>>> e2[e2["y"] = 10] = "y";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^
|
||||
4 > ^^^^^^^
|
||||
5 > ^^->
|
||||
5 > ^
|
||||
6 > ^->
|
||||
1->,
|
||||
>
|
||||
2 > y =
|
||||
3 > 10
|
||||
4 >
|
||||
5 >
|
||||
1->Emitted(10, 5) Source(8, 5) + SourceIndex(0) name (e2)
|
||||
2 >Emitted(10, 18) Source(8, 9) + SourceIndex(0) name (e2)
|
||||
3 >Emitted(10, 20) Source(8, 11) + SourceIndex(0) name (e2)
|
||||
4 >Emitted(10, 27) Source(8, 11) + SourceIndex(0) name (e2)
|
||||
5 >Emitted(10, 28) Source(8, 11) + SourceIndex(0) name (e2)
|
||||
---
|
||||
>>> e2[e2["z"] = 11] = "z";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^^^^->
|
||||
3 > ^
|
||||
4 > ^^^->
|
||||
1->,
|
||||
>
|
||||
2 > z
|
||||
3 >
|
||||
1->Emitted(11, 5) Source(9, 5) + SourceIndex(0) name (e2)
|
||||
2 >Emitted(11, 27) Source(9, 6) + SourceIndex(0) name (e2)
|
||||
3 >Emitted(11, 28) Source(9, 6) + SourceIndex(0) name (e2)
|
||||
---
|
||||
>>> e2[e2["x2"] = 12] = "x2";
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
1->,
|
||||
>
|
||||
2 > x2
|
||||
3 >
|
||||
1->Emitted(12, 5) Source(10, 5) + SourceIndex(0) name (e2)
|
||||
2 >Emitted(12, 29) Source(10, 7) + SourceIndex(0) name (e2)
|
||||
3 >Emitted(12, 30) Source(10, 7) + SourceIndex(0) name (e2)
|
||||
---
|
||||
>>>})(e2 || (e2 = {}));
|
||||
1 >
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts(2,15): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts (1 errors) ====
|
||||
|
@ -6,3 +7,4 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
|
|||
var r5 = foo3((x: number) => ''); // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
31
tests/baselines/reference/superCallArgsMustMatch.errors.txt
Normal file
31
tests/baselines/reference/superCallArgsMustMatch.errors.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
tests/cases/compiler/superCallArgsMustMatch.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallArgsMustMatch.ts (1 errors) ====
|
||||
class T5<T>{
|
||||
|
||||
public foo: T;
|
||||
|
||||
constructor(public bar: T) { }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class T6 extends T5<number>{
|
||||
|
||||
constructor() {
|
||||
|
||||
// Should error; base constructor has type T for first arg,
|
||||
// which is instantiated with 'number' in the extends clause
|
||||
super("hi");
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
var x: number = this.foo;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +13,9 @@ class T6 extends T5<number>{
|
|||
|
||||
constructor() {
|
||||
|
||||
super("hi"); // Should error, base constructor has type T for first arg, which is fixed as number in the extends clause
|
||||
// Should error; base constructor has type T for first arg,
|
||||
// which is instantiated with 'number' in the extends clause
|
||||
super("hi");
|
||||
|
||||
var x: number = this.foo;
|
||||
|
||||
|
@ -39,7 +41,9 @@ var T5 = (function () {
|
|||
var T6 = (function (_super) {
|
||||
__extends(T6, _super);
|
||||
function T6() {
|
||||
_super.call(this, "hi"); // Should error, base constructor has type T for first arg, which is fixed as number in the extends clause
|
||||
// Should error; base constructor has type T for first arg,
|
||||
// which is instantiated with 'number' in the extends clause
|
||||
_super.call(this, "hi");
|
||||
var x = this.foo;
|
||||
}
|
||||
return T6;
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
=== tests/cases/compiler/superCallArgsMustMatch.ts ===
|
||||
class T5<T>{
|
||||
>T5 : T5<T>
|
||||
>T : T
|
||||
|
||||
public foo: T;
|
||||
>foo : T
|
||||
>T : T
|
||||
|
||||
constructor(public bar: T) { }
|
||||
>bar : T
|
||||
>T : T
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class T6 extends T5<number>{
|
||||
>T6 : T6
|
||||
>T5 : T5<T>
|
||||
|
||||
constructor() {
|
||||
|
||||
super("hi"); // Should error, base constructor has type T for first arg, which is fixed as number in the extends clause
|
||||
>super("hi") : void
|
||||
>super : typeof T5
|
||||
|
||||
var x: number = this.foo;
|
||||
>x : number
|
||||
>this.foo : number
|
||||
>this : T6
|
||||
>foo : number
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.ts(8,17): error TS2314: Generic type 'A<T1, T2>' requires 2 type argument(s).
|
||||
tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.ts(9,21): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.ts (2 errors) ====
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number> {
|
||||
~~~~~~~~~
|
||||
!!! error TS2314: Generic type 'A<T1, T2>' requires 2 type argument(s).
|
||||
constructor() { super(value => String(value)); }
|
||||
~~~~~
|
||||
!!! error TS2335: 'super' can only be referenced in a derived class.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
//// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.ts]
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number> {
|
||||
constructor() { super(value => String(value)); }
|
||||
}
|
||||
|
||||
//// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A(map) {
|
||||
this.map = map;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.call(this, function (value) { return String(value); });
|
||||
}
|
||||
return B;
|
||||
})(A);
|
|
@ -0,0 +1,19 @@
|
|||
tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.ts(8,17): error TS2314: Generic type 'A<T1, T2>' requires 2 type argument(s).
|
||||
tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.ts(9,21): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.ts (2 errors) ====
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
~
|
||||
!!! error TS2314: Generic type 'A<T1, T2>' requires 2 type argument(s).
|
||||
constructor() { super(value => String(value)); }
|
||||
~~~~~
|
||||
!!! error TS2335: 'super' can only be referenced in a derived class.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
//// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.ts]
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor() { super(value => String(value)); }
|
||||
}
|
||||
|
||||
//// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A(map) {
|
||||
this.map = map;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.call(this, function (value) { return String(value); });
|
||||
}
|
||||
return B;
|
||||
})(A);
|
|
@ -0,0 +1,19 @@
|
|||
tests/cases/compiler/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.ts(8,17): error TS2315: Type 'A' is not generic.
|
||||
tests/cases/compiler/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.ts(9,21): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.ts (2 errors) ====
|
||||
|
||||
class A {
|
||||
constructor(private map: (value: number) => string) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number, string> {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2315: Type 'A' is not generic.
|
||||
constructor() { super(value => String(value)); }
|
||||
~~~~~
|
||||
!!! error TS2335: 'super' can only be referenced in a derived class.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
//// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.ts]
|
||||
|
||||
class A {
|
||||
constructor(private map: (value: number) => string) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number, string> {
|
||||
constructor() { super(value => String(value)); }
|
||||
}
|
||||
|
||||
//// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A(map) {
|
||||
this.map = map;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.call(this, function (value) { return String(value); });
|
||||
}
|
||||
return B;
|
||||
})(A);
|
|
@ -0,0 +1,16 @@
|
|||
tests/cases/compiler/superCallFromClassThatHasNoBaseType1.ts(9,21): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallFromClassThatHasNoBaseType1.ts (1 errors) ====
|
||||
|
||||
class A {
|
||||
constructor(private map: (value: number) => string) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
constructor() { super(value => String(value)); }
|
||||
~~~~~
|
||||
!!! error TS2335: 'super' can only be referenced in a derived class.
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
//// [superCallFromClassThatHasNoBaseType1.ts]
|
||||
|
||||
class A {
|
||||
constructor(private map: (value: number) => string) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
constructor() { super(value => String(value)); }
|
||||
}
|
||||
|
||||
//// [superCallFromClassThatHasNoBaseType1.js]
|
||||
var A = (function () {
|
||||
function A(map) {
|
||||
this.map = map;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
_super.call(this, function (value) { return String(value); });
|
||||
}
|
||||
return B;
|
||||
})();
|
10
tests/baselines/reference/superCallFromFunction1.errors.txt
Normal file
10
tests/baselines/reference/superCallFromFunction1.errors.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
tests/cases/compiler/superCallFromFunction1.ts(3,5): error TS2335: 'super' can only be referenced in a derived class.
|
||||
|
||||
|
||||
==== tests/cases/compiler/superCallFromFunction1.ts (1 errors) ====
|
||||
|
||||
function foo() {
|
||||
super(value => String(value));
|
||||
~~~~~
|
||||
!!! error TS2335: 'super' can only be referenced in a derived class.
|
||||
}
|
10
tests/baselines/reference/superCallFromFunction1.js
Normal file
10
tests/baselines/reference/superCallFromFunction1.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [superCallFromFunction1.ts]
|
||||
|
||||
function foo() {
|
||||
super(value => String(value));
|
||||
}
|
||||
|
||||
//// [superCallFromFunction1.js]
|
||||
function foo() {
|
||||
_super.call(this, function (value) { return String(value); });
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
//// [superCallParameterContextualTyping1.ts]
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number, string> {
|
||||
// Ensure 'value' is of type 'number (and not '{}') by using its 'toExponential()' method.
|
||||
constructor() { super(value => String(value.toExponential())); }
|
||||
}
|
||||
|
||||
|
||||
//// [superCallParameterContextualTyping1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var A = (function () {
|
||||
function A(map) {
|
||||
this.map = map;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
// Ensure 'value' is of type 'number (and not '{}') by using its 'toExponential()' method.
|
||||
function B() {
|
||||
_super.call(this, function (value) { return String(value.toExponential()); });
|
||||
}
|
||||
return B;
|
||||
})(A);
|
|
@ -0,0 +1,34 @@
|
|||
=== tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping1.ts ===
|
||||
|
||||
class A<T1, T2> {
|
||||
>A : A<T1, T2>
|
||||
>T1 : T1
|
||||
>T2 : T2
|
||||
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
>map : (value: T1) => T2
|
||||
>value : T1
|
||||
>T1 : T1
|
||||
>T2 : T2
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A<number, string> {
|
||||
>B : B
|
||||
>A : A<T1, T2>
|
||||
|
||||
// Ensure 'value' is of type 'number (and not '{}') by using its 'toExponential()' method.
|
||||
constructor() { super(value => String(value.toExponential())); }
|
||||
>super(value => String(value.toExponential())) : void
|
||||
>super : typeof A
|
||||
>value => String(value.toExponential()) : (value: number) => string
|
||||
>value : number
|
||||
>String(value.toExponential()) : string
|
||||
>String : StringConstructor
|
||||
>value.toExponential() : string
|
||||
>value.toExponential : (fractionDigits?: number) => string
|
||||
>value : number
|
||||
>toExponential : (fractionDigits?: number) => string
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts(10,43): error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts (1 errors) ====
|
||||
|
||||
class A<T1, T2> {
|
||||
constructor(private map: (value: T1) => T2) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A<number, string> {
|
||||
// Ensure 'value' is not of type 'any' by invoking it with type arguments.
|
||||
constructor() { super(value => String(value<string>())); }
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue