f0fe1b88ca
* Make isDefinition aware of target symbol Initial code, haven't fixed any tests yet. * Update baselines This commit includes a regression for commonjs aliases: ```js // @filename: a.js function f() { } module.exports.f = f // @filename: b.js const { f } = require('./a') f/**/ ``` Now says that `f` in b.js has 1 reference -- the alias `module.exports.f = f`. This is not correct (or not exactly correct), but correctly fixing will involve re-creating the ad-hoc commonjs alias resolution code from the checker. I don't think it's worth it for an edge case like this. * update more unit tests * Fix symbol lookup for constructors * More baselines + two fixes 1. Fix `default` support. 2. Add a secondary declaration location for commonjs assignment declarations. * Update rest of baselines * Switch a few more tests over to baselines
614 lines
12 KiB
Plaintext
614 lines
12 KiB
Plaintext
// === /tests/cases/fourslash/findAllRefsInheritedProperties4.ts ===
|
|
// interface C extends D {
|
|
// /*FIND ALL REFS*/[|prop0|]: string;
|
|
// prop1: number;
|
|
// }
|
|
//
|
|
// interface D extends C {
|
|
// [|prop0|]: string;
|
|
// }
|
|
//
|
|
// var d: D;
|
|
// d.[|prop0|];
|
|
// d.prop1;
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) C.prop0: string",
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "C",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) D.prop0: string",
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "D",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 123,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /tests/cases/fourslash/findAllRefsInheritedProperties4.ts ===
|
|
// interface C extends D {
|
|
// [|prop0|]: string;
|
|
// prop1: number;
|
|
// }
|
|
//
|
|
// interface D extends C {
|
|
// /*FIND ALL REFS*/[|prop0|]: string;
|
|
// }
|
|
//
|
|
// var d: D;
|
|
// d.[|prop0|];
|
|
// d.prop1;
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) C.prop0: string",
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "C",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) D.prop0: string",
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "D",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 123,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /tests/cases/fourslash/findAllRefsInheritedProperties4.ts ===
|
|
// interface C extends D {
|
|
// [|prop0|]: string;
|
|
// prop1: number;
|
|
// }
|
|
//
|
|
// interface D extends C {
|
|
// [|prop0|]: string;
|
|
// }
|
|
//
|
|
// var d: D;
|
|
// d./*FIND ALL REFS*/[|prop0|];
|
|
// d.prop1;
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) C.prop0: string",
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "C",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 28,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 28,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) D.prop0: string",
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "D",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop0",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "string",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 93,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 93,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 123,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /tests/cases/fourslash/findAllRefsInheritedProperties4.ts ===
|
|
// interface C extends D {
|
|
// prop0: string;
|
|
// /*FIND ALL REFS*/[|prop1|]: number;
|
|
// }
|
|
//
|
|
// interface D extends C {
|
|
// prop0: string;
|
|
// }
|
|
//
|
|
// var d: D;
|
|
// d.prop0;
|
|
// d.prop1;
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"kind": "property",
|
|
"name": "(property) C.prop1: number",
|
|
"textSpan": {
|
|
"start": 47,
|
|
"length": 5
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "property",
|
|
"kind": "text"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "C",
|
|
"kind": "interfaceName"
|
|
},
|
|
{
|
|
"text": ".",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "prop1",
|
|
"kind": "propertyName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "number",
|
|
"kind": "keyword"
|
|
}
|
|
],
|
|
"contextSpan": {
|
|
"start": 47,
|
|
"length": 14
|
|
}
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 47,
|
|
"length": 5
|
|
},
|
|
"fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties4.ts",
|
|
"contextSpan": {
|
|
"start": 47,
|
|
"length": 14
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": true
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
undefined |