Eric Traut
994d795c4c
Fixed bug that caused a crash in the type checker in cases where type arguments were not provided to a few special-case built-in classes.
2020-09-05 18:14:03 -07:00
Eric Traut
cea376e59b
Added new diagnostic rule "reportPropertyTypeMismatch" that verifies that the type of the input parameter to a property's setter is assignable to the return type of the getter.
2020-09-05 14:55:12 -07:00
Eric Traut
01637af00c
Attempt to fix CI, which is hitting errors that I'm not seeing locally.
2020-09-04 21:22:42 -07:00
Eric Traut
5979e3423d
Extended bidirectional type inference (expected types) to list comprehensions.
2020-09-04 21:12:19 -07:00
Eric Traut
a8406a7b02
Added localized strings for internal errors, which are reported as diagnostics.
2020-09-04 20:57:39 -07:00
Eric Traut
35ea405524
Fixed regression in recent check-in that caused an unexpected exception in import resolution code.
2020-09-04 20:57:07 -07:00
Eric Traut
2af28d9379
Changed import resolution logic to allow binaries (e.g. ".so" files) to satisfy local imports (within the package), not just third-party imports (within site-packages).
2020-09-04 20:05:51 -07:00
Eric Traut
3f63272dab
Improved parser to detect syntax errors involving unpack operator within a comprehension.
2020-09-04 19:54:00 -07:00
Eric Traut
1eba08bbe5
Fixed "NoReturn" inference logic for async functions. This logic was previously flagging the code after a call to such a function as unreachable.
2020-09-04 18:50:49 -07:00
Eric Traut
09d6ea7ee0
Changed type inference logic to use "List", "Set", and "Dict" rather than "list", "set" and "dict" when inferring the type of a list, set or dict expression. These are aliases for the same underlying class, but the upper-case versions are more consistent with type annotations used within the code.
2020-09-04 15:38:06 -07:00
Eric Traut
9498da0a69
Fixed a couple of bugs that resulted in the hover text incorrectly identifying a symbol as a "type alias".
2020-09-04 15:36:23 -07:00
Eric Traut
97d754e1b5
Added support for py.typed files to distinguish between packages that… ( #1007 )
...
* Added support for py.typed files to distinguish between packages that claim to have inlined types versus those that don't. Also added support for "partial" stub packages (a "-stub" package that has a py.typed file that includes the line "partial\n" as described in PEP 561).
* Fixed style issue.
* Removed unnecessary truthy tests for results returned by resolveAbsoluteImport.
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-09-04 14:55:37 -07:00
Eric Traut
6e9f8795ea
Changed command-line version to not print any non-JSON output when "--outputjson" option is used.
2020-09-04 14:52:00 -07:00
Eric Traut
0a65625e03
More documentation improvements.
2020-09-04 14:51:40 -07:00
Eric Traut
4fa40fba75
Minor tweak to documentation.
2020-09-04 14:32:38 -07:00
Eric Traut
6591dafce0
Documented the JSON output when "--outputjson" command-line option is used.
2020-09-04 14:30:14 -07:00
Eric Traut
6c1a285e87
Small cleanup in importResolver. Reordered methods so they are grouped and ordered by public, protected and private. Renamed "_addResultsToCache" to "addResultsToCache" since it is protected.
2020-09-04 11:23:11 -07:00
Eric Traut
60eb2ccad6
Fixed bug that caused the recently-added "discriminated field type narrowing" to be used in cases where it should not. This resulted in types being narrowed inappropriately when a field was typed as a union of literals.
2020-09-03 09:14:23 -07:00
Eric Traut
d1d132dc81
Published 1.1.66
2020-09-02 23:27:24 -07:00
Eric Traut
a2f807905d
Fixed broken CLI build by adding back index.js and langserver.index.js.
2020-09-02 23:21:27 -07:00
Jake Bailey
9e231b1292
Extensibility updates in threading and fourslash, add completion context ( #995 )
2020-09-02 19:01:49 -07:00
Eric Traut
e71ad7d23a
Added back the missing "__rootDirectory" global so the CLI can find the typeshed directory.
2020-09-02 18:15:47 -07:00
Eric Traut
240794dc43
Fixed crash in CLI due to change in the interface of the "chalk" dependency.
2020-09-02 18:06:54 -07:00
Eric Traut
f8124d9554
Fixed broken build script in CLI package.json file.
2020-09-02 18:06:18 -07:00
Eric Traut
930c2021c6
Added a check and a general type diagnostic for metaclass conflicts.
2020-09-02 17:35:29 -07:00
Eric Traut
17f0b9e94d
Fixed a bug in the Pyright parser. It was not correctly following the Python grammar spec when parsing type annotations, so it generated syntax errors in some cases where that was inappropriate.
2020-09-02 09:16:01 -07:00
Eric Traut
ee4f833005
Fixed default value of reportMissingModuleSource setting in JSON schema. It should be "warning", not "none".
2020-09-02 01:08:40 -07:00
Eric Traut
7fd612ad70
Fixed bug in tokenizer that cause line numbers to be off when an invalid token occurred at the end of a line.
2020-09-02 00:28:36 -07:00
Eric Traut
58a349b50e
Added check for raise statements that take an exception class but the class constructor requires one or more arguments.
2020-09-01 21:26:10 -07:00
Eric Traut
e168e338dd
Fixed an incorrect diagnostic rule for reportMissingTypeArgument.
2020-09-01 20:52:37 -07:00
Eric Traut
e190d4ddef
Fixed handling of scopes for nested classes. The previous logic allowed an inner class to access variables defined in an outer class, which is not permitted.
2020-09-01 20:35:08 -07:00
Eric Traut
9e46548fc5
Added new "reportMissingTypeArgument" diagnostic rule and enabled it by default in "strict" mode. It generates a diagnostic when a generic class or generic type alias is used in an annotation with no type arguments provided. Also fixed a bunch of inaccurate settings defaults in pyright's package.json.
2020-09-01 15:59:31 -07:00
Eric Traut
7f7ff556bc
Suppress the use of "Unnecessary" diagnostic hints (used to display variables and code blocks in gray) if the LSP client claims not to support this tag. ( #984 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-31 14:46:51 -07:00
Eric Traut
f3bbfc3d9a
Changed the behavior of the import resolution logic to fail an import resolution of a multi-part name (e.g. "a.b.c") if it can't be fully resolved. This could produce false positives in cases where third-party libraries are using dynamic tricks to manipulate their package namespace, but it will eliminate false negatives.
2020-08-30 11:48:50 -07:00
Eric Traut
e43b5a5c55
Changed heuristics for function return type inference so methods that raise a NotImplementedError and have no other return path have an inferred return type of Unknown rather than NoReturn. Such methods should be marked as abstract, but frequently they are not.
2020-08-30 08:13:41 -07:00
Eric Traut
aa63c1d14f
Improved completion provider to distinguish properties from other methods.
2020-08-29 21:23:14 -07:00
Eric Traut
520d685d97
Changed handling of dataclass classes that derive from a class whose type is unknown. The synthesized constructor now allows any parameter list in this case.
2020-08-29 16:21:31 -07:00
Eric Traut
e454a96b3e
Changed the handling of old-style comment method annotations to accept an optional annotation for "self" and "cls" parameters.
2020-08-29 15:33:40 -07:00
Eric Traut
81d74de105
Eliminated incorrect error when "super()" was used in a class where one or more parent classes were of an unknown type.
2020-08-29 15:18:21 -07:00
Eric Traut
f7e5a9975c
Updated typeshed fallback stubs to the latest.
2020-08-29 14:51:55 -07:00
Amjad Ben Hedhili
d6d31309fc
Add sublime text to the list of supported editors ( #980 )
2020-08-29 08:15:08 -07:00
Jake Bailey
8038b391a6
Run install:all in style checker, fix desynced package-lock.json ( #979 )
2020-08-28 22:57:00 -07:00
Jake Bailey
da39a2a78a
Convert repo into a lerna monorepo, add a validation workflow ( #978 )
2020-08-28 19:46:48 -07:00
Jake Bailey
eb71cddf7c
Fix progress reporter type, auto-import/symbol changes, worker thread updates, improve auto-import tooltips ( #977 )
2020-08-28 16:42:12 -07:00
Eric Traut
8c5415fd85
Changed diagnostic related to type argument count to be controlled by the "reportGeneralTypeIssues" diagnostic rule. It was previously always emitted as an error.
2020-08-27 09:25:16 -07:00
Eric Traut
950ba3e8a3
Improved completion suggestion behavior when the insertion point is between an identifier and an empty index (e.g. "f[]") or in the presence of a missing right square bracket (e.g. "f.[").
2020-08-26 15:31:35 -07:00
Jake Bailey
f1b5b37df5
Update deps, pin LSP libraries together, use Node 12.x ( #971 )
2020-08-26 15:00:16 -07:00
George Xanthakis
c0d55f0bd4
Add Emacs lsp-mode support in Readme ( #969 )
2020-08-26 12:49:23 -07:00
Eric Traut
e42b68f6b6
Published 1.1.65
2020-08-25 23:21:11 -07:00
Eric Traut
14931faf4e
Fixed regression where "__class__" symbol (defined in PEP 3135) was not added implicitly to a function scope.
2020-08-25 15:29:16 -07:00