Skip to content

enforce operators include possible right hand types in their input parameter #1468

@KotlinIsland

Description

@KotlinIsland

Description

class Left:
    def __add__(self, other: int) -> int:
        # here "other" is `Right`
        return other + 1 # Type error here


class Right:
    def __radd__(self, other: Left) -> str:
        return "i'm string :)"


Left() + Right()

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting responsewaiting for more info from the author - will eventually close if they don't respondtype checking / lintingissues relating to existing diagnostic rules or proposals for new diagnostic rules

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions