incorrectly `reportUnknownParameterType` with double type alias
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
Environment data
- Pylance version: 2025.7.1
- OS and version: Windows 11
- Python version (& distribution if applicable, e.g. Anaconda): python 3.13.5
Code Snippet
from __future__ import annotations
def f[T](x: a[T]) -> a[T]:
return x
class C[T]:
def __init__(self, x: a[T]) -> None:
self.x = x
def method(self) -> a[T]:
return self.x
type a[T] = b[T] | T
type b[T] = C[T]
Repro Steps
- Paste the above code in an editor in VS Code whose language mode is python, with Pylance enabled (of course).
Expected behavior
There's no typechecking errors.
Actual behavior
- The typechecker says 'Type of parameter "x" is unknown' in
C.__init__, and counts this as an error. - The typechecker accepts all other usage of
a[T], and there's also no other errors reported. - When hovering the mouse over the parameter "x" in question, the inferred type of "x" is reported to be
a[T@C].
Logs
2025-08-08 16:55:56.102 [info] (30432) Pylance language server 2025.7.1 (pyright version 1.1.403, commit 8b02aa84) starting
2025-08-08 16:55:56.122 [info] (30432) Starting service instance "<default>" for workspace ""
2025-08-08 16:55:56.193 [info] (30432) Starting Mcp server id:4140 ...
2025-08-08 16:55:56.247 [info] (30432) Setting environmentName for service "<default>": "3.13.5 (global)"
2025-08-08 16:55:56.248 [info] (30432) Setting pythonPath for service "<default>": "c:\Users\***\AppData\Local\Microsoft\WindowsApps\python3.13.exe"
2025-08-08 16:55:56.248 [info] (30432) No include entries specified; assuming \<default workspace root>
2025-08-08 16:55:56.249 [info] (30432) Auto-excluding **/node_modules
2025-08-08 16:55:56.249 [info] (30432) Auto-excluding **/__pycache__
2025-08-08 16:55:56.250 [info] (30432) Auto-excluding **/.*
2025-08-08 16:55:57.367 [info] (30432) Assuming Python version 3.13.5.final.0
2025-08-08 16:55:58.653 [error] (30432) File or directory "\<default workspace root>" does not exist.
2025-08-08 16:55:58.653 [info] (30432) No source files found.
2025-08-08 16:55:58.718 [info] (30432) BG: Priority queue background worker(2) root directory: file:///c%3A/Users/***/.vscode/extensions/ms-python.vscode-pylance-2025.7.1/dist
2025-08-08 16:55:58.718 [info] (30432) BG: Priority queue background worker(2) started
2025-08-08 16:55:58.718 [info] (30432) Settings have not changed. Skipping update.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic from the provided snippet using Python 3.13.5, Pylance 2025.7.1, and the Python language mode in VS Code. Check the report for C.init and confirm that the double type alias produces no unknown-parameter-type error while the other uses remain error-free.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100