diff --git a/jscomp/super_errors/super_typetexp.ml b/jscomp/super_errors/super_typetexp.ml index 663c558fdd..31cea956d6 100644 --- a/jscomp/super_errors/super_typetexp.ml +++ b/jscomp/super_errors/super_typetexp.ml @@ -139,17 +139,33 @@ let report_error env ppf = function spellcheck ppf Env.fold_values env lid; | Unbound_module lid -> (* modified *) - fprintf ppf "@[\ - @{The module or file %a can't be found.@}@,@,\ - @[- If it's a third-party dependency:@,\ - - Did you list it in bsconfig.json?@,\ - - @[Did you run `bsb` instead of `bsb -make-world`@ (latter builds third-parties)@]?\ - @]@,\ - - Did you include the file's directory in bsconfig.json?@]\ - @]" - longident lid; + begin match lid with + | Lident "Str" -> + begin + fprintf ppf "@[\ + @{The module or file %a can't be found.@}@,@,\ + Are you trying to use the standard library's Str?@ \ + If you're compiling to JavaScript,@ use @{Js.Re@} instead.@ \ + Otherwise, add str.cma to your ocamlc/ocamlopt command.\ + @]" + longident lid + end + | lid -> + begin + fprintf ppf "@[\ + @{The module or file %a can't be found.@}@,\ + @[- If it's a third-party dependency:@,\ + - Did you list it in bsconfig.json?@,\ + - @[Did you run `bsb` instead of `bsb -make-world`@ (latter builds third-parties)@]?\ + @]@,\ + - Did you include the file's directory in bsconfig.json?@]\ + @]" + longident lid + end + end; spellcheck ppf Env.fold_modules env lid | Unbound_constructor lid -> + (* modified *) fprintf ppf "@[\ @{The variant constructor %a can't be found.@}@,@,\ @[- If it's defined in another module or file, bring it into scope by:@,\ @@ -162,6 +178,7 @@ let report_error env ppf = function Typetexp.spellcheck_simple ppf Env.fold_constructors (fun d -> d.cstr_name) env lid; | Unbound_label lid -> + (* modified *) fprintf ppf "@[\ @{The record field %a can't be found.@}@,@,\ If it's defined in another module or file, bring it into scope by:@,\