Skip to content

Augmented assignment doesn't work on certain clases #210

@Skyscimitar

Description

@Skyscimitar

Describe the bug
Python augmented assignment expressions don't work on more complicated objects. The behaviour is the same when creating custom classes and implementing the augmented assignment magic methods.

To Reproduce
Run pyright on the provided code snippet

Expected behavior
No type exception should be thrown.

Screenshots or Code
Creating a list:

A: List[int] =  []
A += 0

The previous snippet throws the following error:

error: Operator '+' not supported for types 'List[int]' and 'int'

VS Code extension or command-line
The error occurs in both the VS Code extension and the command-line tool, both using version 1.0.56

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions