Commit Graph

4053 Commits

Author SHA1 Message Date
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
Eric Traut
8057c63bc1 Fixed typo in comment. 2021-09-21 16:50:58 -07:00
Jake Bailey
b5f2dc2801
Update CodeQL to match new template (#2323) 2021-09-21 13:33:34 -07:00
Eric Traut
16aafe4d39 Fixed bug in TypeVarTuple support that prevented the use of an unpacked TypeVarTuple within a type argument list for types other than Tuple or Union. 2021-09-21 00:49:56 -07:00
Eric Traut
172211b57d Published 1.1.170 2021-09-20 22:30:29 -07:00
Eric Traut
0866251fcd Updated typeshed stubs to the latest 2021-09-20 20:01:25 -07:00
Eric Traut
d23bb306e4 Allow symbols that are not explicitly re-exported from a stub to be imported into another stub. This change is required to support recent updates to typeshed. 2021-09-20 20:00:57 -07:00
Eric Traut
ed0c17f259 Fixed bug that resulted in false positive when using unpack operator with self when self refers to a named tuple or a tuple with known length. 2021-09-20 18:02:26 -07:00
Eric Traut
0e9d7f2d60 Fixed infinite recursion bug in hover provider when a symbol referred to both a locally-defined class and an imported symbol. 2021-09-20 08:30:30 -07:00
Eric Traut
af4deba83d Fixed bug that resulted in false negative when bidirectional type inference involved an "expected type" of Any and the type being evaluated was a call expression that returned a generic object as a return value. 2021-09-20 08:08:28 -07:00
Eric Traut
e49e0ff6d9 Fixed false negative error in parser where it did not correctly detect a syntax error when a walrus operator was used in a ternary operator condition expression. 2021-09-19 22:48:44 -07:00
Eric Traut
c787bf4d72 Fixed bug in handling of ParamSpec within callback protocol when the signature includes a position-only or keyword-only separator. 2021-09-19 15:21:56 -07:00
Eric Traut
232f22e13b Added support for ParamSpec matching when used within a callback protocol. PEP 612 is unclear on whether this should be supported, by pyre (the reference implementation for the PEP) does support it. 2021-09-19 14:21:31 -07:00
Eric Traut
e6a20837b1 Fixed false positive error where an exception class (as opposed to an exception object) is used in a "from" clause in a "raise" statement. 2021-09-18 20:22:50 -07:00
Eric Traut
15d4d29fdc Fixed style issue. 2021-09-18 00:29:25 -07:00
Eric Traut
90c1d14f36 Moved dataclass transform logic into dataClasses.ts module. 2021-09-18 00:08:00 -07:00
Eric Traut
5065073cbc Moved pattern matching logic out of typeEvaluator into its own module. 2021-09-17 23:54:35 -07:00
Eric Traut
bed32f2fe0 Moved type guard logic out of typeEvaluator into its own module. 2021-09-17 23:07:04 -07:00