"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "analysis/typeCheck.ml" between
pyre-check-0.0.53.tar.gz and pyre-check-0.0.54.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

typeCheck.ml  (pyre-check-0.0.53):typeCheck.ml  (pyre-check-0.0.54)
skipping to change at line 2608 skipping to change at line 2608
>>= forward_method ~method_name:"__eq__" ~arguments:[left] >>= forward_method ~method_name:"__eq__" ~arguments:[left]
|> Option.value |> Option.value
~default: ~default:
{ {
Resolved.resolution; Resolved.resolution;
errors; errors;
resolved = Type.Top; resolved = Type.Top;
resolved_annotation = None; resolved_annotation = None;
base = None; base = None;
} }
| None -> | None -> (
let getitem_attribute =
{
Node.location;
value =
Expression.Name
(Name.Attribute
{ base = right; attribute = "__getitem__"; specia
l = true });
}
in
let call = let call =
let getitem = let getitem =
{ {
Node.location; Node.location;
value = value =
Expression.Call Expression.Call
{ {
callee = callee = getitem_attribute;
{
Node.location;
value =
Name
(Name.Attribute
{
base = right;
attribute = "__getitem__";
special = true;
});
};
arguments = arguments =
[ [
{ {
Call.Argument.name = None; Call.Argument.name = None;
value = { Node.location; value = Expressio n.Integer 0 }; value = { Node.location; value = Expressio n.Integer 0 };
}; };
]; ];
}; };
} }
in in
skipping to change at line 2655 skipping to change at line 2653
Node.location; Node.location;
value = value =
Name Name
(Name.Attribute (Name.Attribute
{ base = getitem; attribute = "__eq__"; special = true }); { base = getitem; attribute = "__eq__"; special = true });
}; };
arguments = [{ Call.Argument.name = None; value = left }]; arguments = [{ Call.Argument.name = None; value = left }];
}; };
} }
in in
forward_expression ~resolution ~expression:call ) let ({ Resolved.resolved; _ } as getitem_resolution) =
forward_expression ~resolution ~expression:getitem_attribu
te
in
match resolved with
| Type.Parametric
{
name = "BoundMethod";
parameters =
[
Single
(Type.Callable
{
implementation =
{ parameters = Defined (_ :: index_paramet
er :: _); _ };
_;
});
_;
];
}
| Type.Callable
{
implementation = { parameters = Defined (_ :: index_pa
rameter :: _); _ };
_;
}
when GlobalResolution.less_or_equal
global_resolution
~left:Type.integer
~right:
( Type.Callable.Parameter.annotation index_parame
ter
|> Option.value ~default:Type.Bottom ) ->
(* TODO: Throw new error type here warning on invalid me
mbership check. *)
forward_expression ~resolution ~expression:call
| _ -> { getitem_resolution with Resolved.resolved = Type.An
y } ) )
in in
resolution, errors, GlobalResolution.join global_resolution joined_ann otation resolved resolution, errors, GlobalResolution.join global_resolution joined_ann otation resolved
in in
let { Resolved.resolution; resolved; errors; _ } = let { Resolved.resolution; resolved; errors; _ } =
forward_expression ~resolution ~expression:right forward_expression ~resolution ~expression:right
in in
let resolution, errors, resolved = let resolution, errors, resolved =
(* We should really error here if resolve_class fails *) (* We should really error here if resolve_class fails *)
Type.resolve_class resolved Type.resolve_class resolved
>>| List.fold ~f:resolve_in_call ~init:(resolution, errors, Type.Botto m) >>| List.fold ~f:resolve_in_call ~init:(resolution, errors, Type.Botto m)
 End of changes. 3 change blocks. 
14 lines changed or deleted 51 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)