improve error message and position for "bad decl override" error
commit62a447f45a7ab29a60b038922a3ec8c395a87c28
authorCatherine Gasnier <catg@fb.com>
Mon, 7 Mar 2022 13:20:41 +0000 (7 05:20 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 7 Mar 2022 13:20:41 +0000 (7 05:20 -0800)
tree1703921162202125258823e2a6e1a9eda58aae68
parent68086cd00f26e3d65f11342f8b20ca92910c1992
improve error message and position for "bad decl override" error

Summary:
See the fixed test cases below for examples of the change.
Now that we have wired down AST positions of a class' immediate parents, we can have a more precise position for some of the errors produced by Typing_extends.
In this diff, the primary position for "bad decl override" error is now on the implemented interface instead of the class implementing it.

Differential Revision: D34583307

fbshipit-source-id: 24aff361e542cb2f70f2a8d8dd041a58f52dee39
78 files changed:
hphp/hack/src/errors/typing_error.ml
hphp/hack/src/errors/typing_error.mli
hphp/hack/src/typing/typing_extends.ml
hphp/hack/test/fanout/class_class_const_change_type.php.incr_no_old_decls.exp
hphp/hack/test/fanout/class_class_const_change_type.php.incr_old_decl.exp
hphp/hack/test/fanout/class_class_const_change_type.php.saved_state.exp
hphp/hack/test/typecheck/abstract_parent_override_interface.php.exp
hphp/hack/test/typecheck/abstract_redeclare_abstract_class_constant_bad.php.exp
hphp/hack/test/typecheck/abstract_typeconsts/redeclare_no_default.php.exp
hphp/hack/test/typecheck/abstract_typeconsts/redeclare_no_default2.php.exp
hphp/hack/test/typecheck/ambiguous_constructor.php.exp
hphp/hack/test/typecheck/ambiguous_declaration_concrete.php.exp
hphp/hack/test/typecheck/ambiguous_declaration_one_synthetic_1.php.exp
hphp/hack/test/typecheck/ambiguous_declaration_one_synthetic_2.php.exp
hphp/hack/test/typecheck/ambiguous_declaration_one_synthetic_3.php.exp
hphp/hack/test/typecheck/ambiguous_distant_constructor.php.exp
hphp/hack/test/typecheck/ambiguous_inheritance.php.exp
hphp/hack/test/typecheck/bad_decl_override.php.exp
hphp/hack/test/typecheck/check_override_synthesized_traits.php.exp
hphp/hack/test/typecheck/class_level_where_clauses/this_as/trait_method_lookup_02.php.exp
hphp/hack/test/typecheck/concrete_redeclare_concrete_class_constant_bad.php.exp
hphp/hack/test/typecheck/const_attribute/redeclare_from_const_in_trait.php.exp
hphp/hack/test/typecheck/const_attribute/redeclare_from_const_in_trait.php.legacy_decl.exp
hphp/hack/test/typecheck/const_attribute/redeclare_from_const_via_trait.php.exp
hphp/hack/test/typecheck/const_attribute/redeclare_from_const_via_trait.php.legacy_decl.exp
hphp/hack/test/typecheck/const_attribute/redeclare_to_const_in_trait.php.exp
hphp/hack/test/typecheck/const_attribute/redeclare_to_const_in_trait.php.legacy_decl.exp
hphp/hack/test/typecheck/const_attribute/static/abstract/abstract_inherits_from_traits.php.exp
hphp/hack/test/typecheck/const_attribute/static/abstract/abstract_inherits_from_traits.php.legacy_decl.exp
hphp/hack/test/typecheck/const_attribute/static/multiple_concrete_defs_from_traits_bad.php.exp
hphp/hack/test/typecheck/const_attribute/static/multiple_concrete_defs_from_traits_bad.php.legacy_decl.exp
hphp/hack/test/typecheck/const_attribute/static/multiple_concrete_defs_from_traits_good.php.exp
hphp/hack/test/typecheck/const_attribute/static/multiple_concrete_defs_from_traits_good.php.legacy_decl.exp
hphp/hack/test/typecheck/const_in_interface_overridden1_bad.php.exp
hphp/hack/test/typecheck/const_in_interface_overridden2_bad.php.exp
hphp/hack/test/typecheck/const_in_interface_overridden3_bad.php.exp
hphp/hack/test/typecheck/construct/lateinit/lateinit8.php.exp
hphp/hack/test/typecheck/construct/lateinit/lateinit8.php.legacy_decl.exp
hphp/hack/test/typecheck/dynamic_calls/override3.php.exp
hphp/hack/test/typecheck/enum_class/abstract.bad.php.exp
hphp/hack/test/typecheck/enum_class/typing.extends5.bad.php.exp
hphp/hack/test/typecheck/enum_class/typing.extends5.bad.php.legacy_decl.exp
hphp/hack/test/typecheck/enum_class/typing.multiple.extends.vshape.bad.php.exp
hphp/hack/test/typecheck/ifc/ifc_inheritance7.php.exp
hphp/hack/test/typecheck/interface_constructor.php.exp
hphp/hack/test/typecheck/interface_override_parent.php.exp
hphp/hack/test/typecheck/interface_override_trait.php.exp
hphp/hack/test/typecheck/interface_override_trait1.php.exp
hphp/hack/test/typecheck/invalid_override_of_req_extends_typeconst.php.exp
hphp/hack/test/typecheck/multiple_concrete_consts.php.exp
hphp/hack/test/typecheck/multiple_traits_require_implements.php.exp
hphp/hack/test/typecheck/multiple_traits_require_implements.php.legacy_decl.exp
hphp/hack/test/typecheck/override/override_final2.php.exp
hphp/hack/test/typecheck/override/override_final4.php.exp
hphp/hack/test/typecheck/override/override_final7.php.exp
hphp/hack/test/typecheck/parent_override_trait2.php.exp
hphp/hack/test/typecheck/stricter_consts/class_interface_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/class_trait_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_class_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_class_interface_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_class_interface_class_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_interface_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_trait_2.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/interface_trait_class_interface_trait_class_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/trait_class_trait_class_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/trait_trait_1.bad.php.exp
hphp/hack/test/typecheck/stricter_consts/trait_typeconst_1.bad.php.exp
hphp/hack/test/typecheck/tconst/interface2.php.exp
hphp/hack/test/typecheck/test_consts13.php.exp
hphp/hack/test/typecheck/test_consts14.php.exp
hphp/hack/test/typecheck/trait_ambiguous_multi.php.exp
hphp/hack/test/typecheck/trait_override_final.php.exp
hphp/hack/test/typecheck/trait_priv_multi.php.exp
hphp/hack/test/typecheck/typeconsts/interface_override_parent.php.exp
hphp/hack/test/typecheck/typeconsts/interface_override_parent1.php.exp
hphp/hack/test/typecheck/typeconsts/interface_override_trait.php.exp
hphp/hack/test/typecheck/typeconsts/interface_override_trait2.php.exp
hphp/hack/test/typecheck/typeconsts/linearization.php.exp