Skip to content

Class variable gets the type of instance variable #4886

Open
@roganov

Description

@roganov

According to PEP 526, type annotations inside class bodies apply to instances unless wrapped with ClassVar. Am I misreading something or is this a bug?

class Test:
    a: int

reveal_type(Test.a + 1)
Revealed type is 'builtins.int'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions