TypeScript/tests/baselines/reference/findAllRefsDestructureGetter.baseline.jsonc
Nathan Shively-Sanders f0fe1b88ca
Make isDefinition aware of declaring symbol (#45920)
* 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
2021-09-22 13:43:52 -07:00

661 lines
13 KiB
Plaintext

// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get /*FIND ALL REFS*/[|x|]() { return 0; }
//
// set y(a: number) {}
// }
// const { [|x|], y } = new Test();
// x; y;
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "property",
"name": "(property) Test.x: number",
"textSpan": {
"start": 21,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Test",
"kind": "className"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "x",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 17,
"length": 21
}
},
"references": [
{
"textSpan": {
"start": 21,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 17,
"length": 21
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 74,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": false
}
]
}
]
// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get [|x|]() { return 0; }
//
// set y(a: number) {}
// }
// const { /*FIND ALL REFS*/[|x|], y } = new Test();
// [|x|]; y;
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "property",
"name": "(property) Test.x: number",
"textSpan": {
"start": 21,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Test",
"kind": "className"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "x",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 17,
"length": 21
}
},
"references": [
{
"textSpan": {
"start": 21,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 17,
"length": 21
},
"isWriteAccess": true,
"isDefinition": false
}
]
},
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "const",
"name": "const x: number",
"textSpan": {
"start": 74,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "x",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 66,
"length": 28
}
},
"references": [
{
"textSpan": {
"start": 74,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 95,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]
// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get x() { return 0; }
//
// set y(a: number) {}
// }
// const { [|x|], y } = new Test();
// /*FIND ALL REFS*/[|x|]; y;
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "const",
"name": "const x: number",
"textSpan": {
"start": 74,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "x",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 66,
"length": 28
}
},
"references": [
{
"textSpan": {
"start": 74,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 95,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]
// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get x() { return 0; }
//
// set /*FIND ALL REFS*/[|y|](a: number) {}
// }
// const { x, [|y|] } = new Test();
// x; y;
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "property",
"name": "(property) Test.y: number",
"textSpan": {
"start": 48,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Test",
"kind": "className"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "y",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 44,
"length": 19
}
},
"references": [
{
"textSpan": {
"start": 48,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 44,
"length": 19
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 77,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": false
}
]
}
]
// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get x() { return 0; }
//
// set [|y|](a: number) {}
// }
// const { x, /*FIND ALL REFS*/[|y|] } = new Test();
// x; [|y|];
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "property",
"name": "(property) Test.y: number",
"textSpan": {
"start": 48,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Test",
"kind": "className"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "y",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 44,
"length": 19
}
},
"references": [
{
"textSpan": {
"start": 48,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 44,
"length": 19
},
"isWriteAccess": true,
"isDefinition": false
}
]
},
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "const",
"name": "const y: number",
"textSpan": {
"start": 77,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "y",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 66,
"length": 28
}
},
"references": [
{
"textSpan": {
"start": 77,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 98,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]
// === /tests/cases/fourslash/findAllRefsDestructureGetter.ts ===
// class Test {
// get x() { return 0; }
//
// set y(a: number) {}
// }
// const { x, [|y|] } = new Test();
// x; /*FIND ALL REFS*/[|y|];
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"kind": "const",
"name": "const y: number",
"textSpan": {
"start": 77,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "y",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "number",
"kind": "keyword"
}
],
"contextSpan": {
"start": 66,
"length": 28
}
},
"references": [
{
"textSpan": {
"start": 77,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"contextSpan": {
"start": 66,
"length": 28
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 98,
"length": 1
},
"fileName": "/tests/cases/fourslash/findAllRefsDestructureGetter.ts",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]