From 10cab3121ec81fe5a1e78b98a69b5d7017c83bb4 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Fri, 6 Apr 2018 04:24:59 -0700 Subject: [PATCH] [Super errors] No need for fallback location printing See updated comment. Test plan: this path is never reached for normal files. Try this in e.g. the playground where file is actually "". See no more double location reporting. --- jscomp/super_errors/super_location.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jscomp/super_errors/super_location.ml b/jscomp/super_errors/super_location.ml index 9835b2ebe6..a579f61260 100644 --- a/jscomp/super_errors/super_location.ml +++ b/jscomp/super_errors/super_location.ml @@ -106,8 +106,9 @@ let print ~is_warning intro ppf loc = (Super_misc.print_file ~is_warning ~lines ~range) () with - (* this shouldn't happen, but gracefully fall back to the default reporter just in case *) - | Sys_error _ -> Location.print ppf loc + (* this might happen if the file is e.g. "", "_none_" or any of the fake file name placeholders. + we've already printed the location above, so nothing more to do here. *) + | Sys_error _ -> () end ;;