Commit Graph

5239 Commits

Author SHA1 Message Date
Eric Traut
465b04c80b Fixed a bug in the code that detects attribute docstrings to prevent it from walking all the way to the top of the parse tree. 2024-08-10 09:52:18 -06:00
Eric Traut
4fc5de5c1e
Fixed a false positive error when solving type variables in a call that involves a lambda. This addresses #8714. (#8730) 2024-08-10 00:47:49 -06:00
Rich Chiodo
f85e257026
Special case pythonPath to also come from the languageServer (#8728)
* Special case pythonPath to also come from the languageServer

* Compare URI correctly
2024-08-09 18:49:18 -06:00
Rich Chiodo
2aa9bf4c20
Reapply the compiler flags change but separate out the 'language server' specific settings (#8726)
* Document different types of 'compiler' flags and ensure merging of flags is consistent (#8704)

* Make sure config options cannot be overridden by settings.json

* Make sure extraPaths and python env information is updated from the command line

* Change fromVsCodeExtension to fromLanguageServer

* Separate command line options into json ones and language server ones

* Fix build error
2024-08-09 16:15:38 -07:00
Eric Traut
152350997d
Enhanced argument-to-parameter matching logic to support dictionary unpacking where the dict key type is a union of literals. This addresses #8671. (#8724) 2024-08-09 15:30:43 -06:00
Eric Traut
de0386d690 Revert "Document different types of 'compiler' flags and ensure merging of flags is consistent (#8704)"
This reverts commit a86210ccb7.
2024-08-09 13:20:55 -06:00
Eric Traut
421a87fd8a
Improved consistency of parameter name restrictions for the reportSelfClsParameterName check. Previously, different rules were applied to __new__ and class methods within metaclasses. This addresses #8717. (#8720) 2024-08-09 13:11:34 -06:00
Rich Chiodo
a86210ccb7
Document different types of 'compiler' flags and ensure merging of flags is consistent (#8704)
* Make sure config options cannot be overridden by settings.json

* Make sure extraPaths and python env information is updated from the command line

* Change fromVsCodeExtension to fromLanguageServer
2024-08-09 10:38:33 -07:00
Eric Traut
f68a616eb2 Fixed bug that produces signatures with extra (unnecessary) positional-only and keyword-only separators when using a TypedDict with zero fields. This addresses #8712. 2024-08-09 08:39:51 -06:00
Eric Traut
778509b20d Cleaned up some out-of-date comments and removed a circular import. 2024-08-09 00:24:02 -06:00
Eric Traut
55e1681568
Fixed bug that results in a false negative reportIncompatibleMethodOverride when the child class method uses a type parameter that is scoped to the child class. This addresses #8622. (#8711) 2024-08-09 00:04:00 -06:00
Eric Traut
fd68169161 Renamed PopulateExpectedType flag and clarified its purpose. 2024-08-08 19:32:59 -06:00
Eric Traut
77dc8848c5 Simplified internal validateArgTypes function. 2024-08-08 19:26:16 -06:00
Eric Traut
93115f9232
Renamed OverloadedFunctionType to OverloadedType for brevity and to reflect the fact that non-function types are now supported for overloads. No functional change, just a rename. (#8708) 2024-08-08 18:16:30 -06:00
Eric Traut
1d5420cb75
Further simplified TypeVar constraint tracking and solving. Removed the need to track separate constraints for dest and src. (#8707) 2024-08-08 17:58:48 -06:00
Eric Traut
3e448e7615
Fixed regression that resulted in a hang when determining whether an overload implementation with generics was compatible with its overloads. This addresses #8687. (#8706) 2024-08-08 17:29:08 -06:00
Kacie Kang
1f193580c8
Fix fileInfo null error (#8702)
* fix file info null reference

* check for binding

* removing fileinfo in if statement
2024-08-08 16:08:33 -07:00
Eric Traut
e8f0965e5b
Removed overly-complicated (and buggy) internal function setTypeArgsRecursive. (#8703) 2024-08-08 13:48:16 -06:00
Eric Traut
65ea3e95b4
Fixed bug that results in a false positive error when type argument for Literal doesn't follow type expression rules within a value expression context. This addresses 8696. (#8700) 2024-08-08 12:37:39 -06:00
Eric Traut
efda709120
Fixed a bug that results in a false positive reportInconsistentOverload error when the implementation of the overload includes a decorator that changes the type of the implementation to a non-function type. This addresses #8692. (#8699) 2024-08-08 12:26:27 -06:00
Eric Traut
2b603b9144
Modified OverloadedFunctionType interface in preparation for a follow-on change. Users of OverloadedFunctionType must now use the accessor functions to get the overloads and implementation. (#8695) 2024-08-08 09:32:21 -06:00
Eric Traut
8c628b0bc4 Fixed bug that results in a crash when an empty tuple is used to specialize a generic type alias parameterized by a ParamSpec. This addresses #8694. 2024-08-08 00:13:28 -06:00
Eric Traut
3d52679f59 Added optimization to shortcut overlapping overload checks if the diagnostic is suppressed. 2024-08-07 12:10:32 -06:00
Eric Traut
51c98aa945 Added small optimization that skips checks for overload consistency if these diagnostics are suppressed. 2024-08-07 12:06:15 -06:00
Eric Traut
f0c0dc8d4d Published 1.1.375 2024-08-06 20:32:59 -06:00
Eric Traut
e5889207ff Fixed bug that causes infinite recursion and memory exhaustion under certain circumstances involving recursive type aliases where the type alias is used as a type argument. This addresses #8670. 2024-08-06 16:39:26 -06:00
Eric Traut
1ab7801331
Fixed bug in type narrowing logic for value patterns, specifically when two enums with members of the same name are involved. This addresses #8674. (#8682) 2024-08-06 13:10:35 -06:00
Eric Traut
c285825dea
Allow Final and ClassVar to be combined in both directions within a dataclass. Previously, the Final qualifier needed to be the outermost. This addresses #8676. (#8678) 2024-08-06 11:44:51 -06:00
Eric Traut
08e02e450b
Added support for bool expansion to Literal[True] | Literal[False] during pattern matching when using value patterns. (#8677) 2024-08-06 11:11:47 -06:00
Eric Traut
c1df6595a1
Fixed a bug that results in incorrect type narrowing when using isinstance with an instance of a generic class as the first argument and a concrete subclass as the filter type. This addresses #8672. (#8675) 2024-08-06 10:30:12 -06:00
Eric Traut
35ab773671
Another round of simplification for TypeVar solving. Add support for recursive solutions (i.e. a TypeVar that has an upper or lower bound that depends on another TypeVar). (#8663) 2024-08-05 14:12:05 -06:00
Eric Traut
4d471f154f Updated typeshed stubs to the latest version. 2024-08-05 13:25:56 -06:00
Eric Traut
c10fa6d535
Fixed a bug that results in incorrect type narrowing for truthy/falsy type guards consisting of an Enum member when the enum class derives from ReprEnum. In this case, the "magic" of the enum implementation forwards the __bool__ call to the underlying value. This addresses #8658. (#8662) 2024-08-05 13:03:06 -06:00
Eric Traut
9a5643fc5f
Further simplified TypeVar constraint tracking and solving. Removed precomputed "lowerBoundNoLiterals" from tracker. (#8656) 2024-08-05 10:31:15 -06:00
Eric Traut
bf6eab2147
Fixed a bug that results in incorrect overload matching when one overload contains a zero-arity variant and another overload contains an *args (variadic) parameter. This addresses #8645. (#8654) 2024-08-05 01:34:02 -06:00
Eric Traut
4adf903331
Fixed bug that caused first argument of cast method on memoryview object to be treated as a type expression. Pyright was confusing this method with typing.cast. This addresses #8649. (#8651) 2024-08-04 14:49:43 -06:00
Eric Traut
fe0dc216f0
Fixed bug that results in a false positive error under certain circumstances when passing an overloaded function as an argument to a call. This addresses #8632. (#8644) 2024-08-03 01:12:51 -06:00
Eric Traut
ed65b44df3 Added subtyping support or IntEnum and StrEnum members. These literal values are subtypes of the corresponding literal int or str. This partly addresses #8641. 2024-08-02 23:01:20 -06:00
Eric Traut
24ed89d3ea Fixed bug in TypeVar auto-variance calculations for NamedTuples. Since NamedTuple variables are read-only, they should not cause a TypeVar to be invariant. 2024-08-02 18:46:35 -06:00
Eric Traut
d298d49981 Renamed constraint tracker method setConstraints to setBounds for clarity. 2024-08-02 14:36:19 -06:00
Eric Traut
c883ac067c Did a round of terminology cleanup for TypeVarTuples. No functional change. 2024-08-02 14:14:38 -06:00
Eric Traut
e22d2d2b1b
Did another round of simplification in the ParamSpec logic. (#8642) 2024-08-02 14:00:14 -06:00
Eric Traut
ce8c57f44d
Did a cleanup pass on the code that accesses the param types. Some code paths were not using the appropriate accessor functions, so they were ignoring specialized param types and using the unspecialized (declared) type instead. (#8640) 2024-08-02 12:55:33 -06:00
Eric Traut
5ad9f1fea1 Fixed bug that results in a false positive reportUnsupportedDunderAll warning when using the __all__.extend(x.__all__) form and the list of entries in x is empty. This addresses #8636. 2024-08-02 08:10:19 -06:00
Eric Traut
7802376828 Changed disableLanguageServices feature to apply to hover text as well as other language services. Previously, hover text was excluded. This addresses #8639. 2024-08-02 07:59:47 -06:00
Eric Traut
842ab02c34
Fixed bug in the functools.partial logic that results in incorrect handling of an unpacked TypedDict when used with a **kwargs parameter. This addresses #8617. (#8630) 2024-07-31 23:12:50 -07:00
Eric Traut
33d2937b8c
Removed constraint solving logic from constraint tracker. All such logic should be contained within the constraint solver. (#8629) 2024-07-31 18:40:15 -07:00
Eric Traut
327dcfc42a
Removed a bunch of redundant and special-case handling of param specs that's no longer needed. (#8627) 2024-07-31 16:29:23 -07:00
Eric Traut
2eb14cba65
Separated constraint solving from the application of the solved type variables. (#8624) 2024-07-31 12:37:50 -07:00
Eric Traut
d300291291
Fixed bug that leads to internal data structure corruption and subsequent false positive errors in certain cases involving unions of Unknown types that include type aliases. This addresses #8608. (#8621) 2024-07-31 09:35:50 -07:00