diff --git a/src/typing/debug_js.ml b/src/typing/debug_js.ml index 4c52ed1290b..492f2f9aca5 100644 --- a/src/typing/debug_js.ml +++ b/src/typing/debug_js.ml @@ -1041,7 +1041,13 @@ and dump_tvar_ (depth, tvars) cx id = | Goto goto -> spf "%d, Goto %d" id goto.parent | Root { constraints = Resolved t; _ } -> spf "%d, Resolved %s" id (dump_t_ (depth - 1, stack) cx t) - | Root { constraints = FullyResolved _; _ } -> spf "%d, FullyResolved" id + | Root { constraints = FullyResolved s; _ } -> + let payload = + match ForcingState.get_forced s with + | None -> "unevaluated" + | Some t -> dump_t_ (depth - 1, stack) cx t + in + spf "%d, FullyResolved %s" id payload | Root { constraints = Unresolved { lower; upper; _ }; _ } -> if lower = TypeMap.empty && upper = UseTypeMap.empty then spf "%d" id diff --git a/src/typing/type.ml b/src/typing/type.ml index b6adcd63850..7e8de8f6bde 100644 --- a/src/typing/type.ml +++ b/src/typing/type.ml @@ -3238,6 +3238,8 @@ module Constraint = struct val force : on_error:(Reason.t -> TypeTerm.t) -> t -> TypeTerm.t + val get_forced : t -> TypeTerm.t option + val map : f:(TypeTerm.t -> TypeTerm.t) -> t -> t end = struct type state = @@ -3269,6 +3271,13 @@ module Constraint = struct s.state <- Forced; t + let get_forced s = + match s.state with + | Unforced + | Forcing -> + None + | Forced -> Some (Lazy.force_val s.valid) + let map ~f s = { valid = Lazy.map f s.valid; error_reason = s.error_reason; state = Unforced } end