Skip to content

Commit

Permalink
[flow][errors] Remove unused EMissingAnnot
Browse files Browse the repository at this point in the history
Summary: Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D56168350

fbshipit-source-id: 372d7e745b9ba3fbb22bdbbc782a08ae70975967
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Apr 16, 2024
1 parent 741db67 commit 9e8318e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
2 changes: 0 additions & 2 deletions src/common/errors/error_codes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ type error_code =
| LintSetting
| MalformedPackage
| MethodUnbinding
| MissingAnnot
| MissingLocalAnnot
| MissingThisAnnot
| MissingArg
Expand Down Expand Up @@ -325,7 +324,6 @@ let string_of_code : error_code -> string = function
| LintSetting -> "lint-setting"
| MalformedPackage -> "malformed-package"
| MethodUnbinding -> "method-unbinding"
| MissingAnnot -> "missing-annot"
| MissingLocalAnnot -> "missing-local-annot"
| MissingThisAnnot -> "missing-this-annot"
| MissingArg -> "missing-arg"
Expand Down
1 change: 0 additions & 1 deletion src/typing/debug_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,6 @@ let dump_error_message =
| EInternal (loc, err) -> spf "EInternal (%s, %s)" (string_of_aloc loc) (dump_internal_error err)
| EUnsupportedSyntax (loc, _) -> spf "EUnsupportedSyntax (%s, _)" (string_of_aloc loc)
| EUseArrayLiteral loc -> spf "EUseArrayLiteral (%s)" (string_of_aloc loc)
| EMissingAnnotation (reason, _) -> spf "EMissingAnnotation (%s)" (dump_reason cx reason)
| EMissingLocalAnnotation { reason; _ } ->
spf "EMissingLocalAnnotation (%s)" (dump_reason cx reason)
| EBindingError (_binding_error, loc, x, entry_loc) ->
Expand Down
30 changes: 0 additions & 30 deletions src/typing/errors/error_message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ and 'loc t' =
| EInternal of 'loc * internal_error
| EUnsupportedSyntax of 'loc * unsupported_syntax
| EUseArrayLiteral of 'loc
| EMissingAnnotation of 'loc virtual_reason * 'loc virtual_reason list
| EMissingLocalAnnotation of {
reason: 'loc virtual_reason;
hint_available: bool;
Expand Down Expand Up @@ -1179,7 +1178,6 @@ let rec map_loc_of_error_message (f : 'a -> 'b) : 'a t' -> 'b t' =
| EInternal (loc, i) -> EInternal (f loc, i)
| EUnsupportedSyntax (loc, u) -> EUnsupportedSyntax (f loc, u)
| EUseArrayLiteral loc -> EUseArrayLiteral (f loc)
| EMissingAnnotation (r, rs) -> EMissingAnnotation (map_reason r, Base.List.map ~f:map_reason rs)
| EMissingLocalAnnotation { reason; hint_available; from_generic_function } ->
EMissingLocalAnnotation { reason = map_reason reason; hint_available; from_generic_function }
| EBindingError (b, loc, s, scope) -> EBindingError (b, f loc, s, scope)
Expand Down Expand Up @@ -1652,7 +1650,6 @@ let util_use_op_of_msg nope util = function
| EInternal (_, _)
| EUnsupportedSyntax (_, _)
| EUseArrayLiteral _
| EMissingAnnotation _
| EMissingLocalAnnotation _
| EBindingError (_, _, _, _)
| ERecursionLimit (_, _)
Expand Down Expand Up @@ -1801,7 +1798,6 @@ let loc_of_msg : 'loc t' -> 'loc option = function
| EInstanceofRHS reason
| EArithmeticOperand reason
| ERecursionLimit (reason, _)
| EMissingAnnotation (reason, _)
| EMissingLocalAnnotation { reason; _ }
| EComponentMissingReturn reason
| ENestedComponent reason
Expand Down Expand Up @@ -3203,31 +3199,6 @@ let friendly_message_of_msg loc_of_aloc msg =
Normal { features }
| EUseArrayLiteral _ ->
Normal { features = [text "Use an array literal instead of "; code "new Array(...)"; text "."] }
| EMissingAnnotation (reason, _) ->
let default = [text "Missing type annotation for "; desc reason; text "."] in
let features =
match desc_of_reason reason with
| RTypeParam (_, (reason_op_desc, reason_op_loc), (reason_tapp_desc, reason_tapp_loc)) ->
let reason_op = mk_reason reason_op_desc reason_op_loc in
let reason_tapp = mk_reason reason_tapp_desc reason_tapp_loc in
default
@ [
text " ";
desc reason;
text " is a type parameter declared in ";
ref reason_tapp;
text " and was implicitly instantiated at ";
ref reason_op;
text ".";
]
| _ -> default
in
(* We don't collect trace info in the assert_ground_visitor because traces
* represent tests of lower bounds to upper bounds, and the assert_ground
* visitor is just visiting types. Instead, we collect a list of types we
* visited to get to the missing annotation error and report that as the
* trace *)
Normal { features }
| EMissingLocalAnnotation { reason; hint_available; from_generic_function } ->
if hint_available then
Normal
Expand Down Expand Up @@ -5777,7 +5748,6 @@ let error_code_of_message err : error_code option =
| EInvalidInfer _ -> Some InvalidInfer
| EInvalidExtends _ -> Some InvalidExtends
| ELintSetting _ -> Some LintSetting
| EMissingAnnotation _ -> Some MissingAnnot
| EMissingLocalAnnotation { reason; hint_available = _; from_generic_function = _ } -> begin
match desc_of_reason reason with
| RImplicitThis _ -> Some MissingThisAnnot
Expand Down

0 comments on commit 9e8318e

Please sign in to comment.