Skip to content

Duplicated diagnostics with standalone expressions in overloads #1428

@ibraheemdev

Description

@ibraheemdev

We currently silence diagnostics during multi-inference for overload arguments, but this doesn't work for standalone expressions.

from typing import overload

@overload
def f(_: str): ...

@overload
def f(_: str): ...

def f(_: str): ...

def _(a: object, b: object):
    f(f"{'a' if a > b else 'b'}")
error[unsupported-operator]: Operator `>` is not supported for types `object` and `object`
  --> x.py:12:17
   |
11 | def _(a: object, b: object):
12 |     f(f"{'a' if a > b else 'b'}")
   |                 ^^^^^
   |
info: rule `unsupported-operator` is enabled by default

error[unsupported-operator]: Operator `>` is not supported for types `object` and `object`
  --> x.py:12:17
   |
11 | def _(a: object, b: object):
12 |     f(f"{'a' if a > b else 'b'}")
   |                 ^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions