More PR feedback

This commit is contained in:
Richard Knoll
2016-09-13 17:33:49 -07:00
parent f91a123d23
commit 4a37fd7bcf
51 changed files with 191 additions and 224 deletions

View File

@@ -1680,13 +1680,13 @@ namespace FourSlash {
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
}
public verifyImplementationsCount(negative: boolean, expectedCount: number) {
public verifyImplementationListIsEmpty(negative: boolean) {
const assertFn = negative ? assert.notEqual : assert.equal;
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
const actualCount = implementations && implementations.length || 0;
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Implementations Count"));
assertFn(actualCount, 0, this.messageAtLastKnownMarker("Implementations Count"));
}
public verifyGoToDefinitionName(expectedName: string, expectedContainerName: string) {
@@ -1697,26 +1697,22 @@ namespace FourSlash {
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
}
public goToImplementation(implIndex?: number) {
public goToImplementation() {
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (!implementations || !implementations.length) {
this.raiseError("goToImplementation failed - expected to find at least one implementation location but got 0");
}
if (implIndex === undefined && implementations.length > 1) {
this.raiseError(`goToImplementation failed - no index given but more than 1 implementation returned (${implementations.length})`);
if (implementations.length > 1) {
this.raiseError(`goToImplementation failed - more than 1 implementation returned (${implementations.length})`);
}
if (implIndex >= implementations.length) {
this.raiseError(`goToImplementation failed - implIndex value (${implIndex}) exceeds implementation list size (${implementations.length})`);
}
const implementation = implementations[implIndex || 0];
const implementation = implementations[0];
this.openFile(implementation.fileName);
this.currentCaretPosition = implementation.textSpan.start;
}
public verifyRangesInImplementationList() {
public verifyRangesInImplementationList(markerName: string) {
this.goToMarker(markerName);
const implementations: ImplementationLocationInformation[] = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (!implementations || !implementations.length) {
this.raiseError("verifyRangesInImplementationList failed - expected to find at least one implementation location but got 0");
@@ -2954,8 +2950,8 @@ namespace FourSlashInterface {
this.state.goToTypeDefinition(definitionIndex);
}
public implementation(implementationIndex?: number) {
this.state.goToImplementation(implementationIndex);
public implementation() {
this.state.goToImplementation();
}
public position(position: number, fileIndex?: number): void;
@@ -3062,8 +3058,8 @@ namespace FourSlashInterface {
this.state.verifyTypeDefinitionsCount(this.negative, expectedCount);
}
public implementationCountIs(expectedCount: number) {
this.state.verifyImplementationsCount(this.negative, expectedCount);
public implementationListIsEmpty() {
this.state.verifyImplementationListIsEmpty(this.negative);
}
public isValidBraceCompletionAtPosition(openingBrace: string) {
@@ -3319,8 +3315,8 @@ namespace FourSlashInterface {
this.state.verifyProjectInfo(expected);
}
public allRangesAppearInImplementationList() {
this.state.verifyRangesInImplementationList();
public allRangesAppearInImplementationList(markerName: string) {
this.state.verifyRangesInImplementationList(markerName);
}
}

View File

@@ -1054,13 +1054,6 @@ namespace ts {
moduleDir: string;
}
// Internal interface used for tracking state in find all references when checking
// the inheritance hierarchy of property access expressions
interface SymbolInheritanceState {
symbol: Symbol;
cachedInheritanceResults: Map<boolean>;
}
export interface DisplayPartsSymbolWriter extends SymbolWriter {
displayParts(): SymbolDisplayPart[];
}
@@ -5026,37 +5019,25 @@ namespace ts {
// the declaration of the symbol being assigned (not the symbol being assigned to).
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
const result: ReferenceEntry[] = [];
getReferenceEntryForShorthandPropertyAssignment(node, typeChecker, result);
getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result);
return result.length > 0 ? result : undefined;
}
else if (node.kind === SyntaxKind.SuperKeyword || isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
// need to "Find all References"
const symbol = typeChecker.getSymbolAtLocation(node);
if (symbol.valueDeclaration) {
return [getReferenceEntryFromNode(symbol.valueDeclaration)];
}
return symbol.valueDeclaration && [getReferenceEntryFromNode(symbol.valueDeclaration)];
}
else {
const entries: ImplementationLocation[] = [];
// Perform "Find all References" and retrieve only those that are implementations
const result = getReferencedSymbolsForNode(node, program.getSourceFiles(), /*findInStrings*/false, /*findInComments*/false, /*implementations*/true);
const referencedSymbols = getReferencedSymbolsForNode(node, program.getSourceFiles(), /*findInStrings*/false, /*findInComments*/false, /*implementations*/true);
forEach(result, referencedSymbol => {
if (referencedSymbol.references) {
forEach(referencedSymbol.references, entry => {
entries.push({
textSpan: entry.textSpan,
fileName: entry.fileName
});
});
}
});
return entries;
return flatMap(referencedSymbols, symbol =>
map(symbol.references, ({ textSpan, fileName }) => ({ textSpan, fileName })));
}
}
function getReferenceEntryForShorthandPropertyAssignment(node: Node, typeChecker: TypeChecker, result: ReferenceEntry[]): void {
function getReferenceEntriesForShorthandPropertyAssignment(node: Node, typeChecker: TypeChecker, result: ReferenceEntry[]): void {
const refSymbol = typeChecker.getSymbolAtLocation(node);
const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration);
@@ -5069,25 +5050,26 @@ namespace ts {
}
}
function isNameOfImplementation(node: Node): boolean {
const parent = node.parent;
if (isDeclarationName(node)) {
if (isVariableLike(parent)) {
if (parent.kind === SyntaxKind.VariableDeclaration) {
const parentStatement = parent.parent && parent.parent.parent;
if (parentStatement && hasModifier(parentStatement, ModifierFlags.Ambient)) {
return true;
}
function isImplementation(node: Node): boolean {
if (!node) {
return false;
}
else if (isVariableLike(node)) {
if (node.initializer) {
return true;
}
else if (node.kind === SyntaxKind.VariableDeclaration) {
const parentStatement = getParentStatementOfVariableDeclaration(<VariableDeclaration>node);
if (parentStatement && hasModifier(parentStatement, ModifierFlags.Ambient)) {
return true;
}
return !!parent.initializer;
}
else if (isFunctionLike(parent)) {
return !!parent.body || hasModifier(parent, ModifierFlags.Ambient);
}
switch (parent.kind) {
case SyntaxKind.PropertyAssignment:
}
else if (isFunctionLike(node)) {
return !!node.body || hasModifier(node, ModifierFlags.Ambient);
}
else {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.EnumDeclaration:
@@ -5095,12 +5077,12 @@ namespace ts {
return true;
}
}
return false;
}
function isTypeAssertionExpression(node: Node): node is TypeAssertion {
return node.kind === SyntaxKind.TypeAssertionExpression;
function getParentStatementOfVariableDeclaration(node: VariableDeclaration): VariableStatement {
return node.parent && node.parent.kind === SyntaxKind.VariableDeclarationList && node.parent.parent
&& node.parent.parent.kind === SyntaxKind.VariableStatement && <VariableStatement>node.parent.parent;
}
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
@@ -6197,24 +6179,8 @@ namespace ts {
const start = findInComments ? container.getFullStart() : container.getStart();
const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());
// If we are just looking for implementations and this is a property access expression, we need to get the
// symbol of the local type of the symbol the property is being accessed on. This is because our search
// symbol may have a different parent symbol if the local type's symbol does not declare the property
// being accessed (i.e. it is declared in some parent class or interface)
let parents: Symbol[];
const cache: Map<boolean> = createMap<boolean>();
if (implementations && isRightSideOfPropertyAccess(searchLocation)) {
const localParentType = typeChecker.getTypeAtLocation((<PropertyAccessExpression>searchLocation.parent).expression);
if (localParentType) {
if (localParentType.symbol && localParentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== searchSymbol.parent) {
parents = [localParentType.symbol];
}
else if (localParentType.getFlags() & TypeFlags.UnionOrIntersection) {
parents = getSymbolsForComponentTypes(<UnionOrIntersectionType>localParentType);
}
}
}
const parents = getParentSymbolsOfPropertyAccess();
const inheritsFromCache: Map<boolean> = createMap<boolean>();
if (possiblePositions.length) {
// Build the set of symbols to search for, initially it has only the current symbol
@@ -6257,7 +6223,7 @@ namespace ts {
const referenceSymbolDeclaration = referenceSymbol.valueDeclaration;
const shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
const relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation,
/*searchLocationIsConstructor*/ searchLocation.kind === SyntaxKind.ConstructorKeyword, parents, cache);
/*searchLocationIsConstructor*/ searchLocation.kind === SyntaxKind.ConstructorKeyword, parents, inheritsFromCache);
if (relatedSymbol) {
addReferenceToRelatedSymbol(referenceLocation, relatedSymbol);
@@ -6279,6 +6245,32 @@ namespace ts {
}
return;
/* If we are just looking for implementations and this is a property access expression, we need to get the
* symbol of the local type of the symbol the property is being accessed on. This is because our search
* symbol may have a different parent symbol if the local type's symbol does not declare the property
* being accessed (i.e. it is declared in some parent class or interface)
*/
function getParentSymbolsOfPropertyAccess(): Symbol[] | undefined {
if (implementations) {
const propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation);
if (propertyAccessExpression) {
const localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression);
if (localParentType) {
if (localParentType.symbol && localParentType.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== searchSymbol.parent) {
return [localParentType.symbol];
}
else if (localParentType.flags & TypeFlags.UnionOrIntersection) {
return getSymbolsForClassAndInterfaceComponents(<UnionOrIntersectionType>localParentType);
}
}
}
}
}
function getPropertyAccessExpressionFromRightHandSide(node: Node): PropertyAccessExpression {
return isRightSideOfPropertyAccess(node) && <PropertyAccessExpression>node.parent;
}
/** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */
function findAdditionalConstructorReferences(referenceSymbol: Symbol, referenceLocation: Node): void {
Debug.assert(isClassLike(searchSymbol.valueDeclaration));
@@ -6387,19 +6379,19 @@ namespace ts {
function getImplementationReferenceEntryForNode(refNode: Node, result: ReferenceEntry[]): void {
// Check if we found a function/propertyAssignment/method with an implementation or initializer
if (isNameOfImplementation(<Identifier>refNode)) {
if (isDeclarationName(refNode) && isImplementation(refNode.parent)) {
result.push(getReferenceEntryFromNode(refNode.parent));
}
else if (refNode.kind === SyntaxKind.Identifier) {
if (refNode.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntryForShorthandPropertyAssignment(refNode, typeChecker, result);
getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result);
}
// Check if the node is within an extends or implements clause
const containingHeritageClause = getContainingClassHeritageClause(refNode);
if (containingHeritageClause) {
result.push(getReferenceEntryFromNode(containingHeritageClause.parent));
const containingClass = getContainingClassIfInHeritageClause(refNode);
if (containingClass) {
result.push(getReferenceEntryFromNode(containingClass));
return;
}
@@ -6410,14 +6402,19 @@ namespace ts {
if (isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) {
maybeAdd(getReferenceEntryFromNode(parent.initializer));
}
else if (isFunctionLike(parent) && parent.type === containingTypeReference && parent.body && parent.body.kind === SyntaxKind.Block) {
forEachReturnStatement(<Block>parent.body, (returnStatement) => {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
else if (isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) {
if (parent.body.kind === SyntaxKind.Block) {
forEachReturnStatement(<Block>parent.body, returnStatement => {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
else if (isImplementationExpression(<Expression>parent.body)) {
maybeAdd(getReferenceEntryFromNode(parent.body));
}
}
else if (isTypeAssertionExpression(parent) && isImplementationExpression(parent.expression)) {
else if (isAssertionExpression(parent) && isImplementationExpression(parent.expression)) {
maybeAdd(getReferenceEntryFromNode(parent.expression));
}
}
@@ -6435,13 +6432,13 @@ namespace ts {
}
}
function getSymbolsForComponentTypes(type: UnionOrIntersectionType, result: Symbol[] = []): Symbol[] {
function getSymbolsForClassAndInterfaceComponents(type: UnionOrIntersectionType, result: Symbol[] = []): Symbol[] {
for (const componentType of type.types) {
if (componentType.symbol && componentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface)) {
result.push(componentType.symbol);
}
if (componentType.getFlags() & TypeFlags.UnionOrIntersection) {
getSymbolsForComponentTypes(<UnionOrIntersectionType>componentType, result);
getSymbolsForClassAndInterfaceComponents(<UnionOrIntersectionType>componentType, result);
}
}
return result;
@@ -6460,23 +6457,23 @@ namespace ts {
return topLevelTypeReference;
}
function getContainingClassHeritageClause(node: Node): HeritageClause {
if (node) {
function getContainingClassIfInHeritageClause(node: Node): ClassLikeDeclaration {
if (node && node.parent) {
if (node.kind === SyntaxKind.ExpressionWithTypeArguments
&& node.parent.kind === SyntaxKind.HeritageClause
&& isClassLike(node.parent.parent)) {
return <HeritageClause>node.parent;
return node.parent.parent;
}
else if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.PropertyAccessExpression) {
return getContainingClassHeritageClause(node.parent);
return getContainingClassIfInHeritageClause(node.parent);
}
}
return undefined;
}
/**
* Returns true if this is an expression that could be used to implement an interface.
* Returns true if this is an expression that can be considered an implementation
*/
function isImplementationExpression(node: Expression): boolean {
// Unwrap parentheses
@@ -6517,6 +6514,7 @@ namespace ts {
return cachedResults[key];
}
// Set the key so that we don't infinitely recurse
cachedResults[key] = false;
const inherits = forEach(symbol.getDeclarations(), (declaration) => {
@@ -6910,7 +6908,7 @@ namespace ts {
}
}
function getRelatedSymbol(searchSymbols: Symbol[], referenceSymbol: Symbol, referenceLocation: Node, searchLocationIsConstructor: boolean, parents: Symbol[], cache: Map<boolean>): Symbol {
function getRelatedSymbol(searchSymbols: Symbol[], referenceSymbol: Symbol, referenceLocation: Node, searchLocationIsConstructor: boolean, parents: Symbol[] | undefined, cache: Map<boolean>): Symbol {
if (contains(searchSymbols, referenceSymbol)) {
// If we are searching for constructor uses, they must be 'new' expressions.
return (!searchLocationIsConstructor || isNewExpressionTarget(referenceLocation)) && referenceSymbol;
@@ -6966,6 +6964,7 @@ namespace ts {
// see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the
// parent symbol
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
// Parents will only be defined if implementations is true
if (parents) {
if (!forEach(parents, parent => inheritsFrom(rootSymbol.parent, parent, cache))) {
return undefined;

View File

@@ -179,7 +179,7 @@ namespace ts {
/**
* Returns a JSON-encoded value of the type:
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[]
* { fileName: string; textSpan: { start: number; length: number}; }[]
*/
getImplementationAtPosition(fileName: string, position: number): string;

View File

@@ -110,7 +110,7 @@ declare namespace FourSlashInterface {
bof(): void;
eof(): void;
type(definitionIndex?: number): void;
implementation(implementationIndex?: number): void;
implementation(): void;
position(position: number, fileIndex?: number): any;
position(position: number, fileName?: string): any;
file(index: number, content?: string, scriptKindName?: string): any;
@@ -134,7 +134,7 @@ declare namespace FourSlashInterface {
quickInfoIs(expectedText?: string, expectedDocumentation?: string): void;
quickInfoExists(): void;
typeDefinitionCountIs(expectedCount: number): void;
implementationCountIs(expectedCount: number): void;
implementationListIsEmpty(): void;
isValidBraceCompletionAtPosition(openingBrace?: string): void;
}
class verify extends verifyNegatable {
@@ -242,7 +242,7 @@ declare namespace FourSlashInterface {
getSyntacticDiagnostics(expected: string): void;
getSemanticDiagnostics(expected: string): void;
ProjectInfo(expected: string[]): void;
allRangesAppearInImplementationList(): void;
allRangesAppearInImplementationList(markerName: string): void;
}
class edit {
backspace(count?: number): void;

View File

@@ -8,5 +8,4 @@
////
//// new Bar().hel/*reference*/lo;
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -14,8 +14,5 @@
//// x.he/*reference*/llo();
//// }
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
goTo.marker("declaration");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");
verify.allRangesAppearInImplementationList("declaration");

View File

@@ -9,5 +9,4 @@
////
//// Foo.Fo/*reference*/o1;
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -9,5 +9,4 @@
////
//// Fo/*reference*/o;
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -21,8 +21,5 @@
//// constructor(public f: Foo = { [|hello() {/**3*/}|] } ) {}
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
goTo.marker("declaration");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");
verify.allRangesAppearInImplementationList("declaration");

View File

@@ -18,8 +18,5 @@
////
//// whatever(new Bar());
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
goTo.marker("declaration");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");
verify.allRangesAppearInImplementationList("declaration");

View File

@@ -18,8 +18,5 @@
//// a.he/*function_call*/llo();
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
goTo.marker("declaration");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");
verify.allRangesAppearInImplementationList("declaration");

View File

@@ -21,5 +21,4 @@
//// new Bar().hel/*function_call*/lo();
//// new Bar()["hello"]();
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -22,5 +22,4 @@
//// x.he/*function_call*/llo()
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -34,5 +34,4 @@
//// x.he/*function_call*/llo()
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -45,5 +45,4 @@
//// x.he/*function_call*/llo()
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -19,5 +19,4 @@
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -27,8 +27,5 @@
//// hello() {}
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
goTo.marker("element_access");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");
verify.allRangesAppearInImplementationList("element_access");

View File

@@ -44,6 +44,5 @@
//// }
for (var i = 0; i < 2; i++) {
goTo.marker("function_call" + i);
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call" + i);
}

View File

@@ -8,5 +8,5 @@
////
//// var x = <Foo> { [|hello: () => {}|] };
//// var y = <Foo> (((({ [|hello: () => {}|] }))));
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -19,5 +19,4 @@
//// constructor(public f: Foo = { [|hello: 7|] } ) {}
//// }
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -12,5 +12,4 @@
//// foo.he/*reference*/llo;
//// }
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -22,6 +22,4 @@
//// constructor(public f: Foo = [|{ hello() {/**3*/} }|] ) {}
//// }
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -21,5 +21,4 @@
//// var y: SuperBar = new SuperBar();
//// var z: AbstractBar = new NotAbstractBar();
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -17,11 +17,12 @@
//// }|];
//// }
////
//// let createFoo2 = (): Foo => [|({hello() {}})|];
////
//// function createFooLike() {
//// return {
//// hello() {}
//// };
//// }
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -6,5 +6,4 @@
////
//// var x = <Foo> [|{ hello: () => {} }|];
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -17,6 +17,4 @@
//// constructor(public f: Foo = [|function(a) {}|] ) {}
//// }
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -9,6 +9,4 @@
//// let bar2 = <Foo> [|function(a) {}|];
////
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -11,6 +11,4 @@
//// let x: Foo = [|class { constructor (a: number) {} }|];
//// let y = <Foo> [|class { constructor (a: number) {} }|];
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -25,5 +25,4 @@
//// return true;
//// }
goTo.marker("interface_definition");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("interface_definition");

View File

@@ -0,0 +1,21 @@
/// <reference path='fourslash.ts'/>
// Should not hang on inheritance loops
//// interface Base {
//// hello (): void;
//// }
////
//// interface A extends Base {}
//// interface B extends C, A {}
//// interface C extends B, A {}
////
//// class X implements B {
//// [|hello() {}|]
//// }
////
//// function someFunction(d : A) {
//// d.he/*function_call*/llo();
//// }
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -8,5 +8,5 @@
for(var i = 0; i < 3; i++) {
goTo.marker("" + i);
verify.implementationCountIs(0);
verify.implementationListIsEmpty();
}

View File

@@ -5,5 +5,4 @@
//// he/*function_call*/llo();
//// [|function hello() {}|]
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -5,5 +5,4 @@
//// const [|hello = function() {}|];
//// he/*function_call*/llo();
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -4,5 +4,5 @@
////
//// x.he/*function_call*/llo();
////
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -8,5 +8,5 @@
////
//// hello = {};
////
goTo.marker("local_var");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("local_var");

View File

@@ -6,5 +6,5 @@
////
//// hello();
////
goTo.marker("local_var");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("local_var");

View File

@@ -8,5 +8,5 @@
////
//// var [|someVar = new Bar()|];
//// someVa/*reference*/r.hello();
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -4,5 +4,5 @@
//// declare var [|someVar: string|];
//// someVa/*reference*/r
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -4,5 +4,5 @@
//// [|declare function someFunction(): () => void;|]
//// someFun/*reference*/ction();
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -4,5 +4,5 @@
//// [|declare function someFunction(): () => void;|]
//// someFun/*reference*/ction();
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -2,11 +2,10 @@
// Should handle property access expressions on namespaces
//// namespace Foo {
//// [|export function hello() {}|]
//// }
////
//// namespace Foo {
//// [|export function hello() {}|]
//// }
////
//// Foo.hell/*reference*/o();
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -2,11 +2,10 @@
// Should handle property access expressions on namespaces
//// module Foo {
//// [|export function hello() {}|]
//// }
////
//// module Foo {
//// [|export function hello() {}|]
//// }
////
//// Foo.hell/*reference*/o();
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -24,5 +24,4 @@
////
//// }
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -24,5 +24,4 @@
////
//// }
goTo.marker("reference");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("reference");

View File

@@ -9,5 +9,4 @@
////
//// let x: typeof Foo = [|{ hello() {} }|];
goTo.marker("declaration");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("declaration");

View File

@@ -44,5 +44,4 @@
////
//// createBarUsingClassDeclaration().Fo/*reference*/o;
goTo.marker("reference");
verify.allRangesAppearInImplementationList();;
verify.allRangesAppearInImplementationList("reference");

View File

@@ -18,5 +18,4 @@
//// x.h/*function_call*/ello();
//// }
goTo.marker("function_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("function_call");

View File

@@ -12,5 +12,4 @@
//// }
//// }
goTo.marker("super_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("super_call");

View File

@@ -12,5 +12,4 @@
//// }
//// }
goTo.marker("super_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("super_call");

View File

@@ -10,5 +10,4 @@
//// whatever() {}
//// }|]
goTo.marker("this_call");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("this_call");

View File

@@ -8,5 +8,4 @@
//// }
//// }|]
goTo.marker("this_type");
verify.allRangesAppearInImplementationList();
verify.allRangesAppearInImplementationList("this_type");