Skip to content

use all usages within class (or within __init__) to infer type, not just initial assignment #1159

@KotlinIsland

Description

@KotlinIsland

Describe the Bug

class A:
    a = 1
    def f(self):
        self.a = "a"  # error, expect no error

here a is int, but if we look at all usages in the class then we can infer a much better type

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions