diff --git a/CHANGES.md b/CHANGES.md index f0af2fa63..ace948c57 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,10 @@ #### Removed +- Removed warning about missing semicolons added in MDX 1.11.0 and the + automatic insertion of semicolons in the corrected files introduced in MDX + 2.0.0. (#398, @Leonidas-from-XIV) + #### Security ### 2.1.0 diff --git a/lib/deprecated.ml b/lib/deprecated.ml index f3ddd26c9..73e7250fb 100644 --- a/lib/deprecated.ml +++ b/lib/deprecated.ml @@ -23,33 +23,3 @@ let warn ?replacement s ~since = Format.eprintf "Warning: %s is deprecated since %s and will be removed in 2.0.0. %s\n%!" s since replacement - -module Missing_double_semicolon = struct - let missing_semicolon = ref false - - let ends_with_semi cmd = - cmd |> Astring.String.trim |> Astring.String.is_suffix ~affix:";;" - - let fix_toplevel : Toplevel.t -> Toplevel.t = - fun toplevel -> - let rec fix_command = function - | [] -> [] - | [ cmd ] when not @@ ends_with_semi cmd -> - missing_semicolon := true; - [ Printf.sprintf "%s;;" cmd ] - | [ cmd ] -> [ cmd ] - | x :: xs -> x :: fix_command xs - in - { toplevel with command = fix_command toplevel.command } - - let fix block = List.map fix_toplevel block - - let report ~filename = - if !missing_semicolon then - Format.eprintf - "Warning: OCaml toplevel block without trailing ;; detected in file \ - '%s'.\n\ - Non-semicolon terminated phrases are deprecated.\n\ - In MDX 3.0 support for toplevel blocks without ;; will be removed.\n" - filename -end diff --git a/lib/deprecated.mli b/lib/deprecated.mli index 5e297c749..ba170e84b 100644 --- a/lib/deprecated.mli +++ b/lib/deprecated.mli @@ -16,8 +16,3 @@ val warn : ?replacement:string -> string -> since:string -> unit (** Emits a warning on the standard error. *) - -module Missing_double_semicolon : sig - val fix : Toplevel.t list -> Toplevel.t list - val report : filename:string -> unit -end diff --git a/lib/test/mdx_test.ml b/lib/test/mdx_test.ml index 81198ba5f..92f77a494 100644 --- a/lib/test/mdx_test.ml +++ b/lib/test/mdx_test.ml @@ -323,7 +323,6 @@ let run_exn ~non_deterministic ~silent_eval ~record_backtrace ~syntax ~silent let syntax = Util.Option.value syntax ~default:Normal in Toplevel.of_lines ~syntax ~loc:t.loc t.contents in - let phrases = Deprecated.Missing_double_semicolon.fix phrases in with_non_det non_deterministic non_det ~command:print_block ~output:(fun () -> assert (syntax <> Some Cram); @@ -367,7 +366,6 @@ let run_exn ~non_deterministic ~silent_eval ~record_backtrace ~syntax ~silent try test_block ~ppf ~temp_file t with Failure msg -> raise (Test_block_failure (t, msg)))) items; - Deprecated.Missing_double_semicolon.report ~filename:file; Format.pp_print_flush ppf (); Buffer.contents buf in diff --git a/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.expected b/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.expected index a9f4d2c01..03e6939ca 100644 --- a/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.expected +++ b/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.expected @@ -1,14 +1,11 @@ `;;` is not mandatory at the end of toplevel phrases but will be inserted -automatically in the corrected file. Also, a warning will be emitted. +automatically. ```ocaml -# let x = 3;; +# let x = 3 val x : int = 3 # let f = function | 0 -> 1 - | n -> n-1;; + | n -> n-1 val f : int -> int = ``` -Warning: OCaml toplevel block without trailing ;; detected in file 'test-case.md'. -Non-semicolon terminated phrases are deprecated. -In MDX 3.0 support for toplevel blocks without ;; will be removed. diff --git a/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.md b/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.md index 2a196538a..03e6939ca 100644 --- a/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.md +++ b/test/bin/mdx-test/misc/inserting-double-semicolon/test-case.md @@ -1,5 +1,5 @@ `;;` is not mandatory at the end of toplevel phrases but will be inserted -automatically in the corrected file. Also, a warning will be emitted. +automatically. ```ocaml # let x = 3 diff --git a/test/bin/mdx-test/misc/missing-double-semicolon/dune b/test/bin/mdx-test/misc/missing-double-semicolon/dune deleted file mode 100644 index 9f8721ae0..000000000 --- a/test/bin/mdx-test/misc/missing-double-semicolon/dune +++ /dev/null @@ -1,13 +0,0 @@ -(rule - (target test-case.actual) - (deps - (package mdx)) - (action - (with-outputs-to - %{target} - (run %{bin:ocaml-mdx} test %{dep:test-case.md})))) - -(rule - (alias runtest) - (action - (diff test-case.expected test-case.actual))) diff --git a/test/bin/mdx-test/misc/missing-double-semicolon/test-case.expected b/test/bin/mdx-test/misc/missing-double-semicolon/test-case.expected deleted file mode 100644 index a71de1846..000000000 --- a/test/bin/mdx-test/misc/missing-double-semicolon/test-case.expected +++ /dev/null @@ -1,3 +0,0 @@ -Warning: OCaml toplevel block without trailing ;; detected in file 'test-case.md'. -Non-semicolon terminated phrases are deprecated. -In MDX 3.0 support for toplevel blocks without ;; will be removed. diff --git a/test/bin/mdx-test/misc/missing-double-semicolon/test-case.md b/test/bin/mdx-test/misc/missing-double-semicolon/test-case.md deleted file mode 100644 index d92835d64..000000000 --- a/test/bin/mdx-test/misc/missing-double-semicolon/test-case.md +++ /dev/null @@ -1,9 +0,0 @@ -#files that contain top level blocks missing ;; should trigger a single warning - -```ocaml -# let x = 42 -``` - -```ocaml -# let y = 23 -```