Skip to content

Argument type is unknown inside sum #6992

@mgmira

Description

@mgmira

Describe the bug
Latest version of Pyright reports this error

/code/.debug/foo/bar.py
  /code/.debug/foo/bar.py:10:13 - error: Argument type is partially unknown
    Argument corresponds to parameter "__iterable" in function "sum"
    Argument type is "Generator[Unknown, None, None]" (reportUnknownArgumentType)

This error wasn't reported on v1.1.341

Code or Screenshots

# /code/.debug/foo/bar.py
# pyright: strict

from __future__ import annotations


def get_value(x: int) -> int | None:
    ...


value = sum(max(value for x in range(10) if (value := get_value(x)) is not None) for _ in range(10))

VS Code extension or command-line
Pyright: 1.1.346

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions