Skip to content

Commit f75fbf0

Browse files
committed
Fix playground warning printer to run into a stack overflow issue due to endless recursion
1 parent f262f1f commit f75fbf0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jscomp/jsoo/jsoo_playground_main.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,13 @@ module Compile = struct
326326
Buffer.reset warning_buffer;
327327
str
328328

329-
let super_warning_printer loc ppf w =
329+
(* We need to overload the original warning printer to capture the warnings
330+
as an array *)
331+
let playground_warning_printer loc ppf w =
330332
match Warnings.report w with
331333
| `Inactive -> ()
332334
| `Active { Warnings. number; is_error; } ->
333-
!Location.warning_printer loc ppf w;
335+
Location.default_warning_printer loc ppf w;
334336
let open LocWarnInfo in
335337
let fullMsg = flush_warning_buffer () in
336338
let shortMsg = Warnings.message w in
@@ -345,7 +347,7 @@ module Compile = struct
345347

346348
let () =
347349
Location.formatter_for_warnings := warning_ppf;
348-
Location.warning_printer := super_warning_printer
350+
Location.warning_printer := playground_warning_printer
349351

350352
let handle_err e =
351353
(match error_of_exn e with

0 commit comments

Comments
 (0)