Commit Graph

7089 Commits

Author SHA1 Message Date
Eric Traut
7a67f4fbdb
Added two new diagnostic rules: reportInconsistentOverload reports inconsistencies between overload signatures and/or implementation and reportNoOverloadImplementation reports an overloaded function with a missing implementation. This partially addresses #6973. (#7072) 2024-01-21 00:04:55 -08:00
Eric Traut
91960fba49
Added new diagnostic rule reportPossiblyUnboundVariable, which is split off from reportUnboundVariable. This addresses #6896. (#7071) 2024-01-20 23:34:11 -08:00
Eric Traut
aa64fc5dec
Added two new diagnostic rules: reportAssertTypeFailure for type mismatches detected by typing.assert_type and reportUnusedExcept for situations where an except statement is determined to be unreachable. (#7070) 2024-01-20 22:21:42 -08:00
Eric Traut
04e0536a52
Added new diagnostic rule reportInvalidTypeForm that controls reporting of invalid type expression forms. This partly addresses #6973. (#7069) 2024-01-20 21:56:10 -08:00
Eric Traut
566f333ee1
Fixed a bug that led to a false negative when an illegal form of tuple was used: tuple[*tuple[str], ...]. (#7066) 2024-01-20 18:35:53 -08:00
Eric Traut
3c36b308d2 Changed diagnostic rule for the case where Callable is missing a second type argument. It should use reportMissingTypeArgument. 2024-01-20 17:32:49 -08:00
Eric Traut
32f0685bb1 Modernized a few diagnostic messages to refer to tuple (lowercase) rather than Tuple (uppercase). 2024-01-20 17:32:16 -08:00
Eric Traut
578ec79ae4
Fixed a bug that resulted in a false positive error and incorrect type evaluation when an assignment expression (walrus operator) is used in a comprehension. This addresses #6992. (#7064) 2024-01-20 14:55:25 -08:00
Eric Traut
301ee7df5f Disabled debug check that was accidentally enabled several builds ago. 2024-01-20 14:36:29 -08:00
Eric Traut
d21168ee64 Updated typeshed stubs to the latest version. 2024-01-19 22:08:10 -08:00
Eric Traut
af44054edb
Fixed a bug that masked an error (false negative) under certain circumstances when evaluating a lambda. This addresses #7012. (#7059) 2024-01-19 21:55:50 -08:00
Eric Traut
50f677c96d
Addressed a bug that led to a false positive (missing error) when a "bare" TypeVar is used as a base class in a class statement. This addresses #7023. (#7058) 2024-01-19 20:34:01 -08:00
Eric Traut
335255fea2
Added error reporting for the situation where a generic instance vari… (#7057)
* Added error reporting for the situation where a generic instance variable is accessed through a class object. This addresses #7051.

* Fixed style issue.
2024-01-19 17:41:53 -08:00
Eric Traut
f10455eb0b
Changed handling of tuple[Any, ...] so it is treated as though it's bidirectionally type compatible with all tuples regardless of length. This addresses #7053. (#7054) 2024-01-19 16:18:26 -08:00
PylanceBot
9ec6bebadb
pull-pylance-with-pyright- (#7052)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rchiodo <rchiodo@microsoft.com>
2024-01-19 16:05:58 -08:00
Eric Traut
0fc568260a
Improved handling of Annotated and other special forms when they are used in runtime value expressions rather than annotations. This addresses #7049. (#7050) 2024-01-19 09:40:37 -08:00
Eric Traut
01b1aa02a1
Added type enforcement for the _value_ type in an Enum class. Also added enforcement for custom __new__ and __init__ method signatures. This addresses #7030 and #7029. (#7044) 2024-01-19 00:33:55 -08:00
Eric Traut
85e8de6397
Added special-case logic for enum classes that are invoked as though they are being constructed. This addresses #7027. (#7042) 2024-01-18 20:26:01 -08:00
Eric Traut
3f3a86a6c7
Improved handling of custom Enum classes. This addresses #7024. (#7041) 2024-01-18 18:33:13 -08:00
Eric Traut
4df6b6b63a
Fixed spec conformance issue with TypeVarTuple constraint solving. The spec indicates that if a TypeVarTuple is used multiple times in a callee's signature, the tuple must "match exactly". This addresses #6888. (#7040) 2024-01-18 17:07:50 -08:00
Eric Traut
922e746476
Added check for name mismatch for enum classes defined using the functional syntax. This addresses #7025. (#7038) 2024-01-18 12:14:47 -08:00
Rich Chiodo
81e85d10ea
Fix combining paths with empty uri (#7037)
* Fix combining paths with empty uri

* Force empty to be case sensitive

* Remove unneeded code
2024-01-18 10:54:40 -08:00
InSync
c44673d611
Typos in pyrightconfig.schema.json (#7021)
* Fix copy & paste error

* Fix typo
2024-01-17 17:20:17 -08:00
Eric Traut
923bc3788c
Fixed a bug in the isinstance type narrowing logic when type is filtered using a metaclass instance. This addresses #7008. (#7015) 2024-01-16 19:47:19 -08:00
Eric Traut
7e3f8aae6e
Fixed a bug that resulted in an incorrect type evaluation when a generator uses an await operator within the left-most for. This shouldn't result in an AsyncGenerator despite what the Python documentation indicates. This addresses #6999. (#7013) 2024-01-16 18:53:21 -08:00
Eric Traut
cab9f886de Updated "mypy comparison" documentation based on recent improvements in mypy. It's now able to handle higher-order functions. 2024-01-16 00:32:52 -08:00
Eric Traut
b21cbdc782 Fixed bug in pyright's "type printer" that resulted in an incorrect output when printing a specialized type alias parameterized by a TypeVarTuple that has a value that contains a tuple with an indeterminate length. 2024-01-15 23:37:22 -08:00
Eric Traut
e1dccb5919 Fixed regression that caused CLI publish to fail. 2024-01-15 09:17:11 -08:00
Eric Traut
b7f191c1fa Published 1.1.347 2024-01-15 09:12:41 -08:00
Eric Traut
47ea9f6fd7 Fixed regression that caused JSON output to not follow the documented schema. This addresses #6740. 2024-01-15 09:12:18 -08:00
Eric Traut
286fa2549c Made internal simplification for emitting diagnostics. 2024-01-14 23:42:34 -08:00
Eric Traut
0848427c73 Added support for Python 3.11 enum features: enum.member and enum.nonmember. This addresses #6867.
(cherry picked from commit 63e223b96454ef5b26e5a1ef10c9571f8e772d2a)
2024-01-14 22:43:25 -08:00
Eric Traut
cdcd4046b5 Added new language server setting pyright.disableTaggedHints to disable the use of diagnostics hints with tags. Some language server clients do not display these tagged hints in the intended manner and instead treat them as regular diagnostics. 2024-01-14 21:11:13 -08:00
Eric Traut
4f9ecaa96a
Diag rules (#6988)
* Added support for @no_type_check decorator. This addresses #1448.

* Changed all diagnostics (other than syntax errors and a few special informations) to have an associated diagnostic rule. Previously, some diagnostics had no associated rule.
2024-01-14 20:37:27 -08:00
Eric Traut
80b59618ac
Added support for @no_type_check decorator. This addresses #1448. (#6987) 2024-01-14 20:07:13 -08:00
Eric Traut
56fe9e1c81 Published 1.1.346 2024-01-14 16:53:43 -08:00
Eric Traut
7d38c9ac5a Fixed a bug that resulted in a false positive when a contravariant TypeVar was used in a return type in a non-method. 2024-01-14 15:44:35 -08:00
Eric Traut
f35d4f3821
Fixed a bug that resulted in incorrect variance inference for protocols (and for PEP inferred-variance TypeVars in PEP 695) when a self or cls parameter is explicitly annotated with a type that includes the type parameter. This addresses #6883. (#6986) 2024-01-14 15:30:32 -08:00
Eric Traut
feabf5ed76 Fixed bug that caused "final method override" diagnostic to have no associated diagnostic rule. This addresses #6985. 2024-01-14 12:18:18 -08:00
Eric Traut
0100cbd563
Changed error reporting for non-protocol classes that derive from a protocol but don't implement all of the unimplemented symbols in the protocol. Previously, pyright reported the error on the class declaration. Now, it reports it at instantiation time. This is more consistent with what other type checkers do. (#6984) 2024-01-14 12:09:34 -08:00
Eric Traut
506345aa77
Fixed a bug in class pattern matching logic that incorrectly narrows types when using a str() class pattern and a LiteralString subject. This addresses #6982. (#6983) 2024-01-14 08:40:04 -08:00
Eric Traut
7f15234ffb
Fixed a bug that resulted in an incorrect implied specialization of a generic type alias that is parameterized by a TypeVarTuple. The implied type argument should be *tuple[Unknown, ...] in this case. This addresses #6902. (#6980) 2024-01-13 20:21:41 -08:00
Eric Traut
8f794455ea
Fixed recent regression whereby a type created with NewType was no longer allowed as an argument for another NewType. This addresses #6976. (#6978) 2024-01-13 14:12:01 -08:00
Eric Traut
4fbbaebcaa
Fixed bug that led to incorrect protocol matching for class objects. This addresses #6879. (#6977) 2024-01-13 14:11:50 -08:00
Eric Traut
d9185f850b
Added support for generic type alias specialization when the type alias includes an unpacked TypeVarTuple and the specialization list includes an unpacked unbounded tuple. This addresses #6930. (#6974) 2024-01-13 10:03:14 -08:00
Eric Traut
8ab6c54f5b
Improved handling of special forms defined in the typing module so they are treated correctly when used as runtime objects. (#6972)
Fixed false negative when a special form is assigned to a value declared as type[T] or when instantiated. This addresses #6895 and #6868.
2024-01-13 01:32:19 -08:00
Eric Traut
e27cbb224d
Added support for + unary operator in Literal int type annotations. The typing spec was recently amended to allow this. This addresses #6968. (#6969) 2024-01-12 13:05:39 -08:00
PylanceBot
1ed4cc325b
pull-pylance-with-pyright- (#6967)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rich Chiodo <rchiodo@users.noreply.github.com>
2024-01-12 11:35:42 -08:00
Eric Traut
e67013e8ac Fixed recent regression that results in a false positive error when an unpack operator is used in an Annotated type annotation. This addresses #6963. 2024-01-11 16:50:27 -08:00
Eric Traut
89cef4ecf3 Fixed a bug that resulted in an incorrect type evaluation for a sliced tuple if the end of the slice is the same as the tuple length (off-by-one error). This addresses #6958. 2024-01-11 14:28:13 -08:00