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
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: 3 additions & 1 deletion lib/top/compat_top.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ let extension_constructor
; ext_private
; ext_loc
; ext_attributes
#if OCAML_VERSION >= (4, 11, 0)
#if OCAML_VERSION >= (5, 3, 0)
; ext_uid = Uid.mk ~current_unit:None
#elif OCAML_VERSION >= (4, 11, 0)
; ext_uid = Uid.mk ~current_unit:"mdx"
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion mdx.opam
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ depends: [
"logs" {>= "0.7.0"}
"cmdliner" {>= "1.1.0"}
"re" {>= "1.7.2"}
"ocaml-version" {>= "3.6.5"}
"ocaml-version" {>= "2.3.0"}
"lwt" {with-test}
"camlp-streams"
"result"
Expand Down
10 changes: 9 additions & 1 deletion test/bin/mdx-test/expect/errors/test-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,18 @@ first
Exception: Failure "second".
```

```ocaml version>=4.08
```ocaml version>=4.08,version<5.3
# let x =
1 + "42";;
Line 2, characters 7-11:
Error: This expression has type string but an expression was expected of type
int
```

```ocaml version>=5.3
# let x =
1 + "42";;
Line 2, characters 7-11:
Error: This constant has type string but an expression was expected of type
int
```
12 changes: 11 additions & 1 deletion test/bin/mdx-test/expect/lines/test-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Error: This expression has type string but an expression was expected of type
int
```

```ocaml version>=4.08
```ocaml version>=4.08,version<5.3
# let f x = function
| 0 -> 1
| n ->
Expand All @@ -66,6 +66,16 @@ Error: This expression has type string but an expression was expected of type
int
```

```ocaml version>=5.3
# let f x = function
| 0 -> 1
| n ->
n + "foo";;
Line 4, characters 7-12:
Error: This constant has type string but an expression was expected of type
int
```

Line directives work for `sh` blocks as well:

```sh version=4.08.1
Expand Down
12 changes: 11 additions & 1 deletion test/bin/mdx-test/expect/mlt/test-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Error: This expression has type string but an expression was expected of type
int
```

```ocaml version>=4.08
```ocaml version>=4.08,version<5.3
# #require "fmt";;
# let x = 3;;
val x : int = 3
Expand All @@ -39,3 +39,13 @@ Line 1, characters 5-10:
Error: This expression has type string but an expression was expected of type
int
```

```ocaml version>=5.3
# #require "fmt";;
# let x = 3;;
val x : int = 3
# x + "foo";;
Line 1, characters 5-10:
Error: This constant has type string but an expression was expected of type
int
```
11 changes: 10 additions & 1 deletion test/bin/mdx-test/expect/simple-mld/test-case.mld
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,20 @@ Indentation test:
val x : int = 1
]}

{delim@ocaml[
{delim@ocaml version<5.3[
let f = 1 + "2"
]delim[
{err@mdx-error[
Line 1, characters 15-18:
Error: This expression has type string but an expression was expected of type
int
]err}]}

{delim@ocaml version>=5.3[
let f = 1 + "2"
]delim[
{err@mdx-error[
Line 1, characters 15-18:
Error: This constant has type string but an expression was expected of type
int
]err}]}
13 changes: 12 additions & 1 deletion test/bin/mdx-test/expect/simple-mli/test-case.mli
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ val bar : string
val baz : string

(**
{[
{@ocaml version<5.3[
let f = 1 + "2"
][
{err@mdx-error[
Expand All @@ -61,6 +61,17 @@ Error: This expression has type string but an expression was expected of type
]err}]}
*)

(**
{@ocaml version>=5.3[
let f = 1 + "2"
][
{err@mdx-error[
Line 1, characters 15-18:
Error: This constant has type string but an expression was expected of type
int
]err}]}
*)

(**
{@ocaml skip[
let f = 1 + "2"
Expand Down