Demote option mixed/null error to a lint
commit04b4d0f60b2f37318d0d2a84ebefa1e0fd551fba
authorMistral Contrastin <mojpc2@meta.com>
Mon, 7 Nov 2022 14:31:48 +0000 (7 06:31 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 7 Nov 2022 14:31:48 +0000 (7 06:31 -0800)
tree7bc2456686e18d3fbfcd73ddad409c725441bad6
parent5625c300ccbbbd9b9b4e049a475017353ebd5213
Demote option mixed/null error to a lint

Summary:
This error is not really an error as both the static and dynamic semantics can handle it well. It is only a redundancy. It breaks the substitution property and is non-monotonic (specialising a generic to `?mixed` and `?null` leads to an error.)

This diff demotes the error to a lint warning.

Reviewed By: vsiles

Differential Revision: D41060133

fbshipit-source-id: 935fa22eeb19334c510972afc7a1ea458ad5973e
23 files changed:
hphp/hack/src/errors/error_codes.ml
hphp/hack/src/errors/typing_error.ml
hphp/hack/src/errors/typing_error.mli
hphp/hack/src/oxidized/gen/error_codes.rs
hphp/hack/src/typing/typing_type_wellformedness.ml
hphp/hack/src/utils/lint/lint.ml
hphp/hack/src/utils/lint/lint.mli
hphp/hack/src/utils/lint/lint_codes.ml
hphp/hack/test/lint/redundant_mixed_option.php [new file with mode: 0644]
hphp/hack/test/lint/redundant_mixed_option.php.exp [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed.php [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed.php.exp [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed_expression_trees.php [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed_expression_trees.php.exp [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed_expression_trees_virtualized.php [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_mixed_expression_trees_virtualized.php.exp [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_null.php [new file with mode: 0644]
hphp/hack/test/lint/redundant_option_null.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/expression_trees/hint_wellformed.php.exp
hphp/hack/test/typecheck/expression_trees_not_virtualize_functions/hint_wellformed.php.exp
hphp/hack/test/typecheck/mixed_option.php.exp
hphp/hack/test/typecheck/null/option_null.php.exp
hphp/hack/test/typecheck/option_mixed.php.exp