Avoid using decl_class_type wherever possible
[hiphop-php.git] / hphp / hack / src / typing / tast_check / tautology_check.ml
bloba1e767b2c4f53d4ba8f84a8b4d0f97121bc2630e
1 (**
2 * Copyright (c) 2018, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 [@@@warning "-33"]
11 open Core_kernel
12 [@@@warning "+33"]
13 open Ast_defs
14 open Tast
16 let trivial_equality_check p bop env ((_, ty1), _ as te1 : expr) ((_, ty2), _ as te2 : expr) =
17 begin match te1, te2 with
18 | (_, Null), ((_, ty), _) | ((_, ty), _), (_, Null) ->
19 Tast_env.assert_nullable p bop env ty
20 | _ -> ()
21 end;
22 Tast_env.assert_nontrivial p bop env ty1 ty2
24 let handler = object
25 inherit Tast_visitor.handler_base
27 method! at_expr env = function
28 | (p, _), Binop ((Eqeqeq | Diff2) as bop, te1, te2) ->
29 trivial_equality_check p bop env te1 te2
30 | _ -> ()
31 end