"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "analysis/test/integration/controlFlowTest.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).

controlFlowTest.ml  (pyre-check-0.0.54):controlFlowTest.ml  (pyre-check-0.0.55)
skipping to change at line 16 skipping to change at line 16
*) *)
open OUnit2 open OUnit2
open IntegrationTest open IntegrationTest
let test_scheduling context = let test_scheduling context =
let assert_type_errors = assert_type_errors ~context in let assert_type_errors = assert_type_errors ~context in
(* Top-level is scheduled. *) (* Top-level is scheduled. *)
assert_type_errors assert_type_errors
"'string' + 1" "'string' + 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`."];
(* Functions are scheduled. *) (* Functions are scheduled. *)
assert_type_errors assert_type_errors
{| {|
def bar() -> None: ... def bar() -> None: ...
def foo() -> None: def foo() -> None:
'string' + 1 'string' + 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 bar() -> None: def bar() -> None:
def foo() -> None: def foo() -> None:
'string' + 1 'string' + 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`."];
(* Class bodies are scheduled. *) (* Class bodies are scheduled. *)
assert_type_errors assert_type_errors
{| {|
class Foo: class Foo:
'string' + 1 'string' + 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`."];
(* Methods are scheduled. *) (* Methods are scheduled. *)
assert_type_errors assert_type_errors
{| {|
class Foo: class Foo:
def foo(self) -> None: def foo(self) -> None:
'string' + 1 'string' + 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`."];
(* Property getters and setters are both scheduled *) (* Property getters and setters are both scheduled *)
assert_type_errors assert_type_errors
{| {|
class Foo: class Foo:
@property @property
def foo(self) -> int: def foo(self) -> int:
return "abc" return "abc"
@foo.setter @foo.setter
def foo(self, value: int) -> None: def foo(self, value: int) -> None:
skipping to change at line 174 skipping to change at line 174
let assert_type_errors = assert_type_errors ~context in let assert_type_errors = assert_type_errors ~context in
assert_type_errors assert_type_errors
{| {|
from typing import Optional from typing import Optional
def foo(x: Optional[int]) -> int: def foo(x: Optional[int]) -> int:
if x > 42: if x > 42:
return 0 return 0
else: else:
return 1 return 1
|} |}
[ ["Unsupported operand [58]: `>` is not supported for operand types `Optional
"Incompatible parameter type [6]: `>` is not supported for operand types ` [int]` and `int`."];
Optional[int]` and \
`int`.";
];
assert_type_errors assert_type_errors
{| {|
import typing import typing
def foo() -> int: def foo() -> int:
x: typing.Optional[int] x: typing.Optional[int]
y: int y: int
z = x if x else y z = x if x else y
return z return z
|} |}
[]; [];
 End of changes. 6 change blocks. 
10 lines changed or deleted 7 lines changed or added

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