Closed
Description
Environment data
- Language Server version: 2022.5.3 (pyright 73c82fab)
- OS and version: macOS 12.2.1
- Python version (& distribution if applicable, e.g. Anaconda): 3.9
Code Snippet
def foo(a: str = None):
...
Expected behavior
I expect this to not throw an type check error and a
to be typed as Optional[str]
within foo
.
Actual behavior
a
is typed as str
and this raises a reportGeneralTypeIssues
error
Logs
[Info - 10:14:21 AM] (29216) Pylance language server 2022.5.3 (pyright 73c82fab) starting
[Info - 10:14:21 AM] (29216) Server root directory: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist
Notebook support: Legacy
[Info - 10:14:21 AM] (29216) No pyproject.toml file found.
[Info - 10:14:21 AM] (29216) Setting pythonPath for service "<default>": "/Users/hyunkyulee/.pyenv/versions/3.9.11/bin/python"
[Warn - 10:14:21 AM] (29216) stubPath typings is not a valid directory.
[Info - 10:14:21 AM] (29216) Assuming Python version 3.9
[Info - 10:14:21 AM] (29216) Assuming Python platform Darwin
[Info - 10:14:21 AM] (29216) Search paths for <default>
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib
[Info - 10:14:21 AM] (29216) typings
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stubs/...
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/bundled/stubs
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/lib-dynload
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/site-packages
[Info - 10:14:21 AM] (29216) Adding fs watcher for library directories:
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/lib-dynload
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/site-packages
[Info - 10:14:21 AM] (29216) Searching for source files
[Info - 10:14:21 AM] (29216) No source files found.
(29216) [IDX(FG)] index libraries (index) ...
(29216) [IDX(FG)] read stdlib indices (12ms)
(29216) [IDX(FG)] index libraries (index) [succeed] (12ms)
(29216) [FG] parsing: /Users/hyunkyulee/Developer/test.py (7ms)
(29216) [FG] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (48ms)
(29216) [FG] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi (13ms)
(29216) [FG] binding: /Users/hyunkyulee/Developer/test.py (0ms)
[Info - 10:14:21 AM] (29216) No pyproject.toml file found.
[Info - 10:14:21 AM] (29216) Setting pythonPath for service "<default>": "/Users/hyunkyulee/.pyenv/versions/3.9.11/bin/python"
[Warn - 10:14:21 AM] (29216) stubPath typings is not a valid directory.
[Info - 10:14:21 AM] (29216) Assuming Python version 3.9
[Info - 10:14:21 AM] (29216) Assuming Python platform Darwin
[Info - 10:14:21 AM] (29216) Search paths for <default>
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib
[Info - 10:14:21 AM] (29216) typings
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stubs/...
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/bundled/stubs
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/lib-dynload
[Info - 10:14:21 AM] (29216) /Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/site-packages
[Info - 10:14:21 AM] (29216) Adding fs watcher for library directories:
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/lib-dynload
/Users/hyunkyulee/.pyenv/versions/3.9.11/lib/python3.9/site-packages
[Info - 10:14:21 AM] (29216) Searching for source files
[Info - 10:14:21 AM] (29216) No source files found.
(29216) [IDX(FG)] index libraries (index) ...
(29216) [IDX(FG)] read stdlib indices (12ms)
(29216) [IDX(FG)] index libraries (index) [succeed] (12ms)
[Info - 10:14:21 AM] (29216) Background analysis(1) root directory: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist
[Info - 10:14:21 AM] (29216) Background analysis(1) started
(29216) Background analysis message: setConfigOptions
(29216) Background analysis message: setImportResolver
(29216) Background analysis message: ensurePartialStubPackages
(29216) [FG] parsing: /Users/hyunkyulee/Developer/test.py (3ms)
(29216) [FG] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 1ms] (29ms)
(29216) [FG] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi (7ms)
(29216) [FG] binding: /Users/hyunkyulee/Developer/test.py (0ms)
(29216) Background analysis message: setTrackedFiles
(29216) Background analysis message: markAllFilesDirty
(29216) Background analysis message: setFileOpened
(29216) Background analysis message: getDiagnosticsForRange
(29216) Background analysis message: setConfigOptions
(29216) Background analysis message: setImportResolver
(29216) Background analysis message: ensurePartialStubPackages
(29216) Background analysis message: setTrackedFiles
(29216) Background analysis message: markAllFilesDirty
(29216) Background analysis message: getSemanticTokens full
(29216) [BG(1)] getSemanticTokens full at /Users/hyunkyulee/Developer/test.py ...
(29216) [BG(1)] parsing: /Users/hyunkyulee/Developer/test.py (7ms)
(29216) [BG(1)] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 2ms] (47ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/builtins.pyi (15ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/Developer/test.py (0ms)
(29216) [BG(1)] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/typing_extensions.pyi [fs read 1ms] (4ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/typing_extensions.pyi (1ms)
(29216) [BG(1)] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (11ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/typing.pyi (4ms)
(29216) [BG(1)] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (8ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (1ms)
(29216) [BG(1)] parsing: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (0ms)
(29216) [BG(1)] binding: /Users/hyunkyulee/.vscode/extensions/ms-python.vscode-pylance-2022.5.3/dist/typeshed-fallback/stdlib/abc.pyi (0ms)
(29216) [BG(1)] getSemanticTokens full at /Users/hyunkyulee/Developer/test.py (112ms)
(29216) Background analysis message: analyze
(29216) [BG(1)] analyzing: /Users/hyunkyulee/Developer/test.py ...
(29216) [BG(1)] checking: /Users/hyunkyulee/Developer/test.py (2ms)
(29216) [BG(1)] analyzing: /Users/hyunkyulee/Developer/test.py (2ms)
(29216) Background analysis message: getDiagnosticsForRange
(29216) Background analysis message: resumeAnalysis
(29216) Background analysis message: getDiagnosticsForRange
(29216) Background analysis message: getDiagnosticsForRange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels