Skip to content

Fix issue of poly variant duplication. #410

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

Merged
merged 3 commits into from
May 8, 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
4 changes: 2 additions & 2 deletions analysis/src/ProcessCmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,8 @@ struct
| Texp_open (_, _path, _ident, _) -> Hashtbl.add extra.opens eloc ()
| _ -> ());
match expression.exp_desc with
| Texp_ident (path, {txt; loc}, {val_type}) ->
addForLongident (Some (val_type, Value)) path txt loc
| Texp_ident (path, {txt; loc}, _) ->
addForLongident (Some (expression.exp_type, Value)) path txt loc
| Texp_record {fields} ->
addForRecord expression.exp_type
(fields |> Array.to_list
Expand Down
13 changes: 13 additions & 0 deletions analysis/tests/src/Hover.res
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,16 @@ let _get = r => r.f +. r.i

let withAs = (~xx as yyy) => yyy + 1
// ^hov

module AA = {
type cond<'a> = [< #str(string)] as 'a
let fnnxx = (b: cond<_>) => true ? b : b
}

let funAlias = AA.fnnxx

let typeOk = funAlias
// ^hov

let typeDuplicate = AA.fnnxx
// ^hov
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/Fragment.res.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Hover tests/src/Fragment.res 6:19
{"contents": "```rescript\n{\"children\": 'children} => 'children\n```"}
{"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"}

Hover tests/src/Fragment.res 9:56
null
Expand Down
10 changes: 8 additions & 2 deletions analysis/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ Hover tests/src/Hover.res 75:7
{"contents": "```rescript\nmodule A = {\n let x: int\n}\n```"}

Hover tests/src/Hover.res 85:10
{"contents": "```rescript\n{\"children\": React.element} => React.element\n```"}
{"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"}

Hover tests/src/Hover.res 88:10
{"contents": "```rescript\n{\"children\": React.element} => React.element\n```"}
{"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"}

Hover tests/src/Hover.res 93:25
{"contents": "```rescript\nfloat\n```"}

Hover tests/src/Hover.res 96:21
{"contents": "```rescript\nint\n```"}

Hover tests/src/Hover.res 106:16
{"contents": "```rescript\nAA.cond<[< #str(string)]> => AA.cond<[< #str(string)]>\n```"}

Hover tests/src/Hover.res 109:25
{"contents": "```rescript\nAA.cond<[< #str(string)]> => AA.cond<[< #str(string)]>\n```"}