Merge branch 'master' into fixSpeculativeParse

Conflicts:
	tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt
This commit is contained in:
Yui T 2014-12-08 16:35:51 -08:00
commit aee0b9e8a1
56 changed files with 1347 additions and 1658 deletions

View file

@ -1012,7 +1012,7 @@ module ts {
var symbol = resolveName(enclosingDeclaration, (<Identifier>firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
// Verify if the symbol is accessible
return hasVisibleDeclarations(symbol) || <SymbolVisibilityResult>{
return (symbol && hasVisibleDeclarations(symbol)) || <SymbolVisibilityResult>{
accessibility: SymbolAccessibility.NotAccessible,
errorSymbolName: getTextOfNode(firstIdentifier),
errorNode: firstIdentifier
@ -1307,6 +1307,17 @@ module ts {
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value);
}
function getIndexerParameterName(type: ObjectType, indexKind: IndexKind, fallbackName: string): string {
var declaration = <SignatureDeclaration>getIndexDeclarationOfSymbol(type.symbol, indexKind);
if (!declaration) {
// declaration might not be found if indexer was added from the contextual type.
// in this case use fallback name
return fallbackName;
}
Debug.assert(declaration.parameters.length !== 0);
return declarationNameToString(declaration.parameters[0].name);
}
function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) {
var resolved = resolveObjectOrUnionTypeMembers(type);
if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) {
@ -1359,7 +1370,7 @@ module ts {
if (resolved.stringIndexType) {
// [x: string]:
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writer.writeParameter("x");
writer.writeParameter(getIndexerParameterName(resolved, IndexKind.String, /*fallbackName*/"x"));
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
writeKeyword(writer, SyntaxKind.StringKeyword);
@ -1373,7 +1384,7 @@ module ts {
if (resolved.numberIndexType) {
// [x: number]:
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writer.writeParameter("x");
writer.writeParameter(getIndexerParameterName(resolved, IndexKind.Number, /*fallbackName*/"x"));
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
writeKeyword(writer, SyntaxKind.NumberKeyword);

View file

@ -2,6 +2,7 @@
/// <reference path="core.ts"/>
/// <reference path="scanner.ts"/>
/// <reference path="parser.ts"/>
/// <reference path="binder.ts"/>
module ts {
interface EmitTextWriter {

View file

@ -1338,15 +1338,17 @@ module ts {
return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.EndOfFileToken || scanner.hasPrecedingLineBreak();
}
function parseSemicolon(diagnosticMessage?: DiagnosticMessage): void {
function parseSemicolon(diagnosticMessage?: DiagnosticMessage): boolean {
if (canParseSemicolon()) {
if (token === SyntaxKind.SemicolonToken) {
// consume the semicolon if it was explicitly provided.
nextToken();
}
return true;
}
else {
parseExpected(SyntaxKind.SemicolonToken, diagnosticMessage);
return parseExpected(SyntaxKind.SemicolonToken, diagnosticMessage);
}
}
@ -2052,13 +2054,27 @@ module ts {
return requireCompleteParameterList ? undefined : createMissingList<ParameterDeclaration>();
}
function parseTypeMemberSemicolon() {
// Try to parse out an explicit or implicit (ASI) semicolon for a type member. If we
// don't have one, then an appropriate error will be reported.
if (parseSemicolon()) {
return;
}
// If we don't have a semicolon, then the user may have written a comma instead
// accidently (pretty easy to do since commas are so prevalent as list separators). So
// just consume the comma and keep going. Note: we'll have already reported the error
// about the missing semicolon above.
parseOptional(SyntaxKind.CommaToken);
}
function parseSignatureMember(kind: SyntaxKind): SignatureDeclaration {
var node = <SignatureDeclaration>createNode(kind);
if (kind === SyntaxKind.ConstructSignature) {
parseExpected(SyntaxKind.NewKeyword);
}
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
parseSemicolon();
parseTypeMemberSemicolon();
return finishNode(node);
}
@ -2130,11 +2146,11 @@ module ts {
setModifiers(node, modifiers);
node.parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
node.type = parseTypeAnnotation();
parseSemicolon();
parseTypeMemberSemicolon();
return finishNode(node)
}
function parsePropertyOrMethod(): Declaration {
function parsePropertyOrMethodSignature(): Declaration {
var fullStart = scanner.getStartPos();
var name = parsePropertyName();
var questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
@ -2147,8 +2163,7 @@ module ts {
// Method signatues don't exist in expression contexts. So they have neither
// [Yield] nor [GeneratorParameter]
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, method);
parseSemicolon();
parseTypeMemberSemicolon();
return finishNode(method);
}
else {
@ -2156,7 +2171,7 @@ module ts {
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
parseSemicolon();
parseTypeMemberSemicolon();
return finishNode(property);
}
}
@ -2188,7 +2203,7 @@ module ts {
return parseSignatureMember(SyntaxKind.CallSignature);
case SyntaxKind.OpenBracketToken:
// Indexer or computed property
return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined) : parsePropertyOrMethod();
return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined) : parsePropertyOrMethodSignature();
case SyntaxKind.NewKeyword:
if (lookAhead(isStartOfConstructSignature)) {
return parseSignatureMember(SyntaxKind.ConstructSignature);
@ -2196,10 +2211,10 @@ module ts {
// fall through.
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
return parsePropertyOrMethod();
return parsePropertyOrMethodSignature();
default:
if (isIdentifierOrKeyword()) {
return parsePropertyOrMethod();
return parsePropertyOrMethodSignature();
}
}
}

View file

@ -21,15 +21,50 @@ class Test262BaselineRunner extends RunnerBase {
return Test262BaselineRunner.basePath + "/" + filename;
}
private static checkInvariants(node: ts.Node, parent: ts.Node): void {
if (node) {
if (node.pos < 0) {
throw new Error("node.pos < 0");
}
if (node.end < 0) {
throw new Error("node.end < 0");
}
if (node.end < node.pos) {
throw new Error("node.end < node.pos");
}
if (node.parent !== parent) {
throw new Error("node.parent !== parent");
}
ts.forEachChild(node, child => {
Test262BaselineRunner.checkInvariants(child, node);
});
var childNodesAndArrays: any[] = [];
ts.forEachChild(node, child => { childNodesAndArrays.push(child) }, array => { childNodesAndArrays.push(array) });
for (var childName in node) {
var child = (<any>node)[childName];
if (Test262BaselineRunner.isNodeOrArray(child)) {
if (childNodesAndArrays.indexOf(child) < 0) {
throw new Error("Child when forEach'ing over node. " + (<any>ts).SyntaxKind[node.kind] + "-" + childName);
}
}
}
}
}
private static serializeSourceFile(file: ts.SourceFile): string {
function getKindName(k: number): string {
return (<any>ts).SyntaxKind[k]
}
function getFlagName(flags: any, f: number): any {
if (f === 0) return 0;
if (f === 0) {
return 0;
}
var result = "";
ts.forEach(Object.getOwnPropertyNames(flags),(v: any) => {
ts.forEach(Object.getOwnPropertyNames(flags), (v: any) => {
if (isFinite(v)) {
v = +v;
if (f === +v) {
@ -51,49 +86,64 @@ class Test262BaselineRunner extends RunnerBase {
function getParserContextFlagName(f: number) { return getFlagName((<any>ts).ParserContextFlags, f); }
function serializeNode(n: ts.Node): any {
var o = { kind: getKindName(n.kind) };
ts.forEach(Object.getOwnPropertyNames(n), i => {
switch (i) {
var o: any = { kind: getKindName(n.kind) };
ts.forEach(Object.getOwnPropertyNames(n), propertyName => {
switch (propertyName) {
case "parent":
case "symbol":
case "locals":
case "localSymbol":
case "kind":
case "semanticDiagnostics":
case "parseDiagnostics":
case "grammarDiagnostics":
return undefined;
case "id":
case "nodeCount":
case "symbolCount":
case "identifierCount":
// Blacklist of items we never put in the baseline file.
break;
case "flags":
(<any>o)[i] = getNodeFlagName(n.flags);
return undefined;
// Print out flags with their enum names.
o[propertyName] = getNodeFlagName(n.flags);
break;
case "parserContextFlags":
(<any>o)[i] = getParserContextFlagName(n.parserContextFlags);
return undefined;
o[propertyName] = getParserContextFlagName(n.parserContextFlags);
break;
case "nextContainer":
if (n.nextContainer) {
(<any>o)[i] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
return undefined;
o[propertyName] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
}
break;
case "text":
if (n.kind === ts.SyntaxKind.SourceFile) return undefined;
// Include 'text' field for identifiers/literals, but not for source files.
if (n.kind !== ts.SyntaxKind.SourceFile) {
o[propertyName] = (<any>n)[propertyName];
}
break;
default:
(<any>o)[i] = ((<any>n)[i]);
o[propertyName] = (<any>n)[propertyName];
}
return undefined;
});
return o;
}
return JSON.stringify(file,(k, v) => {
return (v && typeof v.pos === "number") ? serializeNode(v) : v;
return JSON.stringify(file, (k, v) => {
return Test262BaselineRunner.isNodeOrArray(v) ? serializeNode(v) : v;
}, " ");
}
private static isNodeOrArray(a: any): boolean {
return a !== undefined && typeof a.pos === "number";
}
private runTest(filePath: string) {
describe('test262 test for ' + filePath, () => {
// Mocha holds onto the closure environment of the describe callback even after the test is done.
@ -150,6 +200,11 @@ class Test262BaselineRunner extends RunnerBase {
}, false, Test262BaselineRunner.baselineOptions);
});
it('satisfies invariants', () => {
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
Test262BaselineRunner.checkInvariants(sourceFile, /*parent:*/ undefined);
});
it('has the expected AST',() => {
Harness.Baseline.runBaseline('has the expected AST', testState.filename + '.AST.txt',() => {
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));

View file

@ -104,6 +104,7 @@ module TypeScript {
A_generator_declaration_cannot_have_the_async_modifier: "A generator declaration cannot have the 'async' modifier.",
async_modifier_cannot_appear_here: "'async' modifier cannot appear here.",
comma_expression_cannot_appear_in_a_computed_property_name: "'comma' expression cannot appear in a computed property name.",
String_literal_expected: "String literal expected.",
Duplicate_identifier_0: "Duplicate identifier '{0}'.",
The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.",
The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.",

View file

@ -106,6 +106,7 @@ module TypeScript {
"A generator declaration cannot have the 'async' modifier.": { "code": 1118, "category": DiagnosticCategory.Error },
"'async' modifier cannot appear here.": { "code": 1119, "category": DiagnosticCategory.Error },
"'comma' expression cannot appear in a computed property name.": { "code": 1120, "category": DiagnosticCategory.Error },
"String literal expected.": { "code": 1121, "category": DiagnosticCategory.Error },
"Duplicate identifier '{0}'.": { "code": 2000, "category": DiagnosticCategory.Error },
"The name '{0}' does not exist in the current scope.": { "code": 2001, "category": DiagnosticCategory.Error },
"The name '{0}' does not refer to a value.": { "code": 2002, "category": DiagnosticCategory.Error },

View file

@ -411,6 +411,10 @@
"category": "Error",
"code": 1120
},
"String literal expected.": {
"category": "Error",
"code": 1121
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2000

View file

@ -1291,6 +1291,7 @@ module ts {
public static interfaceName = "interface name";
public static moduleName = "module name";
public static typeParameterName = "type parameter name";
public static typeAlias = "type alias name";
}
enum MatchKind {
@ -4946,6 +4947,9 @@ module ts {
else if (flags & SymbolFlags.Enum) {
return ClassificationTypeNames.enumName;
}
else if (flags & SymbolFlags.TypeAlias) {
return ClassificationTypeNames.typeAlias;
}
else if (meaningAtPosition & SemanticMeaning.Type) {
if (flags & SymbolFlags.Interface) {
return ClassificationTypeNames.interfaceName;

View file

@ -1964,17 +1964,23 @@ function generateConstructorFunction(definition) {
}
result += ") {\r\n";
result += " if (data) { this.__data = data; }\r\n";
result += " this.parent = undefined";
if (definition.children.length) {
result += " ";
for (var i = 0; i < definition.children.length; i++) {
<<<<<<< HEAD
if (i) {
result += ", ";
}
=======
result += ",\r\n";
>>>>>>> 691a8a7... Remove restriction that you cannot reuse nodes/tokens during incremental parsing while doing speculatively operations.
var child = definition.children[i];
result += "this." + child.name + " = " + getSafeName(child);
}
result += ";\r\n";
}
<<<<<<< HEAD
if (definition.children.length > 0) {
result += " ";
for (var i = 0; i < definition.children.length; i++) {
@ -1991,6 +1997,9 @@ function generateConstructorFunction(definition) {
}
result += ";\r\n";
}
=======
result += ";\r\n";
>>>>>>> 691a8a7... Remove restriction that you cannot reuse nodes/tokens during incremental parsing while doing speculatively operations.
result += " };\r\n";
result += " " + definition.name + ".prototype.kind = SyntaxKind." + getNameWithoutSuffix(definition) + ";\r\n";
result += " " + definition.name + ".prototype.childCount = " + definition.children.length + ";\r\n";

File diff suppressed because one or more lines are too long

View file

@ -25,17 +25,15 @@ module TypeScript.IncrementalParser {
//
// This parser source also keeps track of the absolute position in the text that we're in,
// and any token diagnostics produced. That way we dont' have to track that ourselves.
var _scannerParserSource = Scanner.createParserSource(oldSyntaxTree.fileName(), text, oldSyntaxTree.languageVersion());
var scannerParserSource = Scanner.createParserSource(oldSyntaxTree.fileName(), text, oldSyntaxTree.languageVersion());
// The cursor we use to navigate through and retrieve nodes and tokens from the old tree.
var oldSourceUnit = oldSyntaxTree.sourceUnit();
var _isSpeculativelyParsing = false;
// Start the cursor pointing at the first element in the source unit (if it exists).
var _oldSourceUnitCursor = getSyntaxCursor();
var oldSourceUnitCursor = getSyntaxCursor();
if (oldSourceUnit.moduleElements.length > 0) {
_oldSourceUnitCursor.pushElement(childAt(oldSourceUnit.moduleElements, 0), /*indexInParent:*/ 0);
oldSourceUnitCursor.pushElement(childAt(oldSourceUnit.moduleElements, 0), /*indexInParent:*/ 0);
}
// In general supporting multiple individual edits is just not that important. So we
@ -43,18 +41,16 @@ module TypeScript.IncrementalParser {
// time this could be problematic would be if the user made a ton of discontinuous edits.
// For example, doing a column select on a *large* section of a code. If this is a
// problem, we can always update this code to handle multiple changes.
var _changeRange = extendToAffectedRange(textChangeRange, oldSourceUnit);
// Cached value of _changeRange.newSpan(). Cached for performance.
var _changeRangeNewSpan = _changeRange.newSpan();
var changeRange = extendToAffectedRange(textChangeRange, oldSourceUnit);
// The old tree's length, plus whatever length change was caused by the edit
// Had better equal the new text's length!
if (Debug.shouldAssert(AssertionLevel.Aggressive)) {
Debug.assert((fullWidth(oldSourceUnit) - _changeRange.span().length() + _changeRange.newLength()) === text.length());
Debug.assert((fullWidth(oldSourceUnit) - changeRange.span().length() + changeRange.newLength()) === text.length());
}
var delta = _changeRange.newSpan().length() - _changeRange.span().length();
var delta = changeRange.newSpan().length() - changeRange.span().length();
// If we added or removed characters during the edit, then we need to go and adjust all
// the nodes after the edit. Those nodes may move forward down (if we inserted chars)
// or they may move backward (if we deleted chars).
@ -70,7 +66,7 @@ module TypeScript.IncrementalParser {
// Also, mark any syntax elements that intersect the changed span. We know, up front,
// that we cannot reuse these elements.
updateTokenPositionsAndMarkElements(<ISyntaxElementInternal><ISyntaxElement>oldSourceUnit,
_changeRange.span().start(), _changeRange.span().end(), delta, /*fullStart:*/ 0);
changeRange.span().start(), changeRange.span().end(), delta, /*fullStart:*/ 0);
function extendToAffectedRange(changeRange: TextChangeRange, sourceUnit: SourceUnitSyntax): TextChangeRange {
// Consider the following code:
@ -104,35 +100,27 @@ module TypeScript.IncrementalParser {
}
function absolutePosition() {
return _scannerParserSource.absolutePosition();
return scannerParserSource.absolutePosition();
}
function tokenDiagnostics(): Diagnostic[] {
return _scannerParserSource.tokenDiagnostics();
function diagnostics(): Diagnostic[] {
return scannerParserSource.diagnostics();
}
function tryParse<T extends ISyntaxNode>(callback: () => T): T {
// Clone our cursor. That way we can restore to that point if the parser needs to rewind.
var savedOldSourceUnitCursor = cloneSyntaxCursor(_oldSourceUnitCursor);
var savedIsSpeculativelyParsing = _isSpeculativelyParsing;
// Mark that we're speculative parsing. During speculative parsing we cannot ruse
// nodes from the parse tree. See the comment in trySynchronizeCursorToPosition for
// the reasons why.
_isSpeculativelyParsing = true;
var savedOldSourceUnitCursor = cloneSyntaxCursor(oldSourceUnitCursor);
// Now defer to our underlying scanner source to actually invoke the callback. That
// way, if the parser decides to rewind, both the scanner source and this incremental
// source will rewind appropriately.
var result = _scannerParserSource.tryParse(callback);
_isSpeculativelyParsing = savedIsSpeculativelyParsing;
var result = scannerParserSource.tryParse(callback);
if (!result) {
// We're rewinding. Reset the cursor to what it was when we got the rewind point.
// Make sure to return our existing cursor to the pool so it can be reused.
returnSyntaxCursor(_oldSourceUnitCursor);
_oldSourceUnitCursor = savedOldSourceUnitCursor;
returnSyntaxCursor(oldSourceUnitCursor);
oldSourceUnitCursor = savedOldSourceUnitCursor;
}
else {
// We're not rewinding. Return the cloned original cursor back to the pool.
@ -143,36 +131,15 @@ module TypeScript.IncrementalParser {
}
function trySynchronizeCursorToPosition() {
// If we're currently pinned, then do not want to touch the cursor. Here's why. First,
// recall that we're 'pinned' when we're speculatively parsing. So say we were to allow
// returning old nodes/tokens while speculatively parsing. Then, the parser might start
// mutating the nodes and tokens we returned (i.e. by setting their parents). Then,
// when we rewound, those nodes and tokens would still have those updated parents.
// Parents which we just decided we did *not* want to parse (hence why we rewound). For
// Example, say we have something like:
//
// var v = f<a,b,c>e; // note: this is not generic.
//
// When incrementally parsing, we will need to speculatively parse to determine if the
// above is generic. This will cause us to reuse the "a, b, c" tokens, and set their
// parent to a new type argument list. A type argument list we will then throw away once
// we decide that it isn't actually generic. We will have now 'broken' the original tree.
//
// As such, the rule is simple. We only return nodes/tokens from teh original tree if
// we know the parser will accept and consume them and never rewind back before them.
if (_isSpeculativelyParsing) {
return false;
}
var absolutePos = absolutePosition();
while (true) {
if (_oldSourceUnitCursor.isFinished()) {
if (oldSourceUnitCursor.isFinished()) {
// Can't synchronize the cursor to the current position if the cursor is finished.
return false;
}
// Start with the current node or token the cursor is pointing at.
var currentNodeOrToken = _oldSourceUnitCursor.currentNodeOrToken();
var currentNodeOrToken = oldSourceUnitCursor.currentNodeOrToken();
// Node, move the cursor past any nodes or tokens that intersect the change range
// 1) they are never reusable.
@ -182,10 +149,10 @@ module TypeScript.IncrementalParser {
// of the incremental algorithm.
if ((<ISyntaxElementInternal><ISyntaxElement>currentNodeOrToken).intersectsChange) {
if (isNode(currentNodeOrToken)) {
_oldSourceUnitCursor.moveToFirstChild();
oldSourceUnitCursor.moveToFirstChild();
}
else {
_oldSourceUnitCursor.moveToNextSibling();
oldSourceUnitCursor.moveToNextSibling();
}
continue;
}
@ -213,13 +180,13 @@ module TypeScript.IncrementalParser {
// able to break up that token any further and we should just move to the next
// token.
if (currentNodeOrTokenFullEnd <= absolutePos || isToken(currentNodeOrToken)) {
_oldSourceUnitCursor.moveToNextSibling();
oldSourceUnitCursor.moveToNextSibling();
}
else {
// We have a node, and it started before our absolute pos, and ended after our
// pos. Try to crumble this node to see if we'll be able to skip the first node
// or token contained within.
_oldSourceUnitCursor.moveToFirstChild();
oldSourceUnitCursor.moveToFirstChild();
}
}
}
@ -248,12 +215,12 @@ module TypeScript.IncrementalParser {
// Either we couldn't read from the old source unit, or we weren't able to successfully
// get a token from it. In this case we need to read a token from the underlying text.
return _scannerParserSource.currentToken();
return scannerParserSource.currentToken();
}
function currentContextualToken(): ISyntaxToken {
// Just delegate to the underlying source to handle
return _scannerParserSource.currentContextualToken();
return scannerParserSource.currentContextualToken();
}
function tryGetNodeFromOldSourceUnit(): ISyntaxNode {
@ -264,7 +231,7 @@ module TypeScript.IncrementalParser {
// c) it does not have a regex token in it.
// d) we are still in the same strict or non-strict state that the node was originally parsed in.
while (true) {
var node = _oldSourceUnitCursor.currentNode();
var node = oldSourceUnitCursor.currentNode();
if (node === undefined) {
// Couldn't even read a node, nothing to return.
return undefined;
@ -279,7 +246,7 @@ module TypeScript.IncrementalParser {
// We couldn't use currentNode. Try to move to its first child (in case that's a
// node). If it is we can try using that. Otherwise we'll just bail out in the
// next iteration of the loop.
_oldSourceUnitCursor.moveToFirstChild();
oldSourceUnitCursor.moveToFirstChild();
}
}
@ -309,7 +276,7 @@ module TypeScript.IncrementalParser {
function tryGetTokenFromOldSourceUnit(): ISyntaxToken {
// get the current token that the cursor is pointing at.
var token = _oldSourceUnitCursor.currentToken();
var token = oldSourceUnitCursor.currentToken();
return canReuseTokenFromOldSourceUnit(token) ? token : undefined;
}
@ -323,44 +290,44 @@ module TypeScript.IncrementalParser {
}
// Couldn't peek this far in the old tree. Get the token from the new text.
return _scannerParserSource.peekToken(n);
return scannerParserSource.peekToken(n);
}
function tryPeekTokenFromOldSourceUnit(n: number): ISyntaxToken {
// clone the existing cursor so we can move it forward and then restore ourselves back
// to where we started from.
var cursorClone = cloneSyntaxCursor(_oldSourceUnitCursor);
var cursorClone = cloneSyntaxCursor(oldSourceUnitCursor);
var token = tryPeekTokenFromOldSourceUnitWorker(n);
returnSyntaxCursor(_oldSourceUnitCursor);
_oldSourceUnitCursor = cursorClone;
returnSyntaxCursor(oldSourceUnitCursor);
oldSourceUnitCursor = cursorClone;
return token;
}
function tryPeekTokenFromOldSourceUnitWorker(n: number): ISyntaxToken {
// First, make sure the cursor is pointing at a token.
_oldSourceUnitCursor.moveToFirstToken();
oldSourceUnitCursor.moveToFirstToken();
// Now, keep walking forward to successive tokens.
for (var i = 0; i < n; i++) {
var interimToken = _oldSourceUnitCursor.currentToken();
var interimToken = oldSourceUnitCursor.currentToken();
if (!canReuseTokenFromOldSourceUnit(interimToken)) {
return undefined;
}
_oldSourceUnitCursor.moveToNextSibling();
oldSourceUnitCursor.moveToNextSibling();
}
var token = _oldSourceUnitCursor.currentToken();
var token = oldSourceUnitCursor.currentToken();
return canReuseTokenFromOldSourceUnit(token) ? token : undefined;
}
function consumeNodeOrToken(nodeOrToken: ISyntaxNodeOrToken): void {
_scannerParserSource.consumeNodeOrToken(nodeOrToken);
scannerParserSource.consumeNodeOrToken(nodeOrToken);
}
return {
@ -372,15 +339,15 @@ module TypeScript.IncrementalParser {
currentToken: currentToken,
currentContextualToken: currentContextualToken,
peekToken: peekToken,
consumeNodeOrToken: consumeNodeOrToken,
consumeNodeOrToken: scannerParserSource.consumeNodeOrToken,
tryParse: tryParse,
tokenDiagnostics: tokenDiagnostics,
diagnostics: diagnostics
};
}
function updateTokenPositionsAndMarkElements(element: ISyntaxElement, changeStart: number, changeRangeOldEnd: number, delta: number, fullStart: number): void {
// First, try to skip past any elements that we dont' need to move. We don't need to
// move any elements that don't start after the end of the change range.
// First, try to skip past any elements that we dont' need to move. We don't need to
// move any elements that don't start after the end of the change range.
if (fullStart > changeRangeOldEnd) {
// Note, we only move elements that are truly after the end of the change range.
// We consider elements that are touching the end of the change range to be unusable.
@ -444,8 +411,7 @@ module TypeScript.IncrementalParser {
forceUpdateTokenPosition(<ISyntaxToken>nodeOrToken, delta);
}
else {
var node = <ISyntaxNode>nodeOrToken;
var tokens = getTokens(node);
var tokens = getTokens(<ISyntaxNode>nodeOrToken);
for (var i = 0, n = tokens.length; i < n; i++) {
forceUpdateTokenPosition(tokens[i], delta);
}

File diff suppressed because it is too large Load diff

View file

@ -60,15 +60,15 @@ module TypeScript.Scanner {
// This gives us 23bit for width (or 8MB of width which should be enough for any codebase).
enum ScannerConstants {
LargeTokenFullWidthShift = 3,
LargeTokenFullWidthShift = 3,
WhitespaceTrivia = 0x01, // 00000001
NewlineTrivia = 0x02, // 00000010
CommentTrivia = 0x04, // 00000100
TriviaMask = 0x07, // 00000111
WhitespaceTrivia = 0x01, // 00000001
NewlineTrivia = 0x02, // 00000010
CommentTrivia = 0x04, // 00000100
TriviaMask = 0x07, // 00000111
KindMask = 0x7F, // 01111111
IsVariableWidthMask = 0x80, // 10000000
KindMask = 0x7F, // 01111111
IsVariableWidthMask = 0x80, // 10000000
}
function largeTokenPackData(fullWidth: number, leadingTriviaInfo: number) {
@ -154,7 +154,7 @@ module TypeScript.Scanner {
var lastTokenInfo = { leadingTriviaWidth: -1 };
var lastTokenInfoTokenID: number = -1;
var triviaScanner = createScannerInternal(ts.ScriptTarget.Latest, SimpleText.fromString(""), () => { });
var triviaScanner = createScannerInternal(ts.ScriptTarget.Latest, SimpleText.fromString(""),() => { });
interface IScannerToken extends ISyntaxToken {
}
@ -208,7 +208,7 @@ module TypeScript.Scanner {
public setFullStart(fullStart: number): void {
this._fullStart = fullStart;
}
public childAt(index: number): ISyntaxElement { throw Errors.invalidOperation() }
public isIncrementallyUnusable(): boolean { return false; }
@ -1425,7 +1425,7 @@ module TypeScript.Scanner {
export function isValidIdentifier(text: ISimpleText, languageVersion: ts.ScriptTarget): boolean {
var hadError = false;
var scanner = createScanner(languageVersion, text, () => hadError = true);
var scanner = createScanner(languageVersion, text,() => hadError = true);
var token = scanner.scan(/*allowContextualToken:*/ false);
@ -1467,7 +1467,7 @@ module TypeScript.Scanner {
return _absolutePosition;
}
function tokenDiagnostics(): Diagnostic[] {
function diagnostics(): Diagnostic[] {
return _tokenDiagnostics;
}
@ -1598,8 +1598,8 @@ module TypeScript.Scanner {
peekToken: peekToken,
consumeNodeOrToken: consumeNodeOrToken,
tryParse: tryParse,
tokenDiagnostics: tokenDiagnostics,
absolutePosition: absolutePosition,
diagnostics: diagnostics,
absolutePosition: absolutePosition
};
}

View file

@ -41,7 +41,7 @@ var interfaces: any = {
IPrimaryExpressionSyntax: 'IMemberExpressionSyntax',
};
var definitions:ITypeDefinition[] = [
var definitions: ITypeDefinition[] = [
<any>{
name: 'SourceUnitSyntax',
baseType: 'ISyntaxNode',
@ -55,10 +55,10 @@ var definitions:ITypeDefinition[] = [
baseType: 'ISyntaxNode',
interfaces: ['IModuleReferenceSyntax'],
children: [
<any>{ name: 'requireKeyword', isToken: true, excludeFromAST: true },
<any>{ name: 'openParenToken', isToken: true, excludeFromAST: true },
<any>{ name: 'stringLiteral', isToken: true },
<any>{ name: 'closeParenToken', isToken: true, excludeFromAST: true }
<any>{ name: 'requireKeyword', isToken: true },
<any>{ name: 'openParenToken', isToken: true },
<any>{ name: 'expression', type: 'IExpressionSyntax' },
<any>{ name: 'closeParenToken', isToken: true }
],
isTypeScriptSpecific: true
},
@ -665,7 +665,7 @@ var definitions:ITypeDefinition[] = [
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken' },
<any>{ name: 'constructorKeyword', isToken: true },
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
],
isTypeScriptSpecific: true
},
@ -678,20 +678,20 @@ var definitions:ITypeDefinition[] = [
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
],
isTypeScriptSpecific: true
},
<any>{
name: 'GetAccessorSyntax',
baseType: 'ISyntaxNode',
interfaces: ['IAccessorSyntax' ],
interfaces: ['IAccessorSyntax'],
children: [
<any>{ name: 'modifiers', isList: true, elementType: 'ISyntaxToken', isTypeScriptSpecific: true },
<any>{ name: 'getKeyword', isToken: true, excludeFromAST: true },
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
]
},
<any>{
@ -703,7 +703,7 @@ var definitions:ITypeDefinition[] = [
<any>{ name: 'setKeyword', isToken: true, excludeFromAST: true },
<any>{ name: 'propertyName', type: 'IPropertyNameSyntax' },
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }
],
isTypeScriptSpecific: true
},
@ -769,7 +769,7 @@ var definitions:ITypeDefinition[] = [
children: [
<any>{ name: 'caseKeyword', isToken: true, excludeFromAST: true },
<any>{ name: 'expression', type: 'IExpressionSyntax' },
<any>{ name: 'colonToken', isToken: true, excludeFromAST: true},
<any>{ name: 'colonToken', isToken: true, excludeFromAST: true },
<any>{ name: 'statements', isList: true, elementType: 'IStatementSyntax' }
]
},
@ -931,7 +931,7 @@ var definitions:ITypeDefinition[] = [
<any>{ name: 'asterixToken', isToken: true, isOptional: true },
<any>{ name: 'identifier', isToken: true, isOptional: true },
<any>{ name: 'callSignature', type: 'CallSignatureSyntax' },
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }]
<any>{ name: 'body', type: 'BlockSyntax | ExpressionBody | ISyntaxToken', isOptional: true }]
},
<any>{
name: 'EmptyStatementSyntax',
@ -1104,41 +1104,19 @@ function generateConstructorFunction(definition: ITypeDefinition) {
result += ") {\r\n";
result += " if (data) { this.__data = data; }\r\n";
result += " this.parent = undefined";
if (definition.children.length) {
result += " ";
for (var i = 0; i < definition.children.length; i++) {
if (i) {
result += ", ";
}
//if (i) {
result += ",\r\n";
//}
var child = definition.children[i];
result += "this." + child.name + " = " + getSafeName(child);
result += " this." + child.name + " = " + getSafeName(child);
}
result += ";\r\n";
}
if (definition.children.length > 0) {
result += " ";
for (var i = 0; i < definition.children.length; i++) {
if (i) {
result += ", ";
}
var child = definition.children[i];
if (child.isOptional) {
result += getSafeName(child) + " && (" + getSafeName(child) + ".parent = this)";
}
else {
result += getSafeName(child) + ".parent = this";
}
}
result += ";\r\n";
}
result += ";\r\n";
result += " };\r\n";
result += " " + definition.name + ".prototype.kind = SyntaxKind." + getNameWithoutSuffix(definition) + ";\r\n";
@ -1202,7 +1180,7 @@ function generateSyntaxInterface(definition: ITypeDefinition): string {
result += " }\r\n";
result += " export interface " + getNameWithoutSuffix(definition) + "Constructor {";
result += " new (data: number";
for (var i = 0; i < definition.children.length; i++) {
var child = definition.children[i];
result += ", ";
@ -1338,7 +1316,7 @@ function generateKeywordCondition(keywords: { text: string; kind: TypeScript.Syn
if (keywords.length === 1) {
var keyword = keywords[0];
if (currentCharacter === length) {
return " return SyntaxKind." + firstEnumName(getSyntaxKindEnum(), keyword.kind) + ";\r\n";
}

View file

@ -702,10 +702,10 @@ module TypeScript {
export interface ExternalModuleReferenceSyntax extends ISyntaxNode, IModuleReferenceSyntax {
requireKeyword: ISyntaxToken;
openParenToken: ISyntaxToken;
stringLiteral: ISyntaxToken;
expression: IExpressionSyntax;
closeParenToken: ISyntaxToken;
}
export interface ExternalModuleReferenceConstructor { new (data: number, requireKeyword: ISyntaxToken, openParenToken: ISyntaxToken, stringLiteral: ISyntaxToken, closeParenToken: ISyntaxToken): ExternalModuleReferenceSyntax }
export interface ExternalModuleReferenceConstructor { new (data: number, requireKeyword: ISyntaxToken, openParenToken: ISyntaxToken, expression: IExpressionSyntax, closeParenToken: ISyntaxToken): ExternalModuleReferenceSyntax }
export interface ModuleNameModuleReferenceSyntax extends ISyntaxNode, IModuleReferenceSyntax {
moduleName: INameSyntax;

View file

@ -48,22 +48,10 @@ module TypeScript.Syntax {
addArrayPrototypeValue("kind", SyntaxKind.List);
export function list<T extends ISyntaxNodeOrToken>(nodes: T[]): T[] {
if (nodes !== undefined) {
for (var i = 0, n = nodes.length; i < n; i++) {
nodes[i].parent = nodes;
}
}
return nodes;
}
export function separatedList<T extends ISyntaxNodeOrToken>(nodesAndTokens: ISyntaxNodeOrToken[]): ISeparatedSyntaxList<T> {
if (nodesAndTokens !== undefined) {
for (var i = 0, n = nodesAndTokens.length; i < n; i++) {
nodesAndTokens[i].parent = nodesAndTokens;
}
}
return <ISeparatedSyntaxList<T>>nodesAndTokens;
}
}

File diff suppressed because it is too large Load diff

View file

@ -74,55 +74,11 @@ module TypeScript {
return this._languageVersion;
}
private cacheSyntaxTreeInfo(): void {
// If we're not keeping around the syntax tree, store the diagnostics and line
// map so they don't have to be recomputed.
var firstToken = firstSyntaxTreeToken(this);
var leadingTrivia = firstToken.leadingTrivia(this.text);
this._isExternalModule = !!externalModuleIndicatorSpanWorker(this, firstToken);
var amdDependencies: string[] = [];
for (var i = 0, n = leadingTrivia.count(); i < n; i++) {
var trivia = leadingTrivia.syntaxTriviaAt(i);
if (trivia.isComment()) {
var amdDependency = this.getAmdDependency(trivia.fullText());
if (amdDependency) {
amdDependencies.push(amdDependency);
}
}
}
this._amdDependencies = amdDependencies;
}
private getAmdDependency(comment: string): string {
var amdDependencyRegEx = /^\/\/\/\s*<amd-dependency\s+path=('|")(.+?)\1/gim;
var match = amdDependencyRegEx.exec(comment);
return match ? match[2] : undefined;
}
public isExternalModule(): boolean {
// October 11, 2013
// External modules are written as separate source files that contain at least one
// external import declaration, export assignment, or top-level exported declaration.
if (this._isExternalModule === undefined) {
// force the info about isExternalModule to get created.
this.cacheSyntaxTreeInfo();
Debug.assert(this._isExternalModule !== undefined);
}
return this._isExternalModule;
}
public amdDependencies(): string[] {
if (this._amdDependencies === undefined) {
this.cacheSyntaxTreeInfo();
Debug.assert(this._amdDependencies !== undefined);
}
return this._amdDependencies;
}
}
class GrammarCheckerWalker extends SyntaxWalker {
@ -1033,6 +989,15 @@ module TypeScript {
super.visitExportAssignment(node);
}
public visitExternalModuleReference(node: ExternalModuleReferenceSyntax): void {
if (node.expression.kind !== SyntaxKind.StringLiteral) {
this.pushDiagnostic(node.expression, DiagnosticCode.String_literal_expected);
return;
}
super.visitExternalModuleReference(node);
}
public visitExpressionBody(node: ExpressionBody): void {
// These are always errors. So no need to ever recurse on them.
this.pushDiagnostic(node.equalsGreaterThanToken, DiagnosticCode._0_expected, ["{"]);
@ -1741,16 +1706,6 @@ module TypeScript {
return scanner.scan(/*allowContextualToken:*/ false);
}
export function externalModuleIndicatorSpan(syntaxTree: SyntaxTree): TextSpan {
var firstToken = firstSyntaxTreeToken(syntaxTree);
return externalModuleIndicatorSpanWorker(syntaxTree, firstToken);
}
export function externalModuleIndicatorSpanWorker(syntaxTree: SyntaxTree, firstToken: ISyntaxToken) {
var leadingTrivia = firstToken.leadingTrivia(syntaxTree.text);
return implicitImportSpan(leadingTrivia) || topLevelImportOrExportSpan(syntaxTree.sourceUnit());
}
function implicitImportSpan(sourceUnitLeadingTrivia: ISyntaxTriviaList): TextSpan {
for (var i = 0, n = sourceUnitLeadingTrivia.count(); i < n; i++) {
var trivia = sourceUnitLeadingTrivia.syntaxTriviaAt(i);
@ -1776,25 +1731,4 @@ module TypeScript {
return undefined;
}
function topLevelImportOrExportSpan(node: SourceUnitSyntax): TextSpan {
for (var i = 0, n = node.moduleElements.length; i < n; i++) {
var moduleElement = node.moduleElements[i];
var _firstToken = firstToken(moduleElement);
if (_firstToken && _firstToken.kind === SyntaxKind.ExportKeyword) {
return new TextSpan(start(_firstToken), width(_firstToken));
}
if (moduleElement.kind === SyntaxKind.ImportDeclaration) {
var importDecl = <ImportDeclarationSyntax>moduleElement;
if (importDecl.moduleReference.kind === SyntaxKind.ExternalModuleReference) {
var literal = (<TypeScript.ExternalModuleReferenceSyntax>importDecl.moduleReference).stringLiteral;
return new TextSpan(start(literal), width(literal));
}
}
}
return undefined;
}
}

View file

@ -627,7 +627,7 @@ module TypeScript {
public visitExternalModuleReference(node: ExternalModuleReferenceSyntax): void {
this.visitToken(node.requireKeyword);
this.visitToken(node.openParenToken);
this.visitToken(node.stringLiteral);
visitNodeOrToken(this, node.expression);
this.visitToken(node.closeParenToken);
}

View file

@ -32,8 +32,8 @@ function foo(animals: IAnimal[]) { }
>IAnimal : IAnimal
function bar(animals: { [n: number]: IAnimal }) { }
>bar : (animals: { [x: number]: IAnimal; }) => void
>animals : { [x: number]: IAnimal; }
>bar : (animals: { [n: number]: IAnimal; }) => void
>animals : { [n: number]: IAnimal; }
>n : number
>IAnimal : IAnimal
@ -53,7 +53,7 @@ foo([
]); // Legal because of the contextual type IAnimal provided by the parameter
bar([
>bar([ new Giraffe(), new Elephant()]) : void
>bar : (animals: { [x: number]: IAnimal; }) => void
>bar : (animals: { [n: number]: IAnimal; }) => void
>[ new Giraffe(), new Elephant()] : (Giraffe | Elephant)[]
new Giraffe(),
@ -81,6 +81,6 @@ foo(arr); // ok because arr is Array<Giraffe|Elephant> not {}[]
bar(arr); // ok because arr is Array<Giraffe|Elephant> not {}[]
>bar(arr) : void
>bar : (animals: { [x: number]: IAnimal; }) => void
>bar : (animals: { [n: number]: IAnimal; }) => void
>arr : (Giraffe | Elephant)[]

View file

@ -61,7 +61,7 @@ var classTypeArray: Array<typeof C>; // Should OK, not be a parse error
// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[]
var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }];
>context1 : { [x: number]: { a: string; b: number; }; }
>context1 : { [n: number]: { a: string; b: number; }; }
>n : number
>a : string
>b : number

View file

@ -1,6 +1,6 @@
tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [x: string]: any; }' is not assignable to type '{ one: number; }'.
Property 'one' is missing in type '{ [x: string]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(5,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: string]: any; }' is not assignable to type '{ one: number; }'.
Property 'one' is missing in type '{ [index: string]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(5,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: any; }'.
Index signature is missing in type '{ one: number; }'.
@ -10,9 +10,9 @@ tests/cases/compiler/assignmentCompat1.ts(5,1): error TS2322: Type '{ one: numbe
x = y;
~
!!! error TS2322: Type '{ [x: string]: any; }' is not assignable to type '{ one: number; }'.
!!! error TS2322: Property 'one' is missing in type '{ [x: string]: any; }'.
!!! error TS2322: Type '{ [index: string]: any; }' is not assignable to type '{ one: number; }'.
!!! error TS2322: Property 'one' is missing in type '{ [index: string]: any; }'.
y = x;
~
!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: any; }'.
!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: any; }'.
!!! error TS2322: Index signature is missing in type '{ one: number; }'.

View file

@ -1,4 +1,4 @@
tests/cases/compiler/assignmentCompatability35.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [x: number]: number; }'.
tests/cases/compiler/assignmentCompatability35.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [index: number]: number; }'.
Index signature is missing in type 'interfaceWithPublicAndOptional<number, string>'.
@ -13,5 +13,5 @@ tests/cases/compiler/assignmentCompatability35.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__aa = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [x: number]: number; }'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [index: number]: number; }'.
!!! error TS2322: Index signature is missing in type 'interfaceWithPublicAndOptional<number, string>'.

View file

@ -1,4 +1,4 @@
tests/cases/compiler/assignmentCompatability36.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [x: string]: any; }'.
tests/cases/compiler/assignmentCompatability36.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [index: string]: any; }'.
Index signature is missing in type 'interfaceWithPublicAndOptional<number, string>'.
@ -13,5 +13,5 @@ tests/cases/compiler/assignmentCompatability36.ts(9,1): error TS2322: Type 'inte
}
__test2__.__val__aa = __test1__.__val__obj4
~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [x: string]: any; }'.
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ [index: string]: any; }'.
!!! error TS2322: Index signature is missing in type 'interfaceWithPublicAndOptional<number, string>'.

View file

@ -1,6 +1,6 @@
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [x: number]: Foo; }'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
Index signature is missing in type '{}'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [x: number]: Bar; }'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
Index signature is missing in type '() => void'.
@ -21,14 +21,14 @@ tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignatur
var v1: {
~~
!!! error TS2322: Type '{}' is not assignable to type '{ [x: number]: Foo; }'.
!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{}'.
[n: number]: Foo
} = o; // Should be allowed
var v2: {
~~
!!! error TS2322: Type '() => void' is not assignable to type '{ [x: number]: Bar; }'.
!!! error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
!!! error TS2322: Index signature is missing in type '() => void'.
[n: number]: Bar
} = f; // Should be allowed

View file

@ -3,8 +3,8 @@ function method() {
>method : () => void
var dictionary = <{ [index: string]: string; }>{};
>dictionary : { [x: string]: string; }
><{ [index: string]: string; }>{} : { [x: string]: string; }
>dictionary : { [index: string]: string; }
><{ [index: string]: string; }>{} : { [index: string]: string; }
>index : string
>{} : { [x: string]: undefined; }
}

View file

@ -33,7 +33,7 @@ var arr: Contextual[] = [e]; // Ellement[]
>e : Ellement
var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]: Ellement }
>obj : { [x: string]: Contextual; }
>obj : { [s: string]: Contextual; }
>s : string
>Contextual : Contextual
>{ s: e } : { [x: string]: Ellement; s: Ellement; }

View file

@ -1,67 +1,67 @@
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(26,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(27,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(28,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(29,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(31,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(33,12): error TS2365: Operator '<' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(34,12): error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(37,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(38,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(39,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(40,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(42,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(43,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(44,12): error TS2365: Operator '>' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(45,12): error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(48,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(49,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(50,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(51,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(53,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(54,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(55,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(56,12): error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(59,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(60,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(61,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(62,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(64,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(65,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(66,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(67,12): error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(70,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(71,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(72,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(73,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(75,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(76,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(77,12): error TS2365: Operator '==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(78,12): error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(81,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(82,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(83,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(84,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(86,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(87,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(88,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(89,12): error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(92,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(93,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(94,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(95,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(97,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(98,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(99,12): error TS2365: Operator '===' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(100,12): error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(103,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(104,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(105,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(106,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(108,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(109,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(110,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(111,12): error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(26,12): error TS2365: Operator '<' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(27,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(28,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(29,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(31,12): error TS2365: Operator '<' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(32,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(33,12): error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(34,12): error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(37,12): error TS2365: Operator '>' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(38,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(39,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(40,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(42,12): error TS2365: Operator '>' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(43,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(44,12): error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(45,12): error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(48,12): error TS2365: Operator '<=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(49,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(50,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(51,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(53,12): error TS2365: Operator '<=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(54,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(55,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(56,12): error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(59,12): error TS2365: Operator '>=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(60,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(61,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(62,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(64,12): error TS2365: Operator '>=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(65,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(66,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(67,12): error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(70,12): error TS2365: Operator '==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(71,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(72,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(73,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(75,12): error TS2365: Operator '==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(76,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(77,12): error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(78,12): error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(81,12): error TS2365: Operator '!=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(82,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(83,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(84,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(86,12): error TS2365: Operator '!=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(87,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(88,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(89,12): error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(92,12): error TS2365: Operator '===' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(93,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(94,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(95,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(97,12): error TS2365: Operator '===' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(98,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(99,12): error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(100,12): error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(103,12): error TS2365: Operator '!==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(104,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(105,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(106,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(108,12): error TS2365: Operator '!==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(109,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(110,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts(111,12): error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts (64 errors) ====
@ -92,215 +92,215 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
// operator <
var r1a1 = a1 < b1;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r1a2 = a2 < b2;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r1a3 = a3 < b3;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r1a4 = a4 < b4;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r1b1 = b1 < a1;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r1b2 = b2 < a2;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r1b3 = b3 < a3;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r1b4 = b4 < a4;
~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '<' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator >
var r2a1 = a1 > b1;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r2a2 = a2 > b2;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r2a3 = a3 > b3;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r2a4 = a4 > b4;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r2b1 = b1 > a1;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r2b2 = b2 > a2;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r2b3 = b3 > a3;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r2b4 = b4 > a4;
~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '>' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator <=
var r3a1 = a1 <= b1;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r3a2 = a2 <= b2;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r3a3 = a3 <= b3;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r3a4 = a4 <= b4;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r3b1 = b1 <= a1;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r3b2 = b2 <= a2;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r3b3 = b3 <= a3;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r3b4 = b4 <= a4;
~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '<=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator >=
var r4a1 = a1 >= b1;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r4a2 = a2 >= b2;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r4a3 = a3 >= b3;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r4a4 = a4 >= b4;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r4b1 = b1 >= a1;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r4b2 = b2 >= a2;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r4b3 = b3 >= a3;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r4b4 = b4 >= a4;
~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '>=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator ==
var r5a1 = a1 == b1;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r5a2 = a2 == b2;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r5a3 = a3 == b3;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r5a4 = a4 == b4;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r5b1 = b1 == a1;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r5b2 = b2 == a2;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r5b3 = b3 == a3;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r5b4 = b4 == a4;
~~~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator !=
var r6a1 = a1 != b1;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r6a2 = a2 != b2;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r6a3 = a3 != b3;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r6a4 = a4 != b4;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r6b1 = b1 != a1;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r6b2 = b2 != a2;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r6b3 = b3 != a3;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r6b4 = b4 != a4;
~~~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '!=' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator ===
var r7a1 = a1 === b1;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r7a2 = a2 === b2;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r7a3 = a3 === b3;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r7a4 = a4 === b4;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r7b1 = b1 === a1;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r7b2 = b2 === a2;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r7b3 = b3 === a3;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r7b4 = b4 === a4;
~~~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '===' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.
// operator !==
var r8a1 = a1 !== b1;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: string; }' and '{ [x: string]: number; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [a: string]: string; }' and '{ [b: string]: number; }'.
var r8a2 = a2 !== b2;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: string]: C; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: string]: C; }'.
var r8a3 = a3 !== b3;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Base; }' and '{ [x: number]: C; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Base; }' and '{ [index: number]: C; }'.
var r8a4 = a4 !== b4;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: Derived; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: Derived; }' and '{ [index: string]: Base; }'.
var r8b1 = b1 !== a1;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: number; }' and '{ [x: string]: string; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [b: string]: number; }' and '{ [a: string]: string; }'.
var r8b2 = b2 !== a2;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: C; }' and '{ [x: string]: Base; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: C; }' and '{ [index: string]: Base; }'.
var r8b3 = b3 !== a3;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: number]: C; }' and '{ [x: number]: Base; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: number]: C; }' and '{ [index: number]: Base; }'.
var r8b4 = b4 !== a4;
~~~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types '{ [x: string]: Base; }' and '{ [x: number]: Derived; }'.
!!! error TS2365: Operator '!==' cannot be applied to types '{ [index: string]: Base; }' and '{ [index: number]: Derived; }'.

View file

@ -15,38 +15,38 @@ class Derived extends Base {
}
var a1: { [a: string]: string };
>a1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>a : string
var b1: { [b: string]: string };
>b1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>b : string
var a2: { [index: string]: Base };
>a2 : { [x: string]: Base; }
>a2 : { [index: string]: Base; }
>index : string
>Base : Base
var b2: { [index: string]: Derived };
>b2 : { [x: string]: Derived; }
>b2 : { [index: string]: Derived; }
>index : string
>Derived : Derived
var a3: { [index: number]: string };
>a3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>index : number
var b3: { [index: number]: string };
>b3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>index : number
var a4: { [index: number]: Base };
>a4 : { [x: number]: Base; }
>a4 : { [index: number]: Base; }
>index : number
>Base : Base
var b4: { [index: string]: Derived };
>b4 : { [x: string]: Derived; }
>b4 : { [index: string]: Derived; }
>index : string
>Derived : Derived
@ -54,391 +54,391 @@ var b4: { [index: string]: Derived };
var r1a1 = a1 < b1;
>r1a1 : boolean
>a1 < b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r1a1 = a2 < b2;
>r1a1 : boolean
>a2 < b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r1a1 = a3 < b3;
>r1a1 : boolean
>a3 < b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r1a1 = a4 < b4;
>r1a1 : boolean
>a4 < b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r1b1 = b1 < a1;
>r1b1 : boolean
>b1 < a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r1b1 = b2 < a2;
>r1b1 : boolean
>b2 < a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r1b1 = b3 < a3;
>r1b1 : boolean
>b3 < a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r1b1 = b4 < a4;
>r1b1 : boolean
>b4 < a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator >
var r2a1 = a1 > b1;
>r2a1 : boolean
>a1 > b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r2a1 = a2 > b2;
>r2a1 : boolean
>a2 > b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r2a1 = a3 > b3;
>r2a1 : boolean
>a3 > b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r2a1 = a4 > b4;
>r2a1 : boolean
>a4 > b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r2b1 = b1 > a1;
>r2b1 : boolean
>b1 > a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r2b1 = b2 > a2;
>r2b1 : boolean
>b2 > a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r2b1 = b3 > a3;
>r2b1 : boolean
>b3 > a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r2b1 = b4 > a4;
>r2b1 : boolean
>b4 > a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator <=
var r3a1 = a1 <= b1;
>r3a1 : boolean
>a1 <= b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r3a1 = a2 <= b2;
>r3a1 : boolean
>a2 <= b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r3a1 = a3 <= b3;
>r3a1 : boolean
>a3 <= b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r3a1 = a4 <= b4;
>r3a1 : boolean
>a4 <= b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r3b1 = b1 <= a1;
>r3b1 : boolean
>b1 <= a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r3b1 = b2 <= a2;
>r3b1 : boolean
>b2 <= a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r3b1 = b3 <= a3;
>r3b1 : boolean
>b3 <= a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r3b1 = b4 <= a4;
>r3b1 : boolean
>b4 <= a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator >=
var r4a1 = a1 >= b1;
>r4a1 : boolean
>a1 >= b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r4a1 = a2 >= b2;
>r4a1 : boolean
>a2 >= b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r4a1 = a3 >= b3;
>r4a1 : boolean
>a3 >= b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r4a1 = a4 >= b4;
>r4a1 : boolean
>a4 >= b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r4b1 = b1 >= a1;
>r4b1 : boolean
>b1 >= a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r4b1 = b2 >= a2;
>r4b1 : boolean
>b2 >= a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r4b1 = b3 >= a3;
>r4b1 : boolean
>b3 >= a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r4b1 = b4 >= a4;
>r4b1 : boolean
>b4 >= a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator ==
var r5a1 = a1 == b1;
>r5a1 : boolean
>a1 == b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r5a1 = a2 == b2;
>r5a1 : boolean
>a2 == b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r5a1 = a3 == b3;
>r5a1 : boolean
>a3 == b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r5a1 = a4 == b4;
>r5a1 : boolean
>a4 == b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r5b1 = b1 == a1;
>r5b1 : boolean
>b1 == a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r5b1 = b2 == a2;
>r5b1 : boolean
>b2 == a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r5b1 = b3 == a3;
>r5b1 : boolean
>b3 == a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r5b1 = b4 == a4;
>r5b1 : boolean
>b4 == a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator !=
var r6a1 = a1 != b1;
>r6a1 : boolean
>a1 != b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r6a1 = a2 != b2;
>r6a1 : boolean
>a2 != b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r6a1 = a3 != b3;
>r6a1 : boolean
>a3 != b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r6a1 = a4 != b4;
>r6a1 : boolean
>a4 != b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r6b1 = b1 != a1;
>r6b1 : boolean
>b1 != a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r6b1 = b2 != a2;
>r6b1 : boolean
>b2 != a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r6b1 = b3 != a3;
>r6b1 : boolean
>b3 != a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r6b1 = b4 != a4;
>r6b1 : boolean
>b4 != a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator ===
var r7a1 = a1 === b1;
>r7a1 : boolean
>a1 === b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r7a1 = a2 === b2;
>r7a1 : boolean
>a2 === b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r7a1 = a3 === b3;
>r7a1 : boolean
>a3 === b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r7a1 = a4 === b4;
>r7a1 : boolean
>a4 === b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r7b1 = b1 === a1;
>r7b1 : boolean
>b1 === a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r7b1 = b2 === a2;
>r7b1 : boolean
>b2 === a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r7b1 = b3 === a3;
>r7b1 : boolean
>b3 === a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r7b1 = b4 === a4;
>r7b1 : boolean
>b4 === a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }
// operator !==
var r8a1 = a1 !== b1;
>r8a1 : boolean
>a1 !== b1 : boolean
>a1 : { [x: string]: string; }
>b1 : { [x: string]: string; }
>a1 : { [a: string]: string; }
>b1 : { [b: string]: string; }
var r8a1 = a2 !== b2;
>r8a1 : boolean
>a2 !== b2 : boolean
>a2 : { [x: string]: Base; }
>b2 : { [x: string]: Derived; }
>a2 : { [index: string]: Base; }
>b2 : { [index: string]: Derived; }
var r8a1 = a3 !== b3;
>r8a1 : boolean
>a3 !== b3 : boolean
>a3 : { [x: number]: string; }
>b3 : { [x: number]: string; }
>a3 : { [index: number]: string; }
>b3 : { [index: number]: string; }
var r8a1 = a4 !== b4;
>r8a1 : boolean
>a4 !== b4 : boolean
>a4 : { [x: number]: Base; }
>b4 : { [x: string]: Derived; }
>a4 : { [index: number]: Base; }
>b4 : { [index: string]: Derived; }
var r8b1 = b1 !== a1;
>r8b1 : boolean
>b1 !== a1 : boolean
>b1 : { [x: string]: string; }
>a1 : { [x: string]: string; }
>b1 : { [b: string]: string; }
>a1 : { [a: string]: string; }
var r8b1 = b2 !== a2;
>r8b1 : boolean
>b2 !== a2 : boolean
>b2 : { [x: string]: Derived; }
>a2 : { [x: string]: Base; }
>b2 : { [index: string]: Derived; }
>a2 : { [index: string]: Base; }
var r8b1 = b3 !== a3;
>r8b1 : boolean
>b3 !== a3 : boolean
>b3 : { [x: number]: string; }
>a3 : { [x: number]: string; }
>b3 : { [index: number]: string; }
>a3 : { [index: number]: string; }
var r8b1 = b4 !== a4;
>r8b1 : boolean
>b4 !== a4 : boolean
>b4 : { [x: string]: Derived; }
>a4 : { [x: number]: Base; }
>b4 : { [index: string]: Derived; }
>a4 : { [index: number]: Base; }

View file

@ -3,7 +3,7 @@ var x: any;
>x : any
var obj: { [s: string]: number } = { p: "", q: x };
>obj : { [x: string]: number; }
>obj : { [s: string]: number; }
>s : string
>{ p: "", q: x } : { [x: string]: any; p: string; q: any; }
>p : string

View file

@ -1,6 +1,6 @@
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 '{ [x: string]: 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; }'.
==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ====
@ -18,4 +18,4 @@ tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Ar
f(obj1); // Ok
f(obj2); // Error - indexer doesn't match
~~~~
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [x: string]: string; }'.
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.

View file

@ -17,7 +17,7 @@ module m {
// Object literal with everything
var x: {
>x : { (a: number): c; (a: string): g<string>; new (a: number): c; new (a: string): m.c; [x: string]: c; [x: number]: c; a: c; b: g<string>; m1(): g<number>; m2(a: string, b?: number, ...c: c[]): string; }
>x : { (a: number): c; (a: string): g<string>; new (a: number): c; new (a: string): m.c; [n: string]: c; [n: number]: c; a: c; b: g<string>; m1(): g<number>; m2(a: string, b?: number, ...c: c[]): string; }
// Call signatures
(a: number): c;

View file

@ -22,7 +22,7 @@ var moduleATyped: IHasVisualizationModel = moduleA;
>moduleA : typeof moduleA
var moduleMap: { [key: string]: IHasVisualizationModel } = {
>moduleMap : { [x: string]: IHasVisualizationModel; }
>moduleMap : { [key: string]: IHasVisualizationModel; }
>key : string
>IHasVisualizationModel : IHasVisualizationModel
>{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: typeof moduleA; "moduleA": typeof moduleA; "moduleB": typeof moduleB; }
@ -42,7 +42,7 @@ var visModel = new moduleMap[moduleName].VisualizationModel();
>new moduleMap[moduleName].VisualizationModel() : Backbone.Model
>moduleMap[moduleName].VisualizationModel : typeof Backbone.Model
>moduleMap[moduleName] : IHasVisualizationModel
>moduleMap : { [x: string]: IHasVisualizationModel; }
>moduleMap : { [key: string]: IHasVisualizationModel; }
>moduleName : string
>VisualizationModel : typeof Backbone.Model

View file

@ -97,7 +97,7 @@ var x8: Array<Base> = [d1, d2];
>d2 : Derived2
var x9: { [n: number]: Base; } = [d1, d2];
>x9 : { [x: number]: Base; }
>x9 : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -210,7 +210,7 @@ class x20 { member: Array<Base> = [d1, d2] }
class x21 { member: { [n: number]: Base; } = [d1, d2] }
>x21 : x21
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -326,7 +326,7 @@ class x32 { private member: Array<Base> = [d1, d2] }
class x33 { private member: { [n: number]: Base; } = [d1, d2] }
>x33 : x33
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -442,7 +442,7 @@ class x44 { public member: Array<Base> = [d1, d2] }
class x45 { public member: { [n: number]: Base; } = [d1, d2] }
>x45 : x45
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -558,7 +558,7 @@ class x56 { static member: Array<Base> = [d1, d2] }
class x57 { static member: { [n: number]: Base; } = [d1, d2] }
>x57 : x57
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -674,7 +674,7 @@ class x68 { private static member: Array<Base> = [d1, d2] }
class x69 { private static member: { [n: number]: Base; } = [d1, d2] }
>x69 : x69
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -790,7 +790,7 @@ class x80 { public static member: Array<Base> = [d1, d2] }
class x81 { public static member: { [n: number]: Base; } = [d1, d2] }
>x81 : x81
>member : { [x: number]: Base; }
>member : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -906,7 +906,7 @@ class x92 { constructor(parm: Array<Base> = [d1, d2]) { } }
class x93 { constructor(parm: { [n: number]: Base; } = [d1, d2]) { } }
>x93 : x93
>parm : { [x: number]: Base; }
>parm : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1022,7 +1022,7 @@ class x104 { constructor(public parm: Array<Base> = [d1, d2]) { } }
class x105 { constructor(public parm: { [n: number]: Base; } = [d1, d2]) { } }
>x105 : x105
>parm : { [x: number]: Base; }
>parm : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1138,7 +1138,7 @@ class x116 { constructor(private parm: Array<Base> = [d1, d2]) { } }
class x117 { constructor(private parm: { [n: number]: Base; } = [d1, d2]) { } }
>x117 : x117
>parm : { [x: number]: Base; }
>parm : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1253,8 +1253,8 @@ function x128(parm: Array<Base> = [d1, d2]) { }
>d2 : Derived2
function x129(parm: { [n: number]: Base; } = [d1, d2]) { }
>x129 : (parm?: { [x: number]: Base; }) => void
>parm : { [x: number]: Base; }
>x129 : (parm?: { [n: number]: Base; }) => void
>parm : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1361,7 +1361,7 @@ function x140(): Array<Base> { return [d1, d2]; }
>d2 : Derived2
function x141(): { [n: number]: Base; } { return [d1, d2]; }
>x141 : () => { [x: number]: Base; }
>x141 : () => { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1497,7 +1497,7 @@ function x152(): Array<Base> { return [d1, d2]; return [d1, d2]; }
>d2 : Derived2
function x153(): { [n: number]: Base; } { return [d1, d2]; return [d1, d2]; }
>x153 : () => { [x: number]: Base; }
>x153 : () => { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1628,7 +1628,7 @@ var x164: () => Array<Base> = () => { return [d1, d2]; };
>d2 : Derived2
var x165: () => { [n: number]: Base; } = () => { return [d1, d2]; };
>x165 : () => { [x: number]: Base; }
>x165 : () => { [n: number]: Base; }
>n : number
>Base : Base
>() => { return [d1, d2]; } : () => (Derived1 | Derived2)[]
@ -1744,7 +1744,7 @@ var x176: () => Array<Base> = function() { return [d1, d2]; };
>d2 : Derived2
var x177: () => { [n: number]: Base; } = function() { return [d1, d2]; };
>x177 : () => { [x: number]: Base; }
>x177 : () => { [n: number]: Base; }
>n : number
>Base : Base
>function() { return [d1, d2]; } : () => (Derived1 | Derived2)[]
@ -1861,7 +1861,7 @@ module x188 { var t: Array<Base> = [d1, d2]; }
module x189 { var t: { [n: number]: Base; } = [d1, d2]; }
>x189 : typeof x189
>t : { [x: number]: Base; }
>t : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -1977,7 +1977,7 @@ module x200 { export var t: Array<Base> = [d1, d2]; }
module x201 { export var t: { [n: number]: Base; } = [d1, d2]; }
>x201 : typeof x201
>t : { [x: number]: Base; }
>t : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -2074,8 +2074,8 @@ var x212 = <Array<Base>>[d1, d2];
>d2 : Derived2
var x213 = <{ [n: number]: Base; }>[d1, d2];
>x213 : { [x: number]: Base; }
><{ [n: number]: Base; }>[d1, d2] : { [x: number]: Base; }
>x213 : { [n: number]: Base; }
><{ [n: number]: Base; }>[d1, d2] : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] : (Derived1 | Derived2)[]
@ -2180,10 +2180,10 @@ var x222 = (<Array<Base>>undefined) || [d1, d2];
>d2 : Derived2
var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2];
>x223 : { [x: number]: Base; }
>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [x: number]: Base; }
>(<{ [n: number]: Base; }>undefined) : { [x: number]: Base; }
><{ [n: number]: Base; }>undefined : { [x: number]: Base; }
>x223 : { [n: number]: Base; }
>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; }
>(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; }
><{ [n: number]: Base; }>undefined : { [n: number]: Base; }
>n : number
>Base : Base
>undefined : undefined
@ -2287,11 +2287,11 @@ var x232: Array<Base>; x232 = [d1, d2];
>d2 : Derived2
var x233: { [n: number]: Base; }; x233 = [d1, d2];
>x233 : { [x: number]: Base; }
>x233 : { [n: number]: Base; }
>n : number
>Base : Base
>x233 = [d1, d2] : (Derived1 | Derived2)[]
>x233 : { [x: number]: Base; }
>x233 : { [n: number]: Base; }
>[d1, d2] : (Derived1 | Derived2)[]
>d1 : Derived1
>d2 : Derived2
@ -2423,8 +2423,8 @@ var x244: { n: Array<Base>; } = { n: [d1, d2] };
>d2 : Derived2
var x245: { n: { [n: number]: Base; }; } = { n: [d1, d2] };
>x245 : { n: { [x: number]: Base; }; }
>n : { [x: number]: Base; }
>x245 : { n: { [n: number]: Base; }; }
>n : { [n: number]: Base; }
>n : number
>Base : Base
>{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; }
@ -2519,7 +2519,7 @@ var x256: Array<Base>[] = [[d1, d2]];
>d2 : Derived2
var x257: { [n: number]: Base; }[] = [[d1, d2]];
>x257 : { [x: number]: Base; }[]
>x257 : { [n: number]: Base; }[]
>n : number
>Base : Base
>[[d1, d2]] : (Derived1 | Derived2)[][]
@ -2613,7 +2613,7 @@ var x266: Array<Base> = [d1, d2] || undefined;
>undefined : undefined
var x267: { [n: number]: Base; } = [d1, d2] || undefined;
>x267 : { [x: number]: Base; }
>x267 : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] || undefined : (Derived1 | Derived2)[]
@ -2696,7 +2696,7 @@ var x274: Array<Base> = undefined || [d1, d2];
>d2 : Derived2
var x275: { [n: number]: Base; } = undefined || [d1, d2];
>x275 : { [x: number]: Base; }
>x275 : { [n: number]: Base; }
>n : number
>Base : Base
>undefined || [d1, d2] : (Derived1 | Derived2)[]
@ -2797,7 +2797,7 @@ var x282: Array<Base> = [d1, d2] || [d1, d2];
>d2 : Derived2
var x283: { [n: number]: Base; } = [d1, d2] || [d1, d2];
>x283 : { [x: number]: Base; }
>x283 : { [n: number]: Base; }
>n : number
>Base : Base
>[d1, d2] || [d1, d2] : (Derived1 | Derived2)[]
@ -2930,7 +2930,7 @@ var x292: Array<Base> = true ? [d1, d2] : [d1, d2];
>d2 : Derived2
var x293: { [n: number]: Base; } = true ? [d1, d2] : [d1, d2];
>x293 : { [x: number]: Base; }
>x293 : { [n: number]: Base; }
>n : number
>Base : Base
>true ? [d1, d2] : [d1, d2] : (Derived1 | Derived2)[]
@ -3073,7 +3073,7 @@ var x304: Array<Base> = true ? undefined : [d1, d2];
>d2 : Derived2
var x305: { [n: number]: Base; } = true ? undefined : [d1, d2];
>x305 : { [x: number]: Base; }
>x305 : { [n: number]: Base; }
>n : number
>Base : Base
>true ? undefined : [d1, d2] : (Derived1 | Derived2)[]
@ -3201,7 +3201,7 @@ var x316: Array<Base> = true ? [d1, d2] : undefined;
>undefined : undefined
var x317: { [n: number]: Base; } = true ? [d1, d2] : undefined;
>x317 : { [x: number]: Base; }
>x317 : { [n: number]: Base; }
>n : number
>Base : Base
>true ? [d1, d2] : undefined : (Derived1 | Derived2)[]
@ -3337,12 +3337,12 @@ function x328(n: Array<Base>) { }; x328([d1, d2]);
>d2 : Derived2
function x329(n: { [n: number]: Base; }) { }; x329([d1, d2]);
>x329 : (n: { [x: number]: Base; }) => void
>n : { [x: number]: Base; }
>x329 : (n: { [n: number]: Base; }) => void
>n : { [n: number]: Base; }
>n : number
>Base : Base
>x329([d1, d2]) : void
>x329 : (n: { [x: number]: Base; }) => void
>x329 : (n: { [n: number]: Base; }) => void
>[d1, d2] : (Derived1 | Derived2)[]
>d1 : Derived1
>d2 : Derived2
@ -3493,14 +3493,14 @@ var x340 = (n: Array<Base>) => n; x340([d1, d2]);
>d2 : Derived2
var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]);
>x341 : (n: { [x: number]: Base; }) => { [x: number]: Base; }
>(n: { [n: number]: Base; }) => n : (n: { [x: number]: Base; }) => { [x: number]: Base; }
>n : { [x: number]: Base; }
>x341 : (n: { [n: number]: Base; }) => { [n: number]: Base; }
>(n: { [n: number]: Base; }) => n : (n: { [n: number]: Base; }) => { [n: number]: Base; }
>n : { [n: number]: Base; }
>n : number
>Base : Base
>n : { [x: number]: Base; }
>x341([d1, d2]) : { [x: number]: Base; }
>x341 : (n: { [x: number]: Base; }) => { [x: number]: Base; }
>n : { [n: number]: Base; }
>x341([d1, d2]) : { [n: number]: Base; }
>x341 : (n: { [n: number]: Base; }) => { [n: number]: Base; }
>[d1, d2] : (Derived1 | Derived2)[]
>d1 : Derived1
>d2 : Derived2
@ -3649,13 +3649,13 @@ var x352 = function(n: Array<Base>) { }; x352([d1, d2]);
>d2 : Derived2
var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]);
>x353 : (n: { [x: number]: Base; }) => void
>function(n: { [n: number]: Base; }) { } : (n: { [x: number]: Base; }) => void
>n : { [x: number]: Base; }
>x353 : (n: { [n: number]: Base; }) => void
>function(n: { [n: number]: Base; }) { } : (n: { [n: number]: Base; }) => void
>n : { [n: number]: Base; }
>n : number
>Base : Base
>x353([d1, d2]) : void
>x353 : (n: { [x: number]: Base; }) => void
>x353 : (n: { [n: number]: Base; }) => void
>[d1, d2] : (Derived1 | Derived2)[]
>d1 : Derived1
>d2 : Derived2

View file

@ -8,16 +8,16 @@ class BaseCollection2<TItem extends CollectionItem2> {
>CollectionItem2 : CollectionItem2
_itemsByKey: { [key: string]: TItem; };
>_itemsByKey : { [x: string]: TItem; }
>_itemsByKey : { [key: string]: TItem; }
>key : string
>TItem : TItem
constructor() {
this._itemsByKey = {};
>this._itemsByKey = {} : { [x: string]: undefined; }
>this._itemsByKey : { [x: string]: TItem; }
>this._itemsByKey : { [key: string]: TItem; }
>this : BaseCollection2<TItem>
>_itemsByKey : { [x: string]: TItem; }
>_itemsByKey : { [key: string]: TItem; }
>{} : { [x: string]: undefined; }
}
}
@ -35,9 +35,9 @@ class DataView2 extends BaseCollection2<CollectionItem2> {
this._itemsByKey['dummy'] = item;
>this._itemsByKey['dummy'] = item : CollectionItem2
>this._itemsByKey['dummy'] : CollectionItem2
>this._itemsByKey : { [x: string]: CollectionItem2; }
>this._itemsByKey : { [key: string]: CollectionItem2; }
>this : DataView2
>_itemsByKey : { [x: string]: CollectionItem2; }
>_itemsByKey : { [key: string]: CollectionItem2; }
>item : CollectionItem2
}
}

View file

@ -4,19 +4,19 @@ class LazyArray<T> {
>T : T
private objects = <{ [objectId: string]: T; }>{};
>objects : { [x: string]: T; }
><{ [objectId: string]: T; }>{} : { [x: string]: T; }
>objects : { [objectId: string]: T; }
><{ [objectId: string]: T; }>{} : { [objectId: string]: T; }
>objectId : string
>T : T
>{} : { [x: string]: undefined; }
array() {
>array : () => { [x: string]: T; }
>array : () => { [objectId: string]: T; }
return this.objects;
>this.objects : { [x: string]: T; }
>this.objects : { [objectId: string]: T; }
>this : LazyArray<T>
>objects : { [x: string]: T; }
>objects : { [objectId: string]: T; }
}
}
var lazyArray = new LazyArray<string>();
@ -27,8 +27,8 @@ var lazyArray = new LazyArray<string>();
var value: string = lazyArray.array()["test"]; // used to be an error
>value : string
>lazyArray.array()["test"] : string
>lazyArray.array() : { [x: string]: string; }
>lazyArray.array : () => { [x: string]: string; }
>lazyArray.array() : { [objectId: string]: string; }
>lazyArray.array : () => { [objectId: string]: string; }
>lazyArray : LazyArray<string>
>array : () => { [x: string]: string; }
>array : () => { [objectId: string]: string; }

View file

@ -5,7 +5,7 @@ export class Collection<TItem extends CollectionItem> {
>CollectionItem : CollectionItem
_itemsByKey: { [key: string]: TItem; };
>_itemsByKey : { [x: string]: TItem; }
>_itemsByKey : { [key: string]: TItem; }
>key : string
>TItem : TItem
}

View file

@ -1,17 +1,17 @@
=== tests/cases/compiler/indexSignaturesInferentialTyping.ts ===
function foo<T>(items: { [index: number]: T }): T { return undefined; }
>foo : <T>(items: { [x: number]: T; }) => T
>foo : <T>(items: { [index: number]: T; }) => T
>T : T
>items : { [x: number]: T; }
>items : { [index: number]: T; }
>index : number
>T : T
>T : T
>undefined : undefined
function bar<T>(items: { [index: string]: T }): T { return undefined; }
>bar : <T>(items: { [x: string]: T; }) => T
>bar : <T>(items: { [index: string]: T; }) => T
>T : T
>items : { [x: string]: T; }
>items : { [index: string]: T; }
>index : string
>T : T
>T : T
@ -20,13 +20,13 @@ function bar<T>(items: { [index: string]: T }): T { return undefined; }
var x1 = foo({ 0: 0, 1: 1 }); // type should be number
>x1 : number
>foo({ 0: 0, 1: 1 }) : number
>foo : <T>(items: { [x: number]: T; }) => T
>foo : <T>(items: { [index: number]: T; }) => T
>{ 0: 0, 1: 1 } : { [x: number]: number; 0: number; 1: number; }
var x2 = foo({ zero: 0, one: 1 });
>x2 : any
>foo({ zero: 0, one: 1 }) : any
>foo : <T>(items: { [x: number]: T; }) => T
>foo : <T>(items: { [index: number]: T; }) => T
>{ zero: 0, one: 1 } : { [x: number]: undefined; zero: number; one: number; }
>zero : number
>one : number
@ -34,13 +34,13 @@ var x2 = foo({ zero: 0, one: 1 });
var x3 = bar({ 0: 0, 1: 1 });
>x3 : number
>bar({ 0: 0, 1: 1 }) : number
>bar : <T>(items: { [x: string]: T; }) => T
>bar : <T>(items: { [index: string]: T; }) => T
>{ 0: 0, 1: 1 } : { [x: string]: number; 0: number; 1: number; }
var x4 = bar({ zero: 0, one: 1 }); // type should be number
>x4 : number
>bar({ zero: 0, one: 1 }) : number
>bar : <T>(items: { [x: string]: T; }) => T
>bar : <T>(items: { [index: string]: T; }) => T
>{ zero: 0, one: 1 } : { [x: string]: number; zero: number; one: number; }
>zero : number
>one : number

View file

@ -1,8 +1,8 @@
tests/cases/compiler/indexerAssignability.ts(5,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }'.
Index signature is missing in type '{ [x: number]: string; }'.
tests/cases/compiler/indexerAssignability.ts(6,1): error TS2322: Type '{}' is not assignable to type '{ [x: string]: string; }'.
tests/cases/compiler/indexerAssignability.ts(5,1): error TS2322: Type '{ [n: number]: string; }' is not assignable to type '{ [s: string]: string; }'.
Index signature is missing in type '{ [n: number]: string; }'.
tests/cases/compiler/indexerAssignability.ts(6,1): error TS2322: Type '{}' is not assignable to type '{ [s: string]: string; }'.
Index signature is missing in type '{}'.
tests/cases/compiler/indexerAssignability.ts(8,1): error TS2322: Type '{}' is not assignable to type '{ [x: number]: string; }'.
tests/cases/compiler/indexerAssignability.ts(8,1): error TS2322: Type '{}' is not assignable to type '{ [n: number]: string; }'.
Index signature is missing in type '{}'.
@ -13,16 +13,16 @@ tests/cases/compiler/indexerAssignability.ts(8,1): error TS2322: Type '{}' is no
a = b;
~
!!! error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2322: Index signature is missing in type '{ [x: number]: string; }'.
!!! error TS2322: Type '{ [n: number]: string; }' is not assignable to type '{ [s: string]: string; }'.
!!! error TS2322: Index signature is missing in type '{ [n: number]: string; }'.
a = c;
~
!!! error TS2322: Type '{}' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2322: Type '{}' is not assignable to type '{ [s: string]: string; }'.
!!! error TS2322: Index signature is missing in type '{}'.
b = a;
b = c;
~
!!! error TS2322: Type '{}' is not assignable to type '{ [x: number]: string; }'.
!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: string; }'.
!!! error TS2322: Index signature is missing in type '{}'.
c = a;
c = b;

View file

@ -3,7 +3,7 @@ interface f {
>f : f
groupBy<T>(): { [key: string]: T[]; };
>groupBy : <T>() => { [x: string]: T[]; }
>groupBy : <T>() => { [key: string]: T[]; }
>T : T
>key : string
>T : T
@ -13,17 +13,17 @@ var a: f;
>f : f
var r = a.groupBy();
>r : { [x: string]: {}[]; }
>a.groupBy() : { [x: string]: {}[]; }
>a.groupBy : <T>() => { [x: string]: T[]; }
>r : { [key: string]: {}[]; }
>a.groupBy() : { [key: string]: {}[]; }
>a.groupBy : <T>() => { [key: string]: T[]; }
>a : f
>groupBy : <T>() => { [x: string]: T[]; }
>groupBy : <T>() => { [key: string]: T[]; }
class c {
>c : c
groupBy<T>(): { [key: string]: T[]; } {
>groupBy : <T>() => { [x: string]: T[]; }
>groupBy : <T>() => { [key: string]: T[]; }
>T : T
>key : string
>T : T
@ -36,9 +36,9 @@ var a2: c;
>c : c
var r2 = a2.groupBy();
>r2 : { [x: string]: {}[]; }
>a2.groupBy() : { [x: string]: {}[]; }
>a2.groupBy : <T>() => { [x: string]: T[]; }
>r2 : { [key: string]: {}[]; }
>a2.groupBy() : { [key: string]: {}[]; }
>a2.groupBy : <T>() => { [key: string]: T[]; }
>a2 : c
>groupBy : <T>() => { [x: string]: T[]; }
>groupBy : <T>() => { [key: string]: T[]; }

View file

@ -4,7 +4,7 @@ function then(x) {
>x : any
var match: { [index: number]: string; }
>match : { [x: number]: string; }
>match : { [index: number]: string; }
>index : number
}

View file

@ -1,4 +1,4 @@
tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: Foo; }'.
tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'.
Index signature is missing in type '{ one: number; }'.
@ -8,5 +8,5 @@ tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ on
var a: { one: number; };
x = a;
~
!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [x: string]: Foo; }'.
!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{ one: number; }'.

View file

@ -15,7 +15,7 @@ class B extends A {
}
var x: {
>x : { [x: number]: A; }
>x : { [idx: number]: A; }
[idx: number]: A;
>idx : number

View file

@ -1,4 +1,4 @@
tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }'.
tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'.
Index signature is missing in type '{ 0: Date; name: string; }'.
@ -6,5 +6,5 @@ tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0:
var x = { name: "x", 0: new Date() };
var z: { [name: number]: string } = x;
~
!!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }'.
!!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'.
!!! error TS2322: Index signature is missing in type '{ 0: Date; name: string; }'.

View file

@ -1,4 +1,4 @@
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }'.
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
Index signatures are incompatible.
Type 'A' is not assignable to type 'B'.
@ -18,7 +18,7 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{
var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A
~~
!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }'.
!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A

View file

@ -26,7 +26,7 @@ var c: any;
>c : any
var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer is A, number indexer is B
>o1 : { [x: string]: A; [x: number]: B; }
>o1 : { [s: string]: A; [n: number]: B; }
>s : string
>A : A
>n : number
@ -38,7 +38,7 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i
o1 = { x: b, 0: c }; // both indexers are any
>o1 = { x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; }
>o1 : { [x: string]: A; [x: number]: B; }
>o1 : { [s: string]: A; [n: number]: B; }
>{ x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; }
>x : B
>b : B
@ -46,7 +46,7 @@ o1 = { x: b, 0: c }; // both indexers are any
o1 = { x: c, 0: b }; // string indexer is any, number indexer is B
>o1 = { x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; }
>o1 : { [x: string]: A; [x: number]: B; }
>o1 : { [s: string]: A; [n: number]: B; }
>{ x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; }
>x : any
>c : any

View file

@ -3,7 +3,7 @@ interface I {
>I : I
w: {
>w : { (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; }
>w : { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }
z: I;
>z : I

View file

@ -1,29 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,38): error TS1134: Variable declaration expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,60): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,70): error TS1109: Expression expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,53): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,9): error TS2304: Cannot find name '$'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,31): error TS2304: Cannot find name 'any'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,50): error TS2304: Cannot find name 'any'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,55): error TS2304: Cannot find name 'width'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,62): error TS2304: Cannot find name 'string'.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (8 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (2 errors) ====
var s = $.extend< { workItem: any }, { workItem: any, width: string }>({ workItem: this._workItem }, {});
~
!!! error TS1134: Variable declaration expected.
~
~
!!! error TS1005: ';' expected.
~
!!! error TS1109: Expression expected.
~
!!! error TS2304: Cannot find name '$'.
~~~
!!! error TS2304: Cannot find name 'any'.
~~~
!!! error TS2304: Cannot find name 'any'.
~~~~~
!!! error TS2304: Cannot find name 'width'.
~~~~~~
!!! error TS2304: Cannot find name 'string'.

View file

@ -8,7 +8,7 @@ export class FilterManager {
>IFilterProvider : IFilterProvider
private _filterProviders2: { [index: number]: IFilterProvider; };
>_filterProviders2 : { [x: number]: IFilterProvider; }
>_filterProviders2 : { [index: number]: IFilterProvider; }
>index : number
>IFilterProvider : IFilterProvider

View file

@ -135,21 +135,21 @@ var j2 = new j2(j2);
// Indexers
var k: { [n: number]: typeof k;[s: string]: typeof k };
>k : { [x: string]: any; [x: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>n : number
>k : { [x: string]: any; [x: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>s : string
>k : { [x: string]: any; [x: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
var k = k[0];
>k : { [x: string]: any; [x: number]: any; }
>k[0] : { [x: string]: any; [x: number]: any; }
>k : { [x: string]: any; [x: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>k[0] : { [s: string]: any; [n: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
var k = k[''];
>k : { [x: string]: any; [x: number]: any; }
>k[''] : { [x: string]: any; [x: number]: any; }
>k : { [x: string]: any; [x: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>k[''] : { [s: string]: any; [n: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
// Hybrid - contains type literals as well as type arguments
// These two are recursive

View file

@ -1,6 +1,6 @@
tests/cases/compiler/stringIndexerAssignments1.ts(4,1): error TS2322: Type '{ one: string; }' is not assignable to type '{ [x: string]: string; one: string; }'.
tests/cases/compiler/stringIndexerAssignments1.ts(4,1): error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
Index signature is missing in type '{ one: string; }'.
tests/cases/compiler/stringIndexerAssignments1.ts(5,1): error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [x: string]: string; one: string; }'.
tests/cases/compiler/stringIndexerAssignments1.ts(5,1): error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'string'.
@ -11,11 +11,11 @@ tests/cases/compiler/stringIndexerAssignments1.ts(5,1): error TS2322: Type '{ on
var b: { one: number; two: string; };
x = a;
~
!!! error TS2322: Type '{ one: string; }' is not assignable to type '{ [x: string]: string; one: string; }'.
!!! error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
!!! error TS2322: Index signature is missing in type '{ one: string; }'.
x = b; // error
~
!!! error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [x: string]: string; one: string; }'.
!!! error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
!!! error TS2322: Types of property 'one' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.

View file

@ -10,7 +10,7 @@ tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type 'number' is not assi
tests/cases/compiler/typeName1.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'.
Property 'z' is missing in type 'Number'.
tests/cases/compiler/typeName1.ts(15,5): error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'.
tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type 'number' is not assignable to type '{ (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; }'.
tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'.
Property 'z' is missing in type 'Number'.
tests/cases/compiler/typeName1.ts(16,10): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'.
tests/cases/compiler/typeName1.ts(17,5): error TS2322: Type 'number' is not assignable to type 'I'.
@ -19,7 +19,7 @@ tests/cases/compiler/typeName1.ts(18,5): error TS2322: Type 'number' is not assi
Property 'length' is missing in type 'Number'.
tests/cases/compiler/typeName1.ts(19,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; }[][]'.
Property 'length' is missing in type 'Number'.
tests/cases/compiler/typeName1.ts(20,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; }; }[][]'.
tests/cases/compiler/typeName1.ts(20,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'.
Property 'length' is missing in type 'Number'.
tests/cases/compiler/typeName1.ts(20,50): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'.
tests/cases/compiler/typeName1.ts(21,5): error TS2322: Type 'number' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'.
@ -66,7 +66,7 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as
!!! error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'.
var x8:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; }=3;
~~
!!! error TS2322: Type 'number' is not assignable to type '{ (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; }'.
!!! error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'.
!!! error TS2322: Property 'z' is missing in type 'Number'.
~~~~
!!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'.
@ -84,7 +84,7 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as
!!! error TS2322: Property 'length' is missing in type 'Number'.
var x12:{z:I;x:boolean;y:(s:string)=>boolean;w:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; };}[][]=3;
~~~
!!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [x: string]: { x: any; y: any; }; [x: number]: { x: any; y: any; }; z: I; }; }[][]'.
!!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'.
!!! error TS2322: Property 'length' is missing in type 'Number'.
~~~~
!!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'.

View file

@ -10,7 +10,7 @@ var anyVar: number;
// U has a string index signature of a union type of the types of the string index signatures from each type in U.
var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; };
>unionOfDifferentReturnType : { [x: string]: number; } | { [x: string]: Date; }
>unionOfDifferentReturnType : { [a: string]: number; } | { [a: string]: Date; }
>a : string
>a : string
>Date : Date
@ -19,34 +19,34 @@ numOrDate = unionOfDifferentReturnType["hello"]; // number | Date
>numOrDate = unionOfDifferentReturnType["hello"] : number | Date
>numOrDate : number | Date
>unionOfDifferentReturnType["hello"] : number | Date
>unionOfDifferentReturnType : { [x: string]: number; } | { [x: string]: Date; }
>unionOfDifferentReturnType : { [a: string]: number; } | { [a: string]: Date; }
numOrDate = unionOfDifferentReturnType[10]; // number | Date
>numOrDate = unionOfDifferentReturnType[10] : number | Date
>numOrDate : number | Date
>unionOfDifferentReturnType[10] : number | Date
>unionOfDifferentReturnType : { [x: string]: number; } | { [x: string]: Date; }
>unionOfDifferentReturnType : { [a: string]: number; } | { [a: string]: Date; }
var unionOfTypesWithAndWithoutStringSignature: { [a: string]: number; } | boolean;
>unionOfTypesWithAndWithoutStringSignature : boolean | { [x: string]: number; }
>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; }
>a : string
anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any
>anyVar = unionOfTypesWithAndWithoutStringSignature["hello"] : any
>anyVar : number
>unionOfTypesWithAndWithoutStringSignature["hello"] : any
>unionOfTypesWithAndWithoutStringSignature : boolean | { [x: string]: number; }
>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; }
anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any
>anyVar = unionOfTypesWithAndWithoutStringSignature[10] : any
>anyVar : number
>unionOfTypesWithAndWithoutStringSignature[10] : any
>unionOfTypesWithAndWithoutStringSignature : boolean | { [x: string]: number; }
>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; }
// If each type in U has a numeric index signature,
// U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U.
var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; };
>unionOfDifferentReturnType1 : { [x: number]: number; } | { [x: number]: Date; }
>unionOfDifferentReturnType1 : { [a: number]: number; } | { [a: number]: Date; }
>a : number
>a : number
>Date : Date
@ -55,27 +55,27 @@ numOrDate = unionOfDifferentReturnType1["hello"]; // any
>numOrDate = unionOfDifferentReturnType1["hello"] : any
>numOrDate : number | Date
>unionOfDifferentReturnType1["hello"] : any
>unionOfDifferentReturnType1 : { [x: number]: number; } | { [x: number]: Date; }
>unionOfDifferentReturnType1 : { [a: number]: number; } | { [a: number]: Date; }
numOrDate = unionOfDifferentReturnType1[10]; // number | Date
>numOrDate = unionOfDifferentReturnType1[10] : number | Date
>numOrDate : number | Date
>unionOfDifferentReturnType1[10] : number | Date
>unionOfDifferentReturnType1 : { [x: number]: number; } | { [x: number]: Date; }
>unionOfDifferentReturnType1 : { [a: number]: number; } | { [a: number]: Date; }
var unionOfTypesWithAndWithoutStringSignature1: { [a: number]: number; } | boolean;
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [x: number]: number; }
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; }
>a : number
anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any
>anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"] : any
>anyVar : number
>unionOfTypesWithAndWithoutStringSignature1["hello"] : any
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [x: number]: number; }
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; }
anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any
>anyVar = unionOfTypesWithAndWithoutStringSignature1[10] : any
>anyVar : number
>unionOfTypesWithAndWithoutStringSignature1[10] : any
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [x: number]: number; }
>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; }

View file

@ -52,7 +52,7 @@ complicatedArrayVar.push({ x: 30, y : 'hello world' });
>y : string
var n1: { [s: string]: number; };
>n1 : { [x: string]: number; }
>n1 : { [s: string]: number; }
>s : string
var c : {

View file

@ -639,6 +639,10 @@ module FourSlashInterface {
return getClassification("typeParameterName", text, position);
}
export function typeAlias(text: string, position?: number): { classificationType: string; text: string; textSpan?: TextSpan } {
return getClassification("typeAlias", text, position);
}
function getClassification(type: string, text: string, position?: number) {
return {
classificationType: type,

View file

@ -0,0 +1,15 @@
/// <reference path="fourslash.ts"/>
////type /*0*/Alias = number
////var x: /*1*/Alias;
////var y = </*2*/Alias>{};
////function f(x: /*3*/Alias): /*4*/Alias { return undefined; }
var c = classification;
verify.semanticClassificationsAre(
c.typeAlias("Alias", test.marker("0").position),
c.typeAlias("Alias", test.marker("1").position),
c.typeAlias("Alias", test.marker("2").position),
c.typeAlias("Alias", test.marker("3").position),
c.typeAlias("Alias", test.marker("4").position)
);