Skip to content

Commit

Permalink
Fix a bunch of deprecation warnings & errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGr committed Jul 26, 2024
1 parent 64b4968 commit b9dc09c
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions src/ace-lib/ace.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type 'a editor = {
mutable sync_observers : (bool -> unit) list;
}

let ace : Ace_types.ace Js.t = Js.Unsafe.variable "ace"
let ace : Ace_types.ace Js.t = Js.Unsafe.pure_js_expr "ace"
let edit el = ace##(edit el)

let create_position r c =
Expand Down Expand Up @@ -90,7 +90,7 @@ let focus { editor } = editor##focus

let create_editor editor_div =
let editor = edit editor_div in
Js.Unsafe.set editor "$blockScrolling" (Js.Unsafe.variable "Infinity");
Js.Unsafe.set editor "$blockScrolling" (Js.Unsafe.pure_js_expr "Infinity");
let data =
{ editor; editor_div;
marks = [];
Expand Down Expand Up @@ -130,7 +130,7 @@ let string_of_make_type: mark_type -> string = function
| Warning -> "warning"
| Message -> "message"

let require s = (Js.Unsafe.variable "ace")##(require (Js.string s))
let require s = (Js.Unsafe.pure_js_expr "ace")##(require (Js.string s))

type range = Ace_types.range Js.t
let range_cstr = (require "ace/range")##._Range
Expand Down
2 changes: 0 additions & 2 deletions src/app/learnocaml_playground_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ open Learnocaml_common
open Learnocaml_data
open Learnocaml_config

module H = Tyxml_js.Html

let init_tabs, select_tab =
mk_tab_handlers "toplevel" ["editor"]

Expand Down
2 changes: 1 addition & 1 deletion src/app/learnocaml_student_view.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module El = struct
name: string;
btn: Html_types.div H.elt;
tab: Html_types.div H.elt;
}
}[@@ocaml.warning "-69"]
let tid name = {
name;
btn = snd (id ("learnocaml-exo-button-" ^ name));
Expand Down
2 changes: 1 addition & 1 deletion src/grader/dune
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(wrapped false)
(modules introspection_intf)
(modules_without_implementation introspection_intf)
(libraries learnocaml_report ty))
(libraries unix learnocaml_report ty))

;; dynamic part, on which Test_lib depends
(library
Expand Down
2 changes: 0 additions & 2 deletions src/grader/grading.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Learn-OCaml is distributed under the terms of the MIT license. See the
* included LICENSE file for details. *)

open Toploop_ext

type error =
| Internal_error of string * Toploop_ext.error
| User_code_error of Toploop_ext.error
Expand Down
4 changes: 3 additions & 1 deletion src/grader/grading_cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ let get_grade ?callback ?timeout ?dirname exo solution =
try
let oc = Unix.out_channel_of_descr out_fd in
let (ret: grader_answer) =
Load_path.init [ cmis_dir ] ;
Load_path.init
~auto_include:Load_path.no_auto_include
[ cmis_dir ] ;
Toploop_unix.initialize () ;
let divert name chan cb =
let redirection = Toploop_unix.redirect_channel name chan cb in
Expand Down
38 changes: 19 additions & 19 deletions src/grader/test_lib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@
(** Grading function for variables and references. *)
module Test_functions_ref_var : sig

(** [test_ref ty got exp] returns {!LearnOcaml_report.Success 1}
(** [test_ref ty got exp] returns {!Learnocaml_report.Success 1}
report if reference [got] value is equal to [exp] and
{!LearnOcaml_report.Failure} report otherwise.
{!Learnocaml_report.Failure} report otherwise.
{e WARNING:} contrary to other grading functions, you cannot
use this function to evaluate a reference defined or modified
Expand All @@ -529,22 +529,22 @@
val test_ref :
'a Ty.ty -> 'a ref -> 'a -> Learnocaml_report.t

(** [test_variable ty name r] returns {!LearnOcaml_report.Success
(** [test_variable ty name r] returns {!Learnocaml_report.Success
1} report if variable named [name] exists and is equal to
[r]. Otherwise returns {!LearnOcaml_report.Failure} report.*)
[r]. Otherwise returns {!Learnocaml_report.Failure} report.*)
val test_variable :
'a Ty.ty -> string -> 'a -> Learnocaml_report.t

(** [test_variable_property ty name cb] returns the report
resulting of application of cb to variable named [name] if it
exists. Otherwise returns {!LearnOcaml_report.Failure} report. *)
exists. Otherwise returns {!Learnocaml_report.Failure} report. *)
val test_variable_property :
'a Ty.ty -> string -> ('a -> Learnocaml_report.t) -> Learnocaml_report.t

(** [test_variable ty name r] returns {!LearnOcaml_report.Success
(** [test_variable ty name r] returns {!Learnocaml_report.Success
1} report if variable named [name] exists and is equal to
variable with the same name defined in solution. Otherwise returns
{!LearnOcaml_report.Failure} report.*)
{!Learnocaml_report.Failure} report.*)
val test_variable_against_solution :
'a Ty.ty -> string -> Learnocaml_report.t

Expand Down Expand Up @@ -620,7 +620,7 @@
outputs.
A test [(arg-1, r, out, err)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1] is equal to [r] and if standard output and
standard error messages match [out] and [err] respectively. The
result of a test is a {!Learnocaml_report.Failure} report otherwise.
Expand All @@ -642,7 +642,7 @@
named [name] by comparing outputs obtained with the student
function against outputs of [rf].
A test [arg-1] results in a {!LearnOcaml_report.Success 1} report
A test [arg-1] results in a {!Learnocaml_report.Success 1} report
if the student function applied to [arg-1] gives the same
result than the solution function [rf] applied to [arg-1]. Otherwise
the result of a test is a {!Learnocaml_report.Failure} report.
Expand All @@ -668,7 +668,7 @@
which must be defined under name [name] in the corresponding
[solution.ml] file.
A test [arg-1] results in a {!LearnOcaml_report.Success 1} report
A test [arg-1] results in a {!Learnocaml_report.Success 1} report
if the student function applied to [arg-1] gives the same
result than the solution function [rf] applied to
[arg-1]. Otherwise the result of a test is a
Expand Down Expand Up @@ -713,7 +713,7 @@
outputs.
A test [(arg-1, arg-2, r, out, err)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1] and [arg-2] is equal to [r] and if standard
output and standard error messages match [out] and [err]
respectively. The result of a test is a
Expand All @@ -738,7 +738,7 @@
named [name] by comparing outputs obtained with the student
function against outputs of [rf].
A test [(arg-1, arg-2)] results in a {!LearnOcaml_report.Success
A test [(arg-1, arg-2)] results in a {!Learnocaml_report.Success
1} report if the student function applied to [arg-1] and
[arg-2] gives the same result than the solution function [rf]
applied to the same arguments. Otherwise the result of a test is a
Expand Down Expand Up @@ -768,7 +768,7 @@
be defined under name [name] in the corresponding [solution.ml]
file.
A test [(arg-1, arg-2)] results in a {!LearnOcaml_report.Success
A test [(arg-1, arg-2)] results in a {!Learnocaml_report.Success
1} report if the student function applied to [arg-1] and
[arg-2] gives the same result than the solution function [rf]
applied to the same arguments. Otherwise the result of a test
Expand Down Expand Up @@ -813,7 +813,7 @@
outputs.
A test [(arg-1, arg-2, arg-3, r, out, err)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2] and [arg-3] is equal to [r] and if
standard output and standard error messages match [out] and
[err] respectively. The result of a test is a
Expand All @@ -838,7 +838,7 @@
function against outputs of [rf].
A test [(arg-1, arg-2, arg-3)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2] and [arg-3] gives the same result
than the solution function [rf] applied to the same
arguments. Otherwise the result of a test is a
Expand Down Expand Up @@ -870,7 +870,7 @@
file.
A test [(arg-1, arg-2, arg-3)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2] and [arg-3] gives the same result
than the solution function [rf] applied to the same
arguments. Otherwise the result of a test is a
Expand Down Expand Up @@ -916,7 +916,7 @@
outputs.
A test [(arg-1, arg-2, arg-3, arg-4, r, out, err)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2], [arg-3] and [arg-4] is equal to
[r] and if standard output and standard error messages match
[out] and [err] respectively. The result of a test is a
Expand All @@ -942,7 +942,7 @@
function against outputs of [rf].
A test [(arg-1, arg-2, arg-3m arg-4)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2], [arg-3] and [arg-4] gives the same
result than the solution function [rf] applied to the same
arguments. Otherwise the result of a test is a
Expand Down Expand Up @@ -972,7 +972,7 @@
[solution.ml] file.
A test [(arg-1, arg-2, arg-3, arg-4)] results in a
{!LearnOcaml_report.Success 1} report if the student function
{!Learnocaml_report.Success 1} report if the student function
applied to [arg-1], [arg-2], [arg-3] and [arg-4] gives the same
result than the solution function [rf] applied to the same
arguments. Otherwise the result of a test is a
Expand Down
2 changes: 0 additions & 2 deletions src/main/learnocaml_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
open Lwt.Infix
open Cmdliner

module StringSet = Set.Make(String)

let ( / ) = Filename.concat

let readlink f =
Expand Down
1 change: 1 addition & 0 deletions src/ppx-metaquot/genlifter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,4 @@ module Main : sig end = struct
Printf.eprintf "** fatal error: %s\n%!" (Printexc.to_string exn)

end
open Main
3 changes: 2 additions & 1 deletion src/repo/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
(name learnocaml_tutorial_parser)
(wrapped false)
(modules Learnocaml_tutorial_parser)
(libraries learnocaml_repository
(libraries str
learnocaml_repository
learnocaml_data
lwt.unix
markup
Expand Down
5 changes: 3 additions & 2 deletions src/toplevel/learnocaml_toplevel_worker_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ let () =
Location.print_loc loc
| e ->
Js_utils.log "FAILED INIT %s" (Printexc.to_string e));
Hashtbl.add Toploop.directive_table
Toploop.add_directive
"debug_worker"
(Toploop.Directive_bool (fun b -> debug := b));
(Toploop.Directive_bool (fun b -> debug := b))
{Toploop.section="Learn-OCaml specific"; doc=""};
Worker.set_onmessage (fun s -> Lwt.async (fun () -> handler s))

(* Register some dynamic modules that are expected by compiled artifacts loaded
Expand Down
2 changes: 1 addition & 1 deletion src/toploop/dune
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
(name toploop_unix)
(wrapped false)
(modes byte)
(libraries toploop dynlink)
(libraries toploop dynlink unix)
(modules Toploop_unix)
)
21 changes: 11 additions & 10 deletions src/toploop/toploop_jsoo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ let split_primitives p =
Array.of_list(split 0 0)

let setup = lazy (
Hashtbl.add Toploop.directive_table "enable"
(Toploop.Directive_string Config.Flag.enable);
Hashtbl.add Toploop.directive_table "disable"
(Toploop.Directive_string Config.Flag.disable);
Hashtbl.add Toploop.directive_table "debug_on"
(Toploop.Directive_string Debug.enable);
Hashtbl.add Toploop.directive_table "debug_off"
(Toploop.Directive_string Debug.disable);
Hashtbl.add Toploop.directive_table "tailcall"
(Toploop.Directive_string (Config.Param.set "tc"));
let info = Toploop.{section="Learn-OCaml specific"; doc=""} in
Toploop.add_directive "enable"
(Toploop.Directive_string Config.Flag.enable) info;
Toploop.add_directive "disable"
(Toploop.Directive_string Config.Flag.disable) info;
Toploop.add_directive "debug_on"
(Toploop.Directive_string Debug.enable) info;
Toploop.add_directive "debug_off"
(Toploop.Directive_string Debug.disable) info;
Toploop.add_directive "tailcall"
(Toploop.Directive_string (Config.Param.set "tc")) info;
(* Workaround Marshal bug triggered by includemod.ml:607 *)
Clflags.error_size := 0 ;
(* Disable inlining of JSOO which may blow the JS stack *)
Expand Down
2 changes: 1 addition & 1 deletion src/toploop/toploop_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ let use_compiled_string code =
let oc = open_out_bin cma in
output_string oc code;
close_out oc;
Topdirs.load_file Format.std_formatter cma
Toploop.load_file Format.std_formatter cma
with
| Symtable.Error e ->
Format.kasprintf (fun msg -> Sys.remove cma; failwith msg)
Expand Down

0 comments on commit b9dc09c

Please sign in to comment.