Skip to content

Commit

Permalink
Fix some merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ncik-roberts committed Aug 8, 2024
1 parent 0dfcdc1 commit fc02fbd
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 904 deletions.
12 changes: 0 additions & 12 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
<<<<<<< HEAD
||||||| 7b73c6aa3
merlin NEXT_VERSION
===================

+ merlin binary
- Fix a follow-up issue to the preference of non-ghost nodes introduced in #1660 (#1690, fixes #1689)
+ editor modes
- vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)

=======
unreleased
==========

Expand Down Expand Up @@ -109,7 +98,6 @@ Fri Dec 1 15:00:42 CET 2023
- vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
- emacs: highlight only first error line by default (#1693, fixes #1663)

>>>>>>> upstream/main
merlin 4.12
===========
Tue Sep 26 17:45:42 CEST 2023
Expand Down
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,9 @@ If you're a Merlin user and depend on our public API, we recommend that you cont
Next Steps
==========

<<<<<<< HEAD
To use Merlin with a multi-file project, it is necessary to have a [.merlin](https://github.com/ocaml/merlin/wiki/project-configuration) file
unless your project is built using dune.
Note that, in a project using Dune, user-created `.merlin` files will take precedence over the configuration provided by Dune to Merlin.
||||||| 7b73c6aa3
To use Merlin with a multi-file project, it is necessary to have a [.merlin](https://github.com/ocaml/merlin/wiki/project-configuration) file,
unless your project is built using Dune.
Note that, in a project using Dune, user-created `.merlin` files will take precedence over the configuration provided by Dune to Merlin.
=======
To use Merlin with a multi-file project, it is necessary to have a [.merlin](https://github.com/ocaml/merlin/wiki/project-configuration) file,
unless your project is built using Dune.
Note that, in a project using Dune, user-created `.merlin` files will take precedence over the configuration provided by Dune to Merlin.
>>>>>>> upstream/main

Read more in the [wiki](https://github.com/ocaml/merlin/wiki) to learn how to make full use of Merlin in your projects.

Expand Down
72 changes: 0 additions & 72 deletions bench.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,73 +1 @@
<<<<<<< HEAD
FROM ocaml/opam:debian-11-ocaml-5.0

WORKDIR /app

RUN sudo apt-get update
RUN sudo apt-get -y install jq
COPY . .
RUN sudo chown -R opam /app
RUN eval $(opam env)

# install merlin
RUN opam install .

# install merl-an
## cache workaround: https://github.com/ocurrent/current-bench/issues/468#issuecomment-1621030354
ADD https://api.github.com/repos/pitag-ha/merl-an/git/refs/heads/main .merl-an-info
RUN opam pin -y merl-an https://github.com/pitag-ha/merl-an.git

RUN eval $(opam env)

# create directory for projects to run benchmarks on
RUN sudo mkdir /projects
RUN sudo chown opam /projects
WORKDIR /projects

# build irmin
RUN git clone https://github.com/mirage/irmin.git
WORKDIR /projects/irmin
RUN git checkout 8da4d16e7cc8beddfc8a824feca325426bae08a9
RUN sudo apt install -y gnuplot-x11 libgmp-dev pkg-config libffi-dev
RUN opam switch import /app/bench/irmin.opam.export --no-checksums
RUN opam exec -- dune build

WORKDIR /app
||||||| 7b73c6aa3
FROM ocaml/opam:ubuntu-20.04-ocaml-4.14

WORKDIR /app

RUN sudo apt-get update
RUN sudo apt-get -y install jq
COPY . .
RUN sudo chown -R opam /app
RUN eval $(opam env)

# install merlin
RUN opam install .

# install merl-an
## cache workaround: https://github.com/ocurrent/current-bench/issues/468#issuecomment-1621030354
ADD https://api.github.com/repos/pitag-ha/merl-an/git/refs/heads/main .merl-an-info
RUN opam pin -y merl-an https://github.com/pitag-ha/merl-an.git

RUN eval $(opam env)

# create directory for projects to run benchmarks on
RUN sudo mkdir /projects
RUN sudo chown opam /projects
WORKDIR /projects

# build irmin
RUN git clone https://github.com/mirage/irmin.git
WORKDIR /projects/irmin
RUN git checkout 8da4d16e7cc8beddfc8a824feca325426bae08a9
RUN sudo apt install -y gnuplot-x11 libgmp-dev pkg-config libffi-dev
RUN opam switch import /app/bench/irmin.opam.export --no-checksums
RUN opam exec -- dune build

WORKDIR /app
=======
FROM ocaml/opam:ubuntu-20.04-ocaml-5.2
>>>>>>> upstream/main
6 changes: 0 additions & 6 deletions dot-merlin-reader.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
<<<<<<< HEAD
"ocaml" {>= "5.1" & < "5.2" }
||||||| 7b73c6aa3
"ocaml" {>= "4.08" & < "5.0"}
=======
"ocaml" {>= "5.2" }
>>>>>>> upstream/main
"dune" {>= "2.9.0"}
"merlin-lib" {>= "5.0"}
"ocamlfind" {>= "1.6.0"}
Expand Down
30 changes: 0 additions & 30 deletions emacs/merlin.el
Original file line number Diff line number Diff line change
Expand Up @@ -1791,17 +1791,10 @@ Empty string defaults to jumping to all these."
(dolist (pos positions)
(let* ((start (assoc 'start pos))
(end (assoc 'end pos))
<<<<<<< HEAD
(occ-buff (find-file-noselect (cdr (assoc 'file pos))))
(marker (with-current-buffer occ-buff
(copy-marker (merlin--point-of-pos start))))
||||||| 7b73c6aa3
=======
(file (cdr (assoc 'file pos)))
(occ-buff (if file (find-file-noselect file) src-buff))
(marker (with-current-buffer occ-buff
(copy-marker (merlin--point-of-pos start))))
>>>>>>> upstream/main
(line (cdr (assoc 'line start)))
(start-buf-pos (with-current-buffer occ-buff
(merlin--point-of-pos start)))
Expand All @@ -1817,15 +1810,7 @@ Empty string defaults to jumping to all these."
marker
start-buf-pos
end-buf-pos
<<<<<<< HEAD
occ-buff))))

||||||| 7b73c6aa3
src-buff))))

=======
occ-buff))))
>>>>>>> upstream/main
;; Insert the critical text properties that occur-mode
;; makes use of
(add-text-properties start-offset
Expand All @@ -1842,20 +1827,6 @@ Empty string defaults to jumping to all these."
(or (not (equal line pending-line))
(not (equal previous-buf occ-buff))))
(insert pending-lines-text))
<<<<<<< HEAD

(when (not (equal previous-buf occ-buff))
(insert (propertize (format "Occurrences in buffer: %s"
;(length lst)
occ-buff)
'font-lock-face
list-matching-lines-buffer-name-face
'read-only t
'occur-title occ-buff))
(insert "\n"))

||||||| 7b73c6aa3
=======

(when (not (equal previous-buf occ-buff))
(insert (propertize (format "Occurrences in buffer %s:"
Expand All @@ -1867,7 +1838,6 @@ Empty string defaults to jumping to all these."
'occur-title occ-buff))
(insert "\n"))

>>>>>>> upstream/main
(setq pending-line line)
(setq previous-buf occ-buff)
(setq pending-lines-text lines-text)))
Expand Down
8 changes: 0 additions & 8 deletions merlin-lib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,8 @@ build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
<<<<<<< HEAD
"ocaml" {>= "5.1" & < "5.2"}
"dune" {>= "2.9.0"}
||||||| 7b73c6aa3
"ocaml" {>= "4.14" & < "4.15"}
"dune" {>= "2.9.0"}
=======
"ocaml" {>= "5.2" & < "5.3"}
"dune" {>= "3.0.0"}
>>>>>>> upstream/main
"csexp" {>= "1.5.1"}
"menhir" {dev & = "20210419"}
"menhirLib" {dev & = "20210419"}
Expand Down
8 changes: 0 additions & 8 deletions merlin.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,8 @@ build: [
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
<<<<<<< HEAD
"ocaml" {>= "5.1" & < "5.2"}
"dune" {>= "2.9.0"}
||||||| 7b73c6aa3
"ocaml" {>= "4.14" & < "4.15"}
"dune" {>= "2.9.0"}
=======
"ocaml" {>= "5.2" & < "5.3"}
"dune" {>= "3.0.0"}
>>>>>>> upstream/main
"merlin-lib" {= version}
"dot-merlin-reader" {>= "5.0"}
"ocaml-index" {>= "1.0" & post}
Expand Down
149 changes: 0 additions & 149 deletions src/analysis/ast_iterators.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
open Std
open Typedtree

Expand Down Expand Up @@ -50,151 +49,3 @@ let iter_on_usages ~f (local_defs : Mtyper.typedtree) =
begin match local_defs with
| `Interface signature -> iter.signature iter signature
| `Implementation structure -> iter.structure iter structure end
||||||| 7b73c6aa3
=======
open Std
open Typedtree

let {Logger. log} = Logger.for_section "iterators"

(* Sometimes we do not want to iterate on nodes that do not correspond to actual
syntax such as the ones introduced by PPXes with the `merlin.hide`
attribute. *)
let iter_only_visible iter =
let has_attribute ~name attrs =
List.exists ~f:(fun a ->
let (str,_) = Ast_helper.Attr.as_tuple a in
str.Location.txt = name
) attrs
in
let not_hidden attrs =
not (has_attribute ~name:"merlin.hide" attrs)
in
let not_hidden_node node =
not (Browse_raw.has_attr ~name:"merlin.hide" node)
in
Tast_iterator.{ iter with
class_declaration = (fun sub ({ ci_attributes; _ } as cl) ->
if not_hidden ci_attributes then iter.class_declaration sub cl);
class_description = (fun sub ({ ci_attributes; _ } as cl) ->
if not_hidden ci_attributes then iter.class_description sub cl);
class_expr = (fun sub ({ cl_attributes; _ } as cl) ->
if not_hidden cl_attributes then iter.class_expr sub cl);
class_field = (fun sub ({ cf_attributes; _ } as cl) ->
if not_hidden cf_attributes then iter.class_field sub cl);
class_type = (fun sub ({ cltyp_attributes; _ } as cl) ->
if not_hidden cltyp_attributes then iter.class_type sub cl);
class_type_declaration = (fun sub ({ ci_attributes; _ } as cl) ->
if not_hidden ci_attributes then iter.class_type_declaration sub cl);
class_type_field = (fun sub ({ ctf_attributes; _ } as cl) ->
if not_hidden ctf_attributes then iter.class_type_field sub cl);

expr = (fun sub ({ exp_attributes; _ } as e) ->
if not_hidden exp_attributes then iter.expr sub e);
extension_constructor = (fun sub ({ ext_attributes; _ } as e) ->
if not_hidden ext_attributes then iter.extension_constructor sub e);

include_description = (fun sub ({ incl_attributes; _ } as incl) ->
if not_hidden incl_attributes then iter.include_description sub incl);
include_declaration = (fun sub ({ incl_attributes; _ } as incl) ->
if not_hidden incl_attributes then iter.include_declaration sub incl);

module_binding = (fun sub ({ mb_attributes; _ } as mb) ->
if not_hidden mb_attributes then iter.module_binding sub mb);
module_declaration = (fun sub ({ md_attributes; _ } as m) ->
if not_hidden md_attributes then iter.module_declaration sub m);
module_substitution = (fun sub ({ ms_attributes; _ } as m) ->
if not_hidden ms_attributes then iter.module_substitution sub m);
module_expr = (fun sub ({ mod_attributes; _ } as m) ->
if not_hidden mod_attributes then iter.module_expr sub m);
module_type = (fun sub ({ mty_attributes; _ } as m) ->
if not_hidden mty_attributes then iter.module_type sub m);
module_type_declaration = (fun sub ({ mtd_attributes; _ } as m) ->
if not_hidden mtd_attributes then iter.module_type_declaration sub m);

pat = (fun sub ({ pat_attributes; _ } as p) ->
if not_hidden pat_attributes then iter.pat sub p);
row_field = (fun sub ({ rf_attributes; _ } as p) ->
if not_hidden rf_attributes then iter.row_field sub p);
object_field = (fun sub ({ of_attributes; _ } as p) ->
if not_hidden of_attributes then iter.object_field sub p);

open_declaration = (fun sub ({ open_attributes; _ } as p) ->
if not_hidden open_attributes then iter.open_declaration sub p);
open_description = (fun sub ({ open_attributes; _ } as p) ->
if not_hidden open_attributes then iter.open_description sub p);

signature_item = (fun sub si ->
if not_hidden_node (Signature_item (si, Env.empty)) then
iter.signature_item sub si);
structure_item = (fun sub si ->
if not_hidden_node (Structure_item (si, Env.empty)) then
iter.structure_item sub si);

typ = (fun sub ({ ctyp_attributes; _ } as t) ->
if not_hidden ctyp_attributes then iter.typ sub t);
type_declaration = (fun sub ({ typ_attributes; _ } as t) ->
if not_hidden typ_attributes then iter.type_declaration sub t);
type_extension = (fun sub ({ tyext_attributes; _ } as t) ->
if not_hidden tyext_attributes then iter.type_extension sub t);
type_exception = (fun sub ({ tyexn_attributes; _ } as t) ->
if not_hidden tyexn_attributes then iter.type_exception sub t);

value_binding = (fun sub ({ vb_attributes; _ } as vb) ->
if not_hidden vb_attributes then iter.value_binding sub vb);
value_description = (fun sub ({ val_attributes; _ } as vb) ->
if not_hidden val_attributes then iter.value_description sub vb);
}

(* The compiler contains an iterator that aims to gather definitions but
ignores local values like let-in expressions and local type definition. To
provide occurrences in the active buffer we extend the compiler's iterator with
these cases. *)
let iter_on_defs ~uid_to_locs_tbl =
let log = log ~title:"iter_on_defs" in
let register_uid uid fragment =
let loc = Misc_utils.loc_of_decl ~uid fragment in
Option.iter loc ~f:(fun loc ->
Types.Uid.Tbl.add uid_to_locs_tbl uid loc)
in
let iter_decl = Cmt_format.iter_on_declarations ~f:register_uid in
let register_uid uid loc =
Types.Uid.Tbl.add uid_to_locs_tbl uid loc
in
{ iter_decl with
expr = (fun sub ({ exp_extra; _ } as expr) ->
List.iter exp_extra ~f:(fun (exp_extra, _loc, _attr) ->
match exp_extra with
| Texp_newtype' (typ_id, typ_name, uid) ->
log "Found newtype %s wit id %a (%a)\n%!" typ_name.txt
Logger.fmt (Fun.flip Ident.print_with_scope typ_id)
Logger.fmt (fun fmt -> Location.print_loc fmt typ_name.loc);
register_uid uid typ_name;
()
| _ -> ());
iter_decl.expr sub expr);
}

let build_uid_to_locs_tbl ~(local_defs : Mtyper.typedtree) () =
let uid_to_locs_tbl : string Location.loc Types.Uid.Tbl.t =
Types.Uid.Tbl.create 64
in
let iter = iter_on_defs ~uid_to_locs_tbl in
begin match local_defs with
| `Interface sign ->
iter.signature iter sign
| `Implementation str ->
iter.structure iter str end;
uid_to_locs_tbl

let iter_on_usages ~f (local_defs : Mtyper.typedtree) =
let occ_iter = Cmt_format.iter_on_occurrences ~f in
let iter = iter_only_visible occ_iter in
begin match local_defs with
| `Interface signature -> iter.signature iter signature
| `Implementation structure -> iter.structure iter structure end

let iterator_on_usages ~f =
let occ_iter = Cmt_format.iter_on_occurrences ~f in
iter_only_visible occ_iter
>>>>>>> upstream/main
Loading

0 comments on commit fc02fbd

Please sign in to comment.