-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new format for type eval snapshots
- Loading branch information
Showing
14 changed files
with
130 additions
and
1,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...derpy_python_type_checker__type_check__type_evaluator__tests__type_evaluator@base.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
source: typechecker/src/type_check/type_evaluator.rs | ||
description: "a = 1\nb = \"1\"\nc = True\nd = False\na + int(b)\n\na + c\n\ndef func(param1: int) -> int:\n\treturn param1 + a\n\nclass C:\n\tcls_attribute = 1\n\n\tdef __init__(self, x: int):\n\t\tprint(self.cls_attribute)\n\t\tself.x = x\n\t\tprint(self.x)\n\n\tdef add(self, value: int):\n\t\tself.cls_attribute += value\n\nt = C(0)\nt.add(2)\nt.cls_attribute\nt.x\n\nl = [1,2,3]\nd = {\"a\": 1, \"b\": 2}\ns = {1,2,3}\n\nl.append(1)\n" | ||
expression: result | ||
input_file: typechecker/test_data/inputs/base.py | ||
--- | ||
'1': Int | ||
'"1"': Str | ||
'True': Bool | ||
'False': Bool | ||
'a': Int | ||
'int(b)': Class(ClassType { details: Class { name: "int", declaration_path: DeclarationPath { module_name: [TYPESHED].stdlib/builtins.pyi", node: Node { start: 7961, end: 12343 } }, methods: ["__new__", "__new__", "real", "imag", "numerator", "denominator", "conjugate", "bit_length", "__add__", "__sub__", "__mul__", "__floordiv__", "__truediv__", "__mod__", "__divmod__", "__radd__", "__rsub__", "__rmul__", "__rfloordiv__", "__rtruediv__", "__rmod__", "__rdivmod__", "__pow__", "__pow__", "__pow__", "__pow__", "__pow__", "__pow__", "__rpow__", "__and__", "__or__", "__xor__", "__lshift__", "__rshift__", "__rand__", "__ror__", "__rxor__", "__rlshift__", "__rrshift__", "__neg__", "__pos__", "__invert__", "__trunc__", "__ceil__", "__floor__", "__round__", "__getnewargs__", "__eq__", "__ne__", "__lt__", "__le__", "__gt__", "__ge__", "__float__", "__int__", "__abs__", "__hash__", "__bool__", "__index__"], attributes: {}, special: false }, type_parameters: [] }) | ||
'a': Int | ||
'c': Bool | ||
'param1': Unknown | ||
'param1 + a': Int | ||
'a': Int | ||
'1': Int | ||
'print(self.cls_attribute)': Callable(CallableType { name: "print", arguments: Arguments { node: Node { start: 69733, end: 69857 }, posonlyargs: [], args: [], vararg: Some(Arg { node: Node { start: 69734, end: 69748 }, arg: "values", annotation: Some(Name(Name { node: Node { start: 69742, end: 69748 }, id: "object" })) }), kwonlyargs: [Arg { node: Node { start: 69750, end: 69771 }, arg: "sep", annotation: Some(BinOp(BinOp { node: Node { start: 69755, end: 69765 }, op: BitOr, left: Name(Name { node: Node { start: 69755, end: 69758 }, id: "str" }), right: Constant(Constant { node: Node { start: 69761, end: 69765 }, value: None }) })) }, Arg { node: Node { start: 69773, end: 69795 }, arg: "end", annotation: Some(BinOp(BinOp { node: Node { start: 69778, end: 69788 }, op: BitOr, left: Name(Name { node: Node { start: 69778, end: 69781 }, id: "str" }), right: Constant(Constant { node: Node { start: 69784, end: 69788 }, value: None }) })) }, Arg { node: Node { start: 69797, end: 69844 }, arg: "file", annotation: Some(BinOp(BinOp { node: Node { start: 69803, end: 69837 }, op: BitOr, left: Subscript(Subscript { node: Node { start: 69803, end: 69830 }, value: Name(Name { node: Node { start: 69803, end: 69825 }, id: "_SupportsWriteAndFlush" }), slice: Name(Name { node: Node { start: 69826, end: 69829 }, id: "str" }) }), right: Constant(Constant { node: Node { start: 69833, end: 69837 }, value: None }) })) }, Arg { node: Node { start: 69846, end: 69857 }, arg: "flush", annotation: Some(Name(Name { node: Node { start: 69853, end: 69857 }, id: "bool" })) }], kw_defaults: [Some(Constant(Constant { node: Node { start: 69768, end: 69771 }, value: " " })), Some(Constant(Constant { node: Node { start: 69791, end: 69795 }, value: "\n" })), Some(Constant(Constant { node: Node { start: 69840, end: 69844 }, value: None })), None], kwarg: None, defaults: [] }, return_type: None }) | ||
'self.cls_attribute': Unknown | ||
'x': Unknown | ||
'print(self.x)': Callable(CallableType { name: "print", arguments: Arguments { node: Node { start: 69733, end: 69857 }, posonlyargs: [], args: [], vararg: Some(Arg { node: Node { start: 69734, end: 69748 }, arg: "values", annotation: Some(Name(Name { node: Node { start: 69742, end: 69748 }, id: "object" })) }), kwonlyargs: [Arg { node: Node { start: 69750, end: 69771 }, arg: "sep", annotation: Some(BinOp(BinOp { node: Node { start: 69755, end: 69765 }, op: BitOr, left: Name(Name { node: Node { start: 69755, end: 69758 }, id: "str" }), right: Constant(Constant { node: Node { start: 69761, end: 69765 }, value: None }) })) }, Arg { node: Node { start: 69773, end: 69795 }, arg: "end", annotation: Some(BinOp(BinOp { node: Node { start: 69778, end: 69788 }, op: BitOr, left: Name(Name { node: Node { start: 69778, end: 69781 }, id: "str" }), right: Constant(Constant { node: Node { start: 69784, end: 69788 }, value: None }) })) }, Arg { node: Node { start: 69797, end: 69844 }, arg: "file", annotation: Some(BinOp(BinOp { node: Node { start: 69803, end: 69837 }, op: BitOr, left: Subscript(Subscript { node: Node { start: 69803, end: 69830 }, value: Name(Name { node: Node { start: 69803, end: 69825 }, id: "_SupportsWriteAndFlush" }), slice: Name(Name { node: Node { start: 69826, end: 69829 }, id: "str" }) }), right: Constant(Constant { node: Node { start: 69833, end: 69837 }, value: None }) })) }, Arg { node: Node { start: 69846, end: 69857 }, arg: "flush", annotation: Some(Name(Name { node: Node { start: 69853, end: 69857 }, id: "bool" })) }], kw_defaults: [Some(Constant(Constant { node: Node { start: 69768, end: 69771 }, value: " " })), Some(Constant(Constant { node: Node { start: 69791, end: 69795 }, value: "\n" })), Some(Constant(Constant { node: Node { start: 69840, end: 69844 }, value: None })), None], kwarg: None, defaults: [] }, return_type: None }) | ||
'self.x': Unknown | ||
'C(0)': Unknown | ||
'(2)': Unknown | ||
'2': Int | ||
'[1,2,3]': Class(ClassType { details: Class { name: "list", declaration_path: DeclarationPath { module_name: [TYPESHED].stdlib/builtins.pyi", node: Node { start: 43505, end: 46298 } }, methods: ["__init__", "__init__", "copy", "append", "extend", "pop", "index", "count", "insert", "remove", "sort", "sort", "__len__", "__iter__", "__getitem__", "__getitem__", "__setitem__", "__setitem__", "__delitem__", "__add__", "__add__", "__iadd__", "__mul__", "__rmul__", "__imul__", "__contains__", "__reversed__", "__gt__", "__ge__", "__lt__", "__le__", "__eq__"], attributes: {}, special: false }, type_parameters: [Int] }) | ||
'{"a": 1, "b": 2}': Class(ClassType { details: Class { name: "dict", declaration_path: DeclarationPath { module_name: [TYPESHED].stdlib/builtins.pyi", node: Node { start: 46298, end: 49982 } }, methods: ["__init__", "__init__", "__init__", "__init__", "__init__", "__init__", "__init__", "__init__", "__new__", "copy", "keys", "values", "items", "fromkeys", "fromkeys", "get", "get", "get", "pop", "pop", "pop", "__len__", "__getitem__", "__setitem__", "__delitem__", "__iter__", "__eq__"], attributes: {}, special: false }, type_parameters: [Str, Int] }) | ||
'{1,2,3}': Class(ClassType { details: Class { name: "set", declaration_path: DeclarationPath { module_name: [TYPESHED].stdlib/builtins.pyi", node: Node { start: 49982, end: 52187 } }, methods: ["__init__", "__init__", "add", "copy", "difference", "difference_update", "discard", "intersection", "intersection_update", "isdisjoint", "issubset", "issuperset", "remove", "symmetric_difference", "symmetric_difference_update", "union", "update", "__len__", "__contains__", "__iter__", "__and__", "__iand__", "__or__", "__ior__", "__sub__", "__isub__", "__xor__", "__ixor__", "__le__", "__lt__", "__ge__", "__gt__", "__eq__"], attributes: {}, special: false }, type_parameters: [Int] }) | ||
'(1)': Unknown | ||
'1': Int |
Oops, something went wrong.