Skip to content

Commit

Permalink
remove chain unsoundness kind, replace with mixed
Browse files Browse the repository at this point in the history
Summary: These types did not need to be `any`, and it's always safe to type them as `mixed`.

Reviewed By: panagosg7

Differential Revision: D14676204

fbshipit-source-id: 772a2b64dfb40b9a81d678ba8369cc82202f0c17
  • Loading branch information
Daniel Sainati authored and facebook-github-bot committed Apr 1, 2019
1 parent 79c525e commit 60fdca2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
15 changes: 6 additions & 9 deletions src/typing/statement.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3514,8 +3514,7 @@ and subscript =
Error_message.(EUnsupportedSyntax (loc, RequireDynamicArgument));
AnyT.at AnyError loc, List.map Tast_utils.error_mapper#expression_or_spread arguments
) in
(* TODO(vijayramamurthy) type of require ? *)
let id_t = Unsoundness.at Chain callee_loc in
let id_t = bogus_trust () |> MixedT.at callee_loc in
ex, lhs_t, acc, (
(loc, lhs_t),
call_ast { Call.
Expand Down Expand Up @@ -3596,8 +3595,7 @@ and subscript =
AnyT.at AnyError loc,
List.map Tast_utils.error_mapper#expression_or_spread arguments
) in
(* TODO(vijayramamurthy) does "requireLazy" have a type? *)
let id_t = Unsoundness.at Chain callee_loc in
let id_t = bogus_trust () |> MixedT.at callee_loc in
ex, lhs_t, acc, (
(loc, lhs_t),
call_ast { Call.
Expand All @@ -3621,7 +3619,7 @@ and subscript =
in
ex, lhs_t, acc, (
(loc, lhs_t),
let t = Unsoundness.at Chain callee_loc in
let t = bogus_trust () |> MixedT.at callee_loc in
call_ast { Call.
(* TODO(vijayramamurthy): what is the type of `Object.name` ? *)
callee = (callee_loc, t), Member { Member.
Expand Down Expand Up @@ -3724,8 +3722,7 @@ and subscript =
let reason_call = mk_reason (RMethodCall None) loc in
let reason_lookup = mk_reason (RProperty None) lookup_loc in
let (_, elem_t), _ as expr = expression cx expr in
(* TODO: (pvekris) T33113417 make type more precise *)
(Unsoundness.at Chain lookup_loc,
(bogus_trust () |> MixedT.at lookup_loc,
Tvar.mk_where cx reason_call (fun t ->
let frame = Env.peek_frame () in
let funtype = mk_methodcalltype ot targts argts t ~frame in
Expand Down Expand Up @@ -4049,7 +4046,7 @@ and subscript =
member_ast { Member._object = _object_ast; property; }
)
| ContinueChain ->
let tout = Unsoundness.at Chain ploc in
let tout = bogus_trust () |> MixedT.at ploc in
let opt_use = get_prop_opt_use ~is_cond expr_reason ~use_op (prop_reason, name) in
let step = ref (loc, opt_use, tout) in
let lhs, lhs_t, chain, ((_, tobj), _ as _object_ast) =
Expand Down Expand Up @@ -4101,7 +4098,7 @@ and subscript =
member_ast { Member._object = _object_ast; property; }
)
| ContinueChain ->
let tout = Unsoundness.at Chain ploc in
let tout = bogus_trust () |> MixedT.at ploc in
let opt_use = get_private_field_opt_use expr_reason ~use_op name in
let step = ref (loc, opt_use, tout) in
let lhs, lhs_t, chain, ((_, tobj), _ as _object_ast) =
Expand Down
3 changes: 0 additions & 3 deletions src/typing/type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ module rec TypeTerm : sig
your use case, make one *)
and unsoundness_kind =
| BoundFunctionThis
| Chain
| ComputedNonLiteralKey
| Constructor
| DummyStatic
Expand Down Expand Up @@ -2869,7 +2868,6 @@ module AnyT = struct
end

module Unsoundness = struct
let chain = Unsound Chain
let constructor = Unsound Constructor
let computed_nonlit_key = Unsound ComputedNonLiteralKey
let function_proto = Unsound FunctionPrototype
Expand All @@ -2895,7 +2893,6 @@ module Unsoundness = struct
let unimplemented_any = AnyT.make unimplemented
let weak_context_any = AnyT.make weak_context
let inference_hooks_any = AnyT.make inference_hooks
let chain_any = AnyT.make chain
let exports_any = AnyT.make exports
let existential_any = AnyT.make existential
let bound_fn_this_any = AnyT.make bound_fn_this
Expand Down

0 comments on commit 60fdca2

Please sign in to comment.