diff --git a/compiler/driver.ml b/compiler/driver.ml index edf985ef..08f6eef1 100644 --- a/compiler/driver.ml +++ b/compiler/driver.ml @@ -244,19 +244,19 @@ module Passes = struct let avoid_exceptions = avoid_exceptions || closure_conversion in (* --closure-conversion implies --avoid-exceptions *) let prg = - match avoid_exceptions, options.trace, typed with - | true, true, _ -> - Message.error - "Option --avoid-exceptions is not compatible with option --trace" - | true, _, Untyped _ -> + if avoid_exceptions && options.trace then + Message.warning + "It is discouraged to use option @{--avoid-exceptions@} if you@ also@ need@ @{--trace@},@ the@ resulting@ trace@ may@ be@ unreliable@ at@ the@ moment."; + match avoid_exceptions, typed with + | true, Untyped _ -> Lcalc.From_dcalc.translate_program_without_exceptions prg - | true, _, Typed _ -> + | true, Typed _ -> Lcalc.From_dcalc.translate_program_without_exceptions prg - | false, _, Typed _ -> + | false, Typed _ -> Lcalc.From_dcalc.translate_program_with_exceptions prg - | false, _, Untyped _ -> + | false, Untyped _ -> Lcalc.From_dcalc.translate_program_with_exceptions prg - | _, _, Custom _ -> invalid_arg "Driver.Passes.lcalc" + | _, Custom _ -> invalid_arg "Driver.Passes.lcalc" in let prg = if optimize then begin diff --git a/compiler/plugins/api_web.ml b/compiler/plugins/api_web.ml index b080a83c..63cf61fc 100644 --- a/compiler/plugins/api_web.ml +++ b/compiler/plugins/api_web.ml @@ -74,8 +74,7 @@ module To_jsoo = struct (* Tuples are encoded as an javascript polymorphic array. *) Format.fprintf fmt "Js.Unsafe.any_js_array Js.t " | TOption t -> - Format.fprintf fmt "@[(%a)@] %a" format_typ_with_parens t - format_enum_name Expr.option_enum + Format.fprintf fmt "@[(%a)@] Js.opt" format_typ_with_parens t | TDefault t -> format_typ fmt t | TEnum e -> Format.fprintf fmt "%a Js.t" format_enum_name e | TArray t1 -> @@ -116,7 +115,8 @@ module To_jsoo = struct elts | TOption t -> Format.fprintf fmt - "(function Eoption.ENone -> Js.null | Eoption.ESome x -> %a x)" + "(function Eoption.ENone () -> Js.null | Eoption.ESome x -> Js.some \ + (%a x))" format_to_js t | TAny -> Format.fprintf fmt "Js.Unsafe.inject" | TArrow _ | TClosureEnv -> ()