"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "analysis/test/integration/methodTest.ml" between
pyre-check-0.0.54.tar.gz and pyre-check-0.0.55.tar.gz

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

methodTest.ml  (pyre-check-0.0.54):methodTest.ml  (pyre-check-0.0.55)
skipping to change at line 249 skipping to change at line 249
# Both have the operator. # Both have the operator.
"foo" >> C() "foo" >> C()
D() >> "foo" D() >> "foo"
D() >> C() D() >> C()
# Neither has the operator. # Neither has the operator.
D() + C() D() + C()
C() << C() C() << C()
|} |}
[ [
"Incompatible parameter type [6]: `<` is not supported for operand types ` "Unsupported operand [58]: `<` is not supported for operand types `int` an
int` and \ d `Optional[int]`.";
`Optional[int]`."; "Unsupported operand [58]: `<` is not supported for operand types `Optiona
"Incompatible parameter type [6]: `<` is not supported for operand types ` l[int]` and `int`.";
Optional[int]` and \ "Unsupported operand [58]: `+` is not supported for operand types `int` an
`int`."; d `Optional[int]`.";
"Incompatible parameter type [6]: `+` is not supported for operand types ` "Unsupported operand [58]: `+` is not supported for operand types `Optiona
int` and \ l[int]` and `int`.";
`Optional[int]`."; "Unsupported operand [58]: `>>` is not supported for operand types `str` a
"Incompatible parameter type [6]: `+` is not supported for operand types ` nd `C`.";
Optional[int]` and \ "Unsupported operand [58]: `>>` is not supported for operand types `D` and
`int`."; `str`.";
"Incompatible parameter type [6]: `>>` is not supported for operand types "Unsupported operand [58]: `>>` is not supported for operand types `D` and
`str` and `C`."; `C`.";
"Incompatible parameter type [6]: `>>` is not supported for operand types "Unsupported operand [58]: `+` is not supported for operand types `D` and
`D` and `str`."; `C`.";
"Incompatible parameter type [6]: `>>` is not supported for operand types "Unsupported operand [58]: `<<` is not supported for operand types `C` and
`D` and `C`."; `C`.";
"Incompatible parameter type [6]: `+` is not supported for operand types `
D` and `C`.";
"Incompatible parameter type [6]: `<<` is not supported for operand types
`C` and `C`.";
]; ];
(* Explicit use of `__lt__` gets the full error message. *) (* Explicit use of `__lt__` gets the full error message. *)
assert_type_errors assert_type_errors
~context ~context
{| {|
from typing import Optional from typing import Optional
x: int x: int
optional_x: Optional[int] optional_x: Optional[int]
x.__lt__(optional_x) x.__lt__(optional_x)
x < optional_x x < optional_x
|} |}
[ [
"Incompatible parameter type [6]: Expected `int` for 1st positional only p arameter to call \ "Incompatible parameter type [6]: Expected `int` for 1st positional only p arameter to call \
`int.__lt__` but got `Optional[int]`."; `int.__lt__` but got `Optional[int]`.";
"Incompatible parameter type [6]: `<` is not supported for operand types ` "Unsupported operand [58]: `<` is not supported for operand types `int` an
int` and \ d `Optional[int]`.";
`Optional[int]`.";
]; ];
(* TODO(T69286342): Inferred literal types give the incompatible parameter typ e error. *) (* TODO(T69286342): Inferred literal types give the incompatible parameter typ e error. *)
assert_type_errors assert_type_errors
~context ~context
{| {|
def foo() -> None: def foo() -> None:
y = 1 y = 1
reveal_type(y) reveal_type(y)
y += "some string" y += "some string"
|} |}
skipping to change at line 347 skipping to change at line 342
{| {|
class C: class C:
pass pass
class D: class D:
def __rshift__(self, other: object) -> int: def __rshift__(self, other: object) -> int:
return 1 return 1
def foo() -> int: def foo() -> int:
return (C() >> D()) return (C() >> D())
|} |}
["Incompatible parameter type [6]: `>>` is not supported for operand types ` C` and `D`."]; ["Unsupported operand [58]: `>>` is not supported for operand types `C` and `D`."];
assert_type_errors assert_type_errors
~context ~context
{| {|
class C: class C:
pass pass
class D: class D:
def __rrshift__(self, left: C) -> C: def __rrshift__(self, left: C) -> C:
return left return left
def foo() -> C: def foo() -> C:
skipping to change at line 397 skipping to change at line 392
assert_type_errors assert_type_errors
~context ~context
{| {|
class C: class C:
def __rrshift__(self, other: int) -> int: def __rrshift__(self, other: int) -> int:
return 1 return 1
def foo() -> None: def foo() -> None:
z = ("foo" >> C()) z = ("foo" >> C())
|} |}
["Incompatible parameter type [6]: `>>` is not supported for operand types ` str` and `C`."]; ["Unsupported operand [58]: `>>` is not supported for operand types `str` an d `C`."];
assert_type_errors assert_type_errors
~context ~context
{| {|
import typing import typing
def foo() -> None: def foo() -> None:
d: typing.Dict[str, typing.Any] = {"foo": 3} d: typing.Dict[str, typing.Any] = {"foo": 3}
z = d["foo"] + d["foo"] z = d["foo"] + d["foo"]
|} |}
(* There should be no attribute error for Any. *) (* There should be no attribute error for Any. *)
[]; [];
skipping to change at line 578 skipping to change at line 573
"Incompatible parameter type [6]: " "Incompatible parameter type [6]: "
^ "Expected `int` for 1st positional only parameter to call `str.substr` b ut got `str`."; ^ "Expected `int` for 1st positional only parameter to call `str.substr` b ut got `str`.";
"Incompatible parameter type [6]: " "Incompatible parameter type [6]: "
^ "Expected `int` for 1st positional only parameter to call `str.substr` b ut got `str`."; ^ "Expected `int` for 1st positional only parameter to call `str.substr` b ut got `str`.";
]; ];
assert_type_errors assert_type_errors
{| {|
def foo(input: str) -> None: def foo(input: str) -> None:
input + 1 input + 1
|} |}
["Incompatible parameter type [6]: `+` is not supported for operand types `s tr` and `int`."]; ["Unsupported operand [58]: `+` is not supported for operand types `str` and `int`."];
assert_type_errors assert_type_errors
{| {|
def foo(input: str) -> str: def foo(input: str) -> str:
return input.__sizeof__() return input.__sizeof__()
|} |}
["Incompatible return type [7]: Expected `str` but got `int`."]; ["Incompatible return type [7]: Expected `str` but got `int`."];
assert_type_errors assert_type_errors
{| {|
def foo(b: str, a: str) -> None: ... def foo(b: str, a: str) -> None: ...
b: int = 1 b: int = 1
 End of changes. 5 change blocks. 
28 lines changed or deleted 23 lines changed or added

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