Commit Graph

4120 Commits

Author SHA1 Message Date
Eric Traut
0025f6119d Small cleanup, no functional change. 2021-10-02 19:03:08 -07:00
Eric Traut
350de179ed Fixed bug that resulted in a false negative when dealing with types that are conditioned on constrained or bound TypeVars. 2021-10-02 19:02:55 -07:00
Eric Traut
5e38fabc3a Modified import resolution logic to handle namespace stub packages. This case isn't explicitly covered by PEP 561, but there is a proposal to amend the PEP to clarify how to handle this case. 2021-10-01 22:54:47 -07:00
Eric Traut
cdbe961994 Published 1.1.173 2021-10-01 16:30:32 -07:00
Eric Traut
e8cec42512 Fixed bug that resulted in a false positive error when a protocol class used generic type parameters scoped to a method. 2021-10-01 16:01:01 -07:00
Eric Traut
838e7fe7b3 Added check for inappropriate use of a field annotated with InitVar. 2021-10-01 15:35:32 -07:00
Eric Traut
3323ee503f Fixed a false positive error when using a generic descriptor class that is parameterized by the self or cls parameter of the class that allocates the descriptor. 2021-10-01 12:58:41 -07:00
Eric Traut
d1ce1418f1 Fixed bug relating to the use of an Any type argument corresponding to a ParamSpec type parameter. 2021-09-30 18:16:27 -07:00
Eric Traut
78bd7603f4 Fixed bug that resulted in unbound variable condition not being reported if it was in a loop and was assigned conditionally. 2021-09-30 17:27:01 -07:00
Jake Bailey
5b7bce0e92
Refactor and add code for future code refactoring (#2355) 2021-09-29 12:33:12 -07:00
Eric Traut
3bc4f27ea1 Fixed false positive error when assigning a callable to a callback protocol that includes a ParamSpec. 2021-09-29 09:56:24 -07:00
Eric Traut
e5a8f9ee6d Fixed bug in ParamSpec specialization code that can occur when using a generic type alias with a ParamSpec. 2021-09-29 09:45:22 -07:00
Eric Traut
ba819031a6 Updated typeshed to the latest. 2021-09-29 09:21:41 -07:00
Eric Traut
b1a333f767 Fixed a false positive error with the new union syntax when the LHS expression is an Any or Unknown type. 2021-09-28 23:24:46 -07:00
Eric Traut
f4b5224a7c Implemented support for deprecated code hints. Also implemented code to detect the use of PEP 585-deprecated types, but this check is disabled for the time being because we think it will be too noisy and annoying for most users. 2021-09-28 19:57:03 -07:00
Eric Traut
08b38f32ae Published 1.1.172 2021-09-28 19:40:20 -07:00
Eric Traut
b47455f854 Fixed regression that resulted in false positive errors when reading source files with zero-length contents. 2021-09-28 19:35:37 -07:00
Eric Traut
3d75f5b41a Fixed false positive error when a generic class with a ParamSpec type parameter implements a descriptor protocol. 2021-09-28 19:18:51 -07:00
Jake Bailey
7fff1f89ad
Sync from Pylance (#2350)
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
2021-09-28 16:55:57 -07:00
Eric Traut
c0148bccef Fixed a bug in ParamSpec handling that resulted in false positives when a callable type containing a ParamSpec was assigned to another callable type containing a ParamSpec. 2021-09-28 13:31:46 -07:00
Eric Traut
4ba54827ce Updated typeshed stubs to the latest 2021-09-27 10:41:28 -07:00
Eric Traut
e121a78576 Implemented code that applies type narrowing to local variables and parameters when they are captured by an inner-scoped lambda or function and the variable or parameter is not reassigned after the lambda or function along any code flow paths. 2021-09-27 09:56:56 -07:00
Eric Traut
d303a0d68b Removed redundant call to getExecutionScopeNode in code flow function. 2021-09-27 09:31:22 -07:00
Eric Traut
1af2851d07 Fixed confusing comment. 2021-09-27 09:25:57 -07:00
Eric Traut
dbe41fa4d2 Made a few small improvements to the documentation. 2021-09-26 12:10:05 -07:00
Eric Traut
b564bbe85a Changed behavior of reportInvalidTypeVarUse diagnostic check to flag bound type variables used as type arguments within return type annotations. 2021-09-26 10:40:06 -07:00
Eric Traut
464d21ab2e Added completion suggestion support for TypedDict keys and values. Thanks to Robert Cragie for this contribution! 2021-09-25 02:24:45 -07:00
Eric Traut
67a0bb459e Added expandPositionRange call to fourslash test harness. 2021-09-25 02:23:33 -07:00
Eric Traut
bd734f1c20 Fixed misspelling in variable name. 2021-09-25 01:36:07 -07:00
Eric Traut
8fc2457543 Improved getExpectedType logic so it doesn't return Any or Unknown. 2021-09-25 01:26:45 -07:00
Eric Traut
2a1dbbbc69 Changed parser to add error node for incomplete dictionary entries to help simplify completion provider logic. 2021-09-25 01:26:24 -07:00
Eric Traut
3188a2f615 Published 1.1.171 2021-09-24 21:02:40 -07:00
Eric Traut
6ee12a7b55 Updated typeshed stubs to the latest 2021-09-24 21:02:26 -07:00
Eric Traut
3fa5299614 Changed code that converts types to textual representation to prepend a tilde ("~") character for the inferred type of a "self" or "cls" parameter. 2021-09-24 20:01:48 -07:00
Eric Traut
91b2b76e94 Fixed bug that resulted in incorrect type evaluation for expressions within an await statement under some circumstances. 2021-09-24 19:19:59 -07:00
Eric Traut
6a19ababb9
Implemented getExpectedType function within typeEvaluator for the benefit of language service providers. (#2336)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-09-24 11:17:08 -07:00
Eric Traut
9511bc4a2c Fixed bug that caused yield expression to be evaluated as "unknown" in some cases when it was contained within a loop. 2021-09-24 10:11:18 -07:00
Eric Traut
96c0ad4b52 Fixed minor code style consistency issue. 2021-09-23 17:39:52 -07:00
Eric Traut
fa56ce8102 Fixed bug that caused inconsistent handling of dataclasses that use the @dataclass decorator and derive from abstract base classes. 2021-09-23 10:09:49 -07:00
Eric Traut
ebc490fa80 Improved inference of generator statements that involve await statements to conform to the runtime behavior of the CPython intepreter. 2021-09-22 22:17:43 -07:00
Jake Bailey
d2771b18a8
Sync from Pylance (#2329)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
2021-09-22 14:26:36 -07:00
Eric Traut
e5d43dc4f3 Fixed style issue 2021-09-22 10:37:58 -07:00
Eric Traut
510f3c0e40 Added logic to report a diagnostic if an instance variable is assigned only via an augmented assignment expression. 2021-09-22 10:21:24 -07:00
Eric Traut
1024fbfa72 Changed type evaluation behavior for protected instance variables (those that begin with a single underscore) and are assigned a literal value. Previously, the literal type was retained if the reportPrivateUsage was enabled. This caused various problems. It was a bad idea because type evaluations should not differ based on diagnostic reporting switches. 2021-09-22 10:20:32 -07:00
Eric Traut
073a914331 Fixed bug where a class whose constructor is unannotated was allowed to have explicit generic type arguments. 2021-09-22 08:33:06 -07:00
Eric Traut
0e33238d3f Reduced perf overhead of deprecated check. Added unit tests. 2021-09-22 08:23:41 -07:00
Eric Traut
176a01bd3b Fixed style issue 2021-09-22 01:02:52 -07:00
Eric Traut
bb623f50f2 Fixed bug that resulted in inappropriate deprecation hints. 2021-09-22 01:01:46 -07:00
Eric Traut
d07a64e733 Fixed bug in synthesized __new__ method for NamedTuple class that caused the constructor of subclasses of the NamedTuple to construct the base class. 2021-09-22 00:39:00 -07:00
Eric Traut
fc536592eb Added support for reporting the use of types deprecated in PEP 585, etc. 2021-09-21 23:54:37 -07:00