diff --git a/kythe/typescript/indexer.ts b/kythe/typescript/indexer.ts index 76707c8889..66cab6e9c4 100644 --- a/kythe/typescript/indexer.ts +++ b/kythe/typescript/indexer.ts @@ -875,21 +875,6 @@ class Visitor { `type param ${param.getText()} has no symbol`); return; } - const kType = this.host.getSymbolName(sym, TSNamespace.TYPE); - var superType: VName|undefined; - if (kType) { - this.emitNode(kType, NodeKind.ABSVAR); - this.emitEdge( - this.newAnchor(param.name), EdgeKind.DEFINES_BINDING, kType); - // ... - if (param.constraint) { - superType = this.visitType(param.constraint); - if (superType) - this.emitEdge(kType, EdgeKind.BOUNDED_UPPER, superType); - } - // ... - if (param.default) this.visitType(param.default); - } const kTVar = this.host.getSymbolName(sym, TSNamespace.TYPE_MIGRATION); if (kTVar && parent) { this.emitNode(kTVar, NodeKind.TVAR); @@ -900,9 +885,12 @@ class Visitor { this.emitEdge(parent, makeOrdinalEdge(EdgeKind.TPARAM, ordinal), kTVar); // ... if (param.constraint) { + var superType = this.visitType(param.constraint); if (superType) this.emitEdge(kTVar, EdgeKind.BOUNDED_UPPER, superType); } + // ... + if (param.default) this.visitType(param.default); } } } diff --git a/kythe/typescript/testdata/generic.ts b/kythe/typescript/testdata/generic.ts deleted file mode 100644 index 7d98d2fd24..0000000000 --- a/kythe/typescript/testdata/generic.ts +++ /dev/null @@ -1,77 +0,0 @@ -export {} - -// Check references to a type in a generic. - -//- @IFace defines/binding IFace -//- IFace.node/kind interface -interface IFace { - foo: string; -} - -// Reference to IFace in a generic type. -//- @IFace ref IFace -let x: Map; -// Reference to IFace in an expression. -//- @IFace ref IFace -x = new Map(); - -// Create a generic type and instantiate it. -//- @Container defines/binding Container -//- @T defines/binding ContainerT -//- ContainerT.node/kind absvar -interface Container { - //- @T ref ContainerT - //- !{@T ref Container} - contained: T; -} -let box: Container; - -//- @#0T defines/binding FnT -//- FnT.node/kind absvar -//- @IFace ref IFace -function generic(x: T, y: IFace) { - return x; -} - -// Simple constrained generic. -//- @T defines/binding ConstrainedGenericT -//- @IFace ref IFace -//- ConstrainedGenericT bounded/upper IFace -function constrainedGeneric() {} - -// Constrained generic with reference to type param within it. -//- @#0T defines/binding ConstrainedGenericT2 -//- !{@#0T ref ConstrainedGenericT} -//- @#1T ref ConstrainedGenericT2 -//- @#0K defines/binding ConstrainedGenericT2K -//- @#1K ref ConstrainedGenericT2K -function constrainedGenericRef(k: K) {} - -// Recursive generic type. -//- @#0T defines/binding ConstrainedGenericT3 -//- @#1T ref ConstrainedGenericT3 -function constrainedGenericRecursive>() {} - -// Default generic. -//- @#0T defines/binding DefaultGeneric -//- @#1T ref DefaultGeneric -//- @IFace ref IFace -function defaultGeneric(t: T) {} - -// Default generic with extends. -//- @#0T defines/binding DefaultGeneric2 -//- @#1T ref DefaultGeneric2 -//- @#0IFace ref IFace -//- @#1IFace ref IFace -function defaultGeneric2(t: T) {} - -//- @Container ref Container -//- @IFace ref Iface -interface ExtendsGeneric extends Container {} - -//- @Container ref Container -//- @IFace ref Iface -class ImplementsGeneric implements Container { - //- @IFace ref Iface - contained: IFace; -} diff --git a/kythe/typescript/testdata/schema.ts b/kythe/typescript/testdata/schema.ts index 61a6255cb3..d13811eb38 100644 --- a/kythe/typescript/testdata/schema.ts +++ b/kythe/typescript/testdata/schema.ts @@ -101,7 +101,7 @@ let v = { //- @AliasArray defines/binding VName("AliasArray#type", _, _, "testdata/schema", "typescript") type AliasArray< // TypeParameter - //- @#0"T" defines/binding VName("AliasArray.T#type", _, _, "testdata/schema", "typescript") + //- @#0"T" defines/binding VName("AliasArray.T#mtype", _, _, "testdata/schema", "typescript") T> = Array; //- @arrowFun defines/binding VName("arrowFun", _, _, "testdata/schema", "typescript")