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

support OCaml 5.3 #457

Merged
merged 3 commits into from
Dec 7, 2024
Merged

Conversation

anmonteiro
Copy link
Contributor

the expect tests still have some failures like this if ran on 5.3. Any advice on how to make them conditional?

File "test/bin/mdx-test/expect/simple-mli/test-case.mli", line 1, characters 0-0:
diff --git a/_build/default/test/bin/mdx-test/expect/simple-mli/test-case.mli b/_build/default/test/bin/mdx-test/expect/simple-mli.actual
index ad197127..ad54569e 100644
--- a/_build/default/test/bin/mdx-test/expect/simple-mli/test-case.mli
+++ b/_build/default/test/bin/mdx-test/expect/simple-mli.actual
@@ -56,7 +56,7 @@ val baz : string
 ][
 {err@mdx-error[
 Line 1, characters 15-18:
-Error: This expression has type string but an expression was expected of type
+Error: This constant has type string but an expression was expected of type
          int
 ]err}]}
 *)

@samoht
Copy link
Collaborator

samoht commented Dec 6, 2024

@voodoos is this the right way to fix this? What about using ~current_unit:None instead?

@samoht samoht force-pushed the anmonteiro/5.3-support branch from c3b0e07 to dbc30c1 Compare December 6, 2024 21:15
@samoht
Copy link
Collaborator

samoht commented Dec 6, 2024

I've rebased on top of main to fix the tests

Comment on lines 99 to 105
#if OCAML_VERSION >= (5, 3, 0)
; ext_uid = Uid.mk
~current_unit:
(Some (Unit_info.make ~source_file:"mdx.ml" Impl "mdx"))
#elif OCAML_VERSION >= (4, 11, 0)
; ext_uid = Uid.mk ~current_unit:"mdx"
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

To answer @samoht question I would say that this is the closest way to get the same "current_unit" information as before in the uid since Uid.make will use the modname part of the Unit_info which is "Mdx".

As to whether this information is important to have, I guess it's not (and therefore None would probably work too), unless there is tooling that expect this information to be "correct". (AFAIK it's only important for tooling.)

For reference, (I don't know if it would make sense here), in the compiler this information is retrieved from the environment: Uid.mk ~current_unit:(Env.get_current_unit ())

@samoht samoht merged commit 3fa85ef into realworldocaml:main Dec 7, 2024
2 checks passed
@samoht
Copy link
Collaborator

samoht commented Dec 7, 2024

Thanks! I've simplified the support as I don't think the tooling needs anything complicated here.

samoht added a commit to samoht/opam-repository that referenced this pull request Dec 7, 2024
CHANGES:

#### Added

- Support OCaml 5.3 (realworldocaml/mdx#457, @anmonteiro, @samoht, @voodoos)
- Support multiple version labels in block headers. The block is active if all
  the version formulaes are satisfied (realworldocaml/mdx#458, @samoht)

#### Fixed

- Avoid infinite loop in lexer on unclosed code block (realworldocaml/mdx#444, @edwintorok)
- Fix support for skipped blocks in mli and mld files (realworldocaml/mdx#462, @samoht)
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.

3 participants