-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add tentative support for OCaml 5.3 #203
Draft
cristianoc
wants to merge
4
commits into
master
Choose a base branch
from
ocaml-5-3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The cmt format has changed, this tries to support value dependencies just based on the type of what's available in the new `Cmt_format.cmt_infos`. #202
cristianoc
commented
Dec 31, 2024
|
||
let extractValueDependencies (cmt_infos : CL.Cmt_format.cmt_infos) = | ||
#if OCAML_VERSION >= (5, 3, 0) | ||
let deps = ref [] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tentatively tries to extract the old cmt_value_dependencies
.
The dependencies seems to have changed, currently none are found, and this attempt does not seem to work either: let extractValueDependencies (cmt_infos : Cmt_format.cmt_infos) =
#if OCAML_VERSION >= (5, 3, 0)
let deps = ref [] in
let ident_occurrences = cmt_infos.cmt_ident_occurrences in
Printf.eprintf "ident_occurrences: %d\n" (List.length ident_occurrences);
let process_id ({Location.txt; loc}, res) = match res with
| Shape_reduce.Resolved uid | Resolved_alias (uid, _) | Approximated (Some uid) ->
(match Types.Uid.Tbl.find_opt cmt_infos.cmt_uid_to_decl uid with
| Some (Value v) ->
deps := (loc, v.val_loc) :: !deps
| Some (Type td) ->
deps := (loc, td.typ_loc) :: !deps
| Some (Value_binding vb) ->
deps := (loc, vb.vb_loc) :: !deps
| Some (Module_binding mb) ->
deps := (loc, mb.mb_loc) :: !deps
| Some (Module_type mt) ->
deps := (loc, mt.mtd_loc) :: !deps
| Some (Constructor cd) ->
deps := (loc, cd.cd_loc) :: !deps
| Some (Class c) ->
deps := (loc, c.ci_loc) :: !deps
| Some (Class_type ct) ->
deps := (loc, ct.ci_loc) :: !deps
| Some (Extension_constructor ec) ->
deps := (loc, ec.ext_loc) :: !deps
| Some (Label ld) ->
deps := (loc, ld.ld_loc) :: !deps
| Some (Module m) ->
deps := (loc, m.md_loc) :: !deps
| Some (Module_substitution ms) ->
deps := (loc, ms.ms_loc) :: !deps
| _ -> ())
| _ -> () in
List.iter process_id ident_occurrences;
List.rev !deps Moving this to draft. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The cmt format has changed, this tries to support value dependencies just based on the type of what's available in the new
Cmt_format.cmt_infos
.#202