Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with references to elements defined in an interface file #646

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

- Fix issue where code analysis would not track types in inner modules across implementations and interfaces https://github.com/rescript-association/reanalyze/issues/186

- Fix issue with references to elements defined in an interface file https://github.com/rescript-lang/rescript-vscode/pull/646

## v1.8.2

#### :rocket: New Feature
Expand Down
4 changes: 2 additions & 2 deletions analysis/src/ProcessCmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let rec forTypeSignatureItem ~(env : SharedTypes.Env.t) ~(exported : Exported.t)
let oldDeclared = Stamps.findValue env.stamps stamp in
let declared =
addDeclared
~name:(Location.mknoloc (Ident.name ident))
~name:(Location.mkloc (Ident.name ident) loc)
~extent:loc ~stamp ~env ~item val_attributes
(Exported.add exported Exported.Value)
Stamps.addValue
Expand Down Expand Up @@ -107,7 +107,7 @@ let rec forTypeSignatureItem ~(env : SharedTypes.Env.t) ~(exported : Exported.t)
let declared =
addDeclared ~extent:md_loc
~item:(forTypeModule env md_type)
~name:(Location.mknoloc (Ident.name ident))
~name:(Location.mkloc (Ident.name ident) md_loc)
~stamp:(Ident.binding_time ident) ~env md_attributes
(Exported.add exported Exported.Module)
Stamps.addModule
Expand Down
11 changes: 11 additions & 0 deletions analysis/tests/src/References.res
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ let c = x

let foo = (~xx) => xx + 1
// ^ref

module M: {
let aa: int
} = {
let aa = 10
}

let bb = M.aa
let cc = bb
let dd = M.aa
// ^ref
2 changes: 2 additions & 0 deletions analysis/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Hover src/Hover.res 22:11
{"contents": {"kind": "markdown", "value": "```rescript\nint => int\n```\n\nSome doc comment"}}

Hover src/Hover.res 26:6
getLocItem #8: heuristic for JSX with at most one child
heuristic for: [makeProps, make, createElement], give the loc of `make`
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}}

Hover src/Hover.res 33:4
Expand Down
7 changes: 7 additions & 0 deletions analysis/tests/src/expected/References.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ References src/References.res 9:19
{"uri": "References.res", "range": {"start": {"line": 9, "character": 19}, "end": {"line": 9, "character": 21}}}
]

References src/References.res 20:12
[
{"uri": "References.res", "range": {"start": {"line": 13, "character": 2}, "end": {"line": 13, "character": 13}}},
{"uri": "References.res", "range": {"start": {"line": 18, "character": 11}, "end": {"line": 18, "character": 13}}},
{"uri": "References.res", "range": {"start": {"line": 20, "character": 11}, "end": {"line": 20, "character": 13}}}
]