Tags: wade1990/pyre-check
Tags
Make global for class name have normal original Summary: I discovered this while implementing the new version of global registration. This evidently dates back to the original implementation of registering classes as meta types: D6643297. I'm not sure why this was chosen, since it allows people to redefine their classes locally, which we don't support in a consistent manner. Reviewed By: grievejia Differential Revision: D17619648 fbshipit-source-id: 7a0be0b90902a9e1097e5589fe919f2099595a39
Make global for class name have normal original Summary: I discovered this while implementing the new version of global registration. This evidently dates back to the original implementation of registering classes as meta types: D6643297. I'm not sure why this was chosen, since it allows people to redefine their classes locally, which we don't support in a consistent manner. Reviewed By: grievejia Differential Revision: D17619648 fbshipit-source-id: 7a0be0b90902a9e1097e5589fe919f2099595a39
Fix dequalification and default to `test.py` for integration tests Summary: For our integration tests, we have this hack of pretending the source files all have the filename `__init__.py`, whose corresponding reference qualifier is `Reference.empty`. SInce in most of our integration tests we assume that the source file has no qualifiers attached, this hack saved us some effort of porting the error messages over. ... But a hack is still a hack: empty qualifier does not play nicely with the majority of our system, and it creates surprising breakage every now and then. Let's get rid of it to avoid creating more test maintenance burden in the future. This diff makes it so that by default, `Test.assert_errors` uses `test.py` as the filename for the source. This lead to changes in error messages on most of our integration tests, and I use 2 strategies to fix them: - Ideally, no qualifier should be shown in our error message thanks to dequalification. If the `test` qualifier is shown, it usually means that certain part of the error message did not get correctly dequalified. I try to patch up those as much as possible. - Sometimes it is really difficult to patch the dequalification issue. For example, when the message contains an expression, there's no obvious way to dequalify it without existing APIs. For these cases, I would change the expected error message directly. Proper dequalification for them can be left as future work. NOTE: Both `Test.parse` and `Test.parse_untrimmed` still default to empty filename. Dealing with them can be a separate diff. Reviewed By: dkgi Differential Revision: D17127037 fbshipit-source-id: 1f2124231ba1a1f7896c6ef935040336302f27ce
distinguish instance attribute models from class attribute models Summary: In Python, the semantics of class and instance variables differ. If you declare `class C: x = 1` and write `self.x = 2` later, `C.x` will remain unchanged for the other instances of `C`. Previously, we would allow accessing an attribute model through both the instance and class. This disallows us from expressing models only for class attributes vs. only for instance attributes. Support the class attribute case via the module_name.ClassName.__class__.attribute, and keep instance attribute syntax as is (via module_name.ClassName.attribute). If we need models for both cases, we'll need to write both. Reviewed By: fahndrich Differential Revision: D16672643 fbshipit-source-id: 92ff7bcf0863514ab5da670ed6f9e8474e78799e
Remove special treatment for `@contextmanager` and `@asynccontextmana… …ger` Summary: We used to hard-code the behavior of `contextmanager` and `asynccontextmanager`. Problems are: - With D15011034 adding support for user-defined decorators we no longer need to special-case them. - Hard coding class names lead to sadness when the hardcoded name [changes in typeshed](python/typeshed@668d050) I also pulled the relevant classes from the helper stubs into `contextlib` stubs and replace them with the actual typeshed stubs. Reviewed By: shannonzhu, mrkmndz Differential Revision: D16166530 fbshipit-source-id: 9d5497dde51724b6e8772cef119e5bd4609f9d79
Adding first draft of subtyping rules Summary: This is a first draft at documenting the main component of the subtyping rule: `less_or_equal`. We still need `join` and `meet` to have a realistic package. The style is to write down the rules in the same order as the code. At some point we might want to change to a style with only "positive rules" (e.g. don't write anything about Top <= T, because if there is no rule to build it, we can't prove it). That might evolve in the future Reviewed By: dkgi Differential Revision: D16120038 fbshipit-source-id: ddc1ee5df934771e1d3185bf98f3cae04e4f292d
search for binary under virtualenv directory correctly Summary: A common workflow is to create a venv, thusly: ``` python3 -m venv /tmp/pyre /tmp/pyre/bin/pip install pyre-check /tmp/pyre/bin/pyre start ``` Now, since `/tmp/pyre/bin` isn't in $PATH, we would miss out on the binary. Make pyre initialize and pyre smarter, and try to pick up on these binaries. This use case is particularly pertinent in OSS development. Reviewed By: grievejia Differential Revision: D15178027 fbshipit-source-id: 938c9d5e82b23bad5986f51bcb90760a2a4b8156
only support opam 2.0 Summary: As mentioned in facebook#142, opam 1.2 doesn't have recent package versions, and is unable to build Pyre. Reviewed By: grievejia Differential Revision: D15133329 fbshipit-source-id: eef93a8b9965c7a862637e0dedcc3de532409ff4
PreviousNext