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

Upgrade Merlin to OCaml 4.14 #1415

Merged
merged 59 commits into from
Apr 5, 2022
Merged

Upgrade Merlin to OCaml 4.14 #1415

merged 59 commits into from
Apr 5, 2022

Conversation

voodoos
Copy link
Collaborator

@voodoos voodoos commented Dec 13, 2021

Roadmap

  • first draft which compiles succesfully
  • fix testsuite
  • merge new locate code when ready

@kit-ty-kate do you know if it is already possible to have some CI (Github or Ocaml CI) working here ?

@voodoos
Copy link
Collaborator Author

voodoos commented Dec 13, 2021

Current test diff:

File "src/ocaml/preprocess/parser_raw.mly", line 848, characters 29-36:
Warning: the token COMMENT is unused.
File "src/ocaml/preprocess/parser_raw.mly", line 849, characters 30-39:
Warning: the token DOCSTRING is unused.
File "src/ocaml/preprocess/parser_raw.mly", line 851, characters 7-10:
Warning: the token EOL is unused.
File "src/ocaml/preprocess/parser_raw.mly", line 761, characters 7-22:
Warning: the token GREATERRBRACKET is unused.
File "src/ocaml/preprocess/parser_raw.mly", line 853, characters 7-23:
Warning: the token QUESTIONQUESTION is unused.
File "src/ocaml/preprocess/parser_raw.mly", line 927, characters 0-9:
Warning: the precedence level assigned to GREATERDOT is never useful.
File "src/ocaml/preprocess/parser_raw.mly", line 927, characters 0-9:
Warning: the precedence level assigned to QUESTIONQUESTION is never useful.
File "src/frontend/ocamlmerlin/old/old_IO.ml", line 318, characters 27-38:
318 |   let input () = try Some (Stream.next input) with Stream.Failure -> None in
                                 ^^^^^^^^^^^
Alert deprecated: module Stdlib.Stream
Use the camlp-streams library instead.
File "src/frontend/ocamlmerlin/old/old_IO.ml", line 318, characters 51-65:
318 |   let input () = try Some (Stream.next input) with Stream.Failure -> None in
                                                         ^^^^^^^^^^^^^^
Alert deprecated: module Stdlib.Stream
Use the camlp-streams library instead.
File "tests/test-dirs/config/flags/unsafe.t", line 1, characters 0-0:
File "tests/test-dirs/destruct/record.t", line 1, characters 0-0:
File "tests/test-dirs/destruct/issue1300.t", line 1, characters 0-0:
File "tests/test-dirs/destruct/prefixing.t", line 1, characters 0-0:
File "tests/test-dirs/typing-recovery.t", line 1, characters 0-0:
File "tests/test-dirs/type-enclosing/hole.t", line 1, characters 0-0:
         git (internal) (exit 1)
(cd _build/.sandbox/73a9a4e200132d5d27b46f933096b28a/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/config/flags/unsafe.t tests/test-dirs/config/flags/unsafe.t.corrected)
diff --git a/../../../default/tests/test-dirs/config/flags/unsafe.t b/tests/test-dirs/config/flags/unsafe.t.corrected
index 60579f5e..d40e9b3c 100644
--- a/../../../default/tests/test-dirs/config/flags/unsafe.t
+++ b/tests/test-dirs/config/flags/unsafe.t.corrected
@@ -29,6 +29,20 @@ Testing array desugaring
         "sub": [],
         "valid": true,
         "message": "Unbound value Array.get"
+      },
+      {
+        "start": {
+          "line": 2,
+          "col": 15
+        },
+        "end": {
+          "line": 2,
+          "col": 16
+        },
+        "type": "warning",
+        "sub": [],
+        "valid": true,
+        "message": "Warning 20: this argument will not be used by the function."
       }
     ],
     "notifications": []
@@ -73,6 +87,20 @@ Testing array desugaring
         "sub": [],
         "valid": true,
         "message": "Unbound value Array.unsafe_get"
+      },
+      {
+        "start": {
+          "line": 2,
+          "col": 15
+        },
+        "end": {
+          "line": 2,
+          "col": 16
+        },
+        "type": "warning",
+        "sub": [],
+        "valid": true,
+        "message": "Warning 20: this argument will not be used by the function."
       }
     ],
     "notifications": []
         git (internal) (exit 1)
(cd _build/.sandbox/50e29f1f4658eb952806ad353efc727b/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/destruct/prefixing.t tests/test-dirs/destruct/prefixing.t.corrected)
diff --git a/../../../default/tests/test-dirs/destruct/prefixing.t b/tests/test-dirs/destruct/prefixing.t.corrected
index 8faf6887..d9e29dde 100644
--- a/../../../default/tests/test-dirs/destruct/prefixing.t
+++ b/tests/test-dirs/destruct/prefixing.t.corrected
@@ -93,7 +93,7 @@ Test 3.1
   >   | None -> ()
   >   | Some _ -> ()
   > EOF
-  "Some (A.B) |Some (A.C)"
+  "Some (A.B) | Some (A.C)"
 
 Test 3.2
   $ $MERLIN single case-analysis -start 6:9 -end 6:10 -filename refine_pattern.ml <<EOF | \
@@ -105,4 +105,4 @@ Test 3.2
   >   | None -> ()
   >   | Some _ -> ()
   > EOF
-  "Some (B) |Some (C)"
+  "Some (B) | Some (C)"
         git (internal) (exit 1)
(cd _build/.sandbox/56fb793592a729a24074343305e7e3b8/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/destruct/record.t tests/test-dirs/destruct/record.t.corrected)
diff --git a/../../../default/tests/test-dirs/destruct/record.t b/tests/test-dirs/destruct/record.t.corrected
index 942e5d8c..7de66f3c 100644
--- a/../../../default/tests/test-dirs/destruct/record.t
+++ b/tests/test-dirs/destruct/record.t.corrected
@@ -95,7 +95,7 @@ Record fields in patterns should also be refinable:
           "col": 16
         }
       },
-      "{ contents = 0 } |{ contents = _ }"
+      "{ contents = 0 } | { contents = _ }"
     ],
     "notifications": []
   }
         git (internal) (exit 1)
(cd _build/.sandbox/8fb176e939576097ce9087e8334f6dcd/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/destruct/issue1300.t tests/test-dirs/destruct/issue1300.t.corrected)
diff --git a/../../../default/tests/test-dirs/destruct/issue1300.t b/tests/test-dirs/destruct/issue1300.t.corrected
index ab0d0453..6814b008 100644
--- a/../../../default/tests/test-dirs/destruct/issue1300.t
+++ b/tests/test-dirs/destruct/issue1300.t.corrected
@@ -37,7 +37,7 @@ https://github.com/ocaml/merlin/issues/1300
           "col": 5
         }
       },
-      "A 0 |B x |A _"
+      "A 0 | B x | A _"
     ],
     "notifications": []
   }
         git (internal) (exit 1)
(cd _build/.sandbox/ad5eccd66cf25ecde47d329d450386c7/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/typing-recovery.t tests/test-dirs/typing-recovery.t.corrected)
diff --git a/../../../default/tests/test-dirs/typing-recovery.t b/tests/test-dirs/typing-recovery.t.corrected
index 480eef9d..0c156a65 100644
--- a/../../../default/tests/test-dirs/typing-recovery.t
+++ b/tests/test-dirs/typing-recovery.t.corrected
@@ -260,14 +260,12 @@
                 pattern (test2.ml[2,15+7]..test2.ml[2,15+8])
                   attribute \"merlin.incorrect\"
                     []
-                  Tpat_extra_constraint
-                  core_type (test2.ml[2,15+11]..test2.ml[2,15+12])
-                    Ttyp_constr \"t/81\"
-                    []
-                  pattern (test2.ml[2,15+7]..test2.ml[2,15+8])
-                    attribute \"merlin.incorrect\"
+                  extra
+                    Tpat_extra_constraint
+                    core_type (test2.ml[2,15+11]..test2.ml[2,15+12])
+                      Ttyp_constr \"t/273\"
                       []
-                    Tpat_any
+                  Tpat_any
                 expression (test2.ml[2,15+22]..test2.ml[2,15+24])
                   attribute \"merlin.incorrect\"
                     []
         git (internal) (exit 1)
(cd _build/.sandbox/966172d5ff7a8de54561df0efba7598e/default && /usr/local/bin/git --no-pager diff --no-index --color=always -u ../../../default/tests/test-dirs/type-enclosing/hole.t tests/test-dirs/type-enclosing/hole.t.corrected)
diff --git a/../../../default/tests/test-dirs/type-enclosing/hole.t b/tests/test-dirs/type-enclosing/hole.t.corrected
index db112324..fdf6797a 100644
--- a/../../../default/tests/test-dirs/type-enclosing/hole.t
+++ b/tests/test-dirs/type-enclosing/hole.t.corrected
@@ -94,32 +94,7 @@ What about other places where Module_expr are allowed ?
   > EOF
   {
     "class": "return",
-    "value": [
-      {
-        "start": {
-          "line": 1,
-          "col": 12
-        },
-        "end": {
-          "line": 1,
-          "col": 16
-        },
-        "type": "_",
-        "tail": "no"
-      },
-      {
-        "start": {
-          "line": 1,
-          "col": 0
-        },
-        "end": {
-          "line": 1,
-          "col": 35
-        },
-        "type": "_",
-        "tail": "no"
-      }
-    ],
+    "value": [],
     "notifications": []
   }
 
@@ -130,18 +105,6 @@ What about other places where Module_expr are allowed ?
   {
     "class": "return",
     "value": [
-      {
-        "start": {
-          "line": 2,
-          "col": 16
-        },
-        "end": {
-          "line": 2,
-          "col": 17
-        },
-        "type": "Hole",
-        "tail": "no"
-      },
       {
         "start": {
           "line": 2,
@@ -151,7 +114,7 @@ What about other places where Module_expr are allowed ?
           "line": 2,
           "col": 25
         },
-        "type": "(module Hole)",
+        "type": "'a",
         "tail": "no"
       }
     ],

@kit-ty-kate
Copy link
Member

We can’t enable 4.14 in OCaml-CI before the the shape fix is merged, otherwise it’ll break our cluster.
Github Actions should be fine. I think changing this line to ocaml-variants.4.14.0+trunk should be fine

@voodoos
Copy link
Collaborator Author

voodoos commented Dec 13, 2021

CI is now running and failing with panache ! Thank you @kit-ty-kate

@let-def
Copy link
Contributor

let-def commented Feb 17, 2022

I have reviewed this branch and I believe it is good. I made minor changes after rebasing on top of Merlin master and OCaml 4.14 trunk.
I approve the changes, though I will test it for a few more days.

@trefis
Copy link
Contributor

trefis commented Mar 4, 2022

I've also been using this for a few weeks and it works fine, but I noticed some changes with the upstream version today.
ocaml/ocaml#10488 in particular doesn't seem to exist in Merlin. Was that a deliberate choice?

@voodoos
Copy link
Collaborator Author

voodoos commented Mar 28, 2022

@trefis I've redone the merge of Printtyp. The test suite allowed me to find a small printing bug in the compiler (see e273cc7).

The issue is that the printer is incorrectly reset between two prints of types that share some variables.

@nojb
Copy link
Contributor

nojb commented Mar 29, 2022

Hiya. Is this the official 4.14 branch? I need to adapt some inhouse Merlin code and would not want to base it on the wrong one :)

@voodoos
Copy link
Collaborator Author

voodoos commented Mar 29, 2022

Yes this is the 414 branch that will be merged soon into master for the official release. It is up-to-date with the recent release of OCaml 4.14.

@nojb
Copy link
Contributor

nojb commented Mar 29, 2022

Yes this is the 414 branch that will be merged soon into master for the official release. It is up-to-date with the recent release of OCaml 4.14.

Thanks!

@trefis trefis marked this pull request as ready for review March 29, 2022 15:48
Copy link
Contributor

@trefis trefis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I've also been using this branch for weeks (if not months) now, and it seems OK.

@trefis trefis merged commit c447386 into master Apr 5, 2022
@trefis trefis deleted the 414 branch April 5, 2022 10:20
@trefis trefis restored the 414 branch April 5, 2022 11:13
@trefis trefis deleted the 414 branch April 5, 2022 11:16
pitag-ha added a commit to pitag-ha/merlin that referenced this pull request Jul 25, 2023
This is the change between right after 4.13 bump and right before 4.14
bump, i.e. between
ocaml#1397
ocaml#1415

[locate] has changed in two ways: An error regression was fixed (before
[Return Msg], now [Return Other]); there's a change in behavior, where
now it sometimes points to a different place than before.
pitag-ha added a commit to pitag-ha/merlin that referenced this pull request Jul 25, 2023
This is the change of the 4.14 bump, i.e. PR
ocaml#1415

All changes the tests capture can be found in full_responses.it, none in
category_data.t:

In [type-enclosing], the module aliases are handled differently. Happens
in a lot of places, e.g. type": "sig\n  module type S = Watch_intf.S\n
val workers : unit -> int\n -> "type": "Watch_intf.Sigs";

Type inference is handled differently: e.g. "desc": "watch -> 'a -> 'a
IMap.t" -> "desc": "watch -> 'weak1 -> 'weak1 IMap.t";

`complete-prefix` sometimes returns more value now, e.g. "name":
"In_channel", "name": "String" etc

Deprecated warnings are different (as expected in a parsetree bump).

real    12m40,515s
user    3m15,769s
sys     0m27,909s
pitag-ha added a commit to pitag-ha/merlin that referenced this pull request Jul 25, 2023
This captures the change between the 4.14 bump and a PR fixing a locate
issue, i.e. PRs
ocaml#1415
ocaml#1522

Changes read from category_data.t:
2 regressions in `locate`:
- Sometimes now there's a `Return Msg "didn't manage to find vertex"`,
where before there was a successful return.
- Same for `Return Msg "didn't manage to find Fpath"`.
- Sometimes `locate` returns `Exception` now instead of `Return Msg`
containing the error message.
- Sometimes now there's a `Return Msg "'Unix.Unix_error' seems to
originate from '_none_' whose ML file could not be found"`, where before there was a successful return.

Change in `locate`:
- Sometimes now there's a successrul return, where before there was
`Return Msg `"didn't manage to find Key.to_hash"`.
- Same for `Return Msg "Needed cmt file of module 'Info' to locate
'Info' but it is not present"`.

Other changes read from full_responses.t:
- module paths are reported directly, not over Dune indirective:
`Irmin__Diff` -> `Diff`.
- difference in location of locate
- different suggestions in `complete-prefix` sometimes
- probably more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants