Skip to content

Fix overload override matching order - #11704

Draft
Bill Schnurr (bschnurr) wants to merge 1 commit into
microsoft:mainfrom
bschnurr:fix-11549-overload-override-order
Draft

Bill Schnurr (bschnurr) wants to merge 1 commit into
microsoft:mainfrom
bschnurr:fix-11549-overload-override-order

Conversation

@bschnurr

Copy link
Copy Markdown
Member

Description

Accept overloaded overrides that add disjoint extra overloads or cover multiple base domains without spurious ordering failures, while continuing to reject incompatible overlaps and genuinely reordered matches.

How you figured out what to do

I traced overloaded override comparison in typeEvaluator.ts and added a focused matrix of positive and negative subclass cases. The prior implementation selected one best match, which made compatibility depend on the placement of otherwise valid additional overloads.

Implementation

Compare override overloads against base call domains rather than selecting a single match. The new logic tracks newly covered base overload indices, preserves monotonic base ordering, and rejects incompatible overlapping extras unless an earlier compatible match already shadows the overlap.

Screenshots or GIFs are not applicable because this change affects analyzer or language-service behavior and has no visual UI.

Testing

Added overloadOverride2.py and its evaluator test with positive cases for extras before and after base overloads and broad compatible coverage, plus negative cases for reordered matches and incompatible broad overlaps. The evaluator regression suite passed.

Addresses

Fixes #11549

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-   .../projects/sympy/sympy/solvers/bivariate.py:135:15 - error: Operator "-" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/bivariate.py:139:17 - error: Operator "-" not supported for type "Basic | Unknown" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/bivariate.py:144:23 - error: Operator "-" not supported for "None" (reportOptionalOperand)
-   .../projects/sympy/sympy/solvers/deutils.py:234:14 - error: Operator "not in" not supported for types "str" and "Unknown | int"
-     Operator "not in" not supported for types "str" and "int" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:423:38 - error: Argument of type "Unknown | Expr | Literal[0]" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:423:38 - error: Argument of type "int | Expr" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
-     Type "Unknown | Expr | Literal[0]" is not assignable to type "Expr"
+     Type "int | Expr" is not assignable to type "Expr"
-       "Literal[0]" is not assignable to "Expr" (reportArgumentType)
+       "int" is not assignable to "Expr" (reportArgumentType)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:504:19 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:505:19 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:506:19 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:569:42 - error: Operator "*" not supported for types "int" and "Unknown | Basic"
+     Operator "*" not supported for types "int" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:569:50 - error: Operator "*" not supported for types "Expr" and "Unknown | Basic"
+     Operator "*" not supported for types "Expr" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:725:42 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:735:19 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:736:19 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:737:19 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:814:47 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:841:26 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:842:22 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:843:36 - error: Operator "*" not supported for types "int" and "Unknown | Basic"
+     Operator "*" not supported for types "int" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:843:42 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:843:51 - error: Operator "*" not supported for types "int" and "Unknown | Basic"
+     Operator "*" not supported for types "int" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:843:57 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:843:66 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:845:53 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:854:18 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:856:22 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:865:22 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:865:36 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:867:27 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:868:27 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:869:27 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:870:27 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:871:27 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:872:27 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:876:24 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:877:24 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:878:24 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[2]"
+     Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:879:24 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:880:24 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:881:24 - error: Operator "*" not supported for types "Unknown | Basic" and "Unknown | Basic"
+     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:888:37 - error: Operator "*" not supported for types "int" and "Unknown | None"
+     Operator "*" not supported for types "int" and "None" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:888:45 - error: Operator "*" not supported for types "int" and "Unknown | None"
+     Operator "*" not supported for types "int" and "None" (reportOperatorIssue)

... (truncated 643 lines) ...

pyodide (https://github.com/pyodide/pyodide)
+   .../projects/pyodide/src/py/_pyodide/_core_docs.py:1120:9 - error: Method "get" overrides class "Mapping" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
-   .../projects/pyodide/src/py/_pyodide/_core_docs.py:1131:7 - error: Base classes for class "JsMutableMap" define method "get" in incompatible way
+   .../projects/pyodide/src/py/_pyodide/_core_docs.py:1158:9 - error: Method "pop" overrides class "MutableMapping" in an incompatible manner
- 848 errors, 24 warnings, 0 informations
+ 849 errors, 24 warnings, 0 informations

prefect (https://github.com/PrefectHQ/prefect)
+   .../projects/prefect/src/prefect/flows.py:2467:9 - error: Method "__call__" overrides class "Flow" in an incompatible manner
+     Overloads for override method must be in the same order as the base method (reportIncompatibleMethodOverride)
- 6025 errors, 201 warnings, 0 informations
+ 6026 errors, 201 warnings, 0 informations

werkzeug (https://github.com/pallets/werkzeug)
-   .../projects/werkzeug/src/werkzeug/datastructures/accept.py:85:9 - error: Method "__getitem__" overrides class "list" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 354 errors, 18 warnings, 0 informations
+ 353 errors, 18 warnings, 0 informations

Tanjun (https://github.com/FasterSpeeding/Tanjun)
-   .../projects/Tanjun/tanjun/clients.py:2250:9 - warning: Method "iter_menu_commands" overrides class "Client" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 36 errors, 112 warnings, 0 informations
+ 36 errors, 111 warnings, 0 informations

mypy (https://github.com/python/mypy)
-   .../projects/mypy/mypy/typeshed/stdlib/configparser.pyi:383:9 - error: Method "get" overrides class "Mapping" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
-   .../projects/mypy/mypy/typeshed/stdlib/ssl.pyi:411:9 - error: Method "get_ca_certs" overrides class "_SSLContext" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
-   .../projects/mypy/mypy/typeshed/stdlib/tempfile.pyi:257:9 - error: Method "write" overrides class "IO" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 1074 errors, 78 warnings, 0 informations
+ 1071 errors, 78 warnings, 0 informations

xarray (https://github.com/pydata/xarray)
-   .../projects/xarray/xarray/core/datatree.py:320:9 - error: Method "__getitem__" overrides class "Dataset" in an incompatible manner
+   .../projects/xarray/xarray/core/utils.py:557:9 - error: Method "get" overrides class "Mapping" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
+   .../projects/xarray/xarray/tests/test_namedarray.py:425:17 - error: Method "_new" overrides class "NamedArray" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
+   .../projects/xarray/xarray/tests/test_namedarray.py:486:17 - error: Method "_new" overrides class "NamedArray" in an incompatible manner
- 2320 errors, 201 warnings, 0 informations
+ 2322 errors, 201 warnings, 0 informations

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ .../projects/pandas-stubs/pandas-stubs/_libs/tslibs/timedeltas.pyi
+   .../projects/pandas-stubs/pandas-stubs/_libs/tslibs/timedeltas.pyi:260:9 - error: Method "__truediv__" overrides class "timedelta" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
+ .../projects/pandas-stubs/pandas-stubs/core/window/ewm.pyi
+   .../projects/pandas-stubs/pandas-stubs/core/window/ewm.pyi:59:39 - error: Unnecessary "# pyright: ignore" rule: "reportIncompatibleMethodOverride" (reportUnnecessaryTypeIgnoreComment)
- 470 errors, 3 warnings, 0 informations
+ 472 errors, 3 warnings, 0 informations

pip (https://github.com/pypa/pip)
+ .../projects/pip/src/pip/_vendor/requests/structures.py
+   .../projects/pip/src/pip/_vendor/requests/structures.py:129:9 - error: Method "get" overrides class "dict" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 562 errors, 38 warnings, 0 informations
+ 563 errors, 38 warnings, 0 informations

spack (https://github.com/spack/spack)
+   .../projects/spack/lib/spack/spack/build_environment.py:248:9 - error: Method "__call__" overrides class "Executable" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 1851 errors, 21 warnings, 0 informations
+ 1852 errors, 21 warnings, 0 informations

steam.py (https://github.com/Gobot1234/steam.py)
+   .../projects/steam.py/steam/utils.py:565:9 - error: Method "pop" overrides class "ChainMap" in an incompatible manner
+     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 8304 errors, 87 warnings, 0 informations
+ 8305 errors, 87 warnings, 0 informations

scipy-stubs (https://github.com/scipy/scipy-stubs)
+   .../projects/scipy-stubs/scipy-stubs/sparse/_dok.pyi:93:72 - error: Unnecessary "# pyright: ignore" rule: "reportIncompatibleMethodOverride" (reportUnnecessaryTypeIgnoreComment)
+   .../projects/scipy-stubs/scipy-stubs/stats/_distribution_infrastructure.pyi:483:35 - error: Unnecessary "# pyright: ignore" rule: "reportIncompatibleMethodOverride" (reportUnnecessaryTypeIgnoreComment)
- 1495 errors, 0 warnings, 0 informations
+ 1497 errors, 0 warnings, 0 informations

bidict (https://github.com/jab/bidict)
- .../projects/bidict/bidict/_bidict.py
-   .../projects/bidict/bidict/_bidict.py:159:9 - error: Method "pop" overrides class "MutableMapping" in an incompatible manner
-     Override does not handle all overloads of base method (reportIncompatibleMethodOverride)
- 9 errors, 1 warning, 0 informations
+ 8 errors, 1 warning, 0 informations

@heejaechang

Heejae Chang (heejaechang) commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

🔴 Pyright CLI QA — 96880e54 — verdict: red

Automated CLI checks compared this change with its base revision.
5 focused check(s) completed.

Needs review: reportIncompatibleMethodOverride newly reported

The PR reports reportIncompatibleMethodOverride for this example; the base does not. Is this change intended?

Reproduction and observed results

Create these files in an empty directory:

main.py

from typing import overload, assert_type


class Base:
    @overload
    def convert(self, value: int) -> int: ...
    @overload
    def convert(self, value: object) -> object: ...
    def convert(self, value: object) -> object:
        return value


class Derived(Base):
    @overload
    def convert(self, value: int | bytes) -> int: ...
    @overload
    def convert(self, value: object) -> object: ...
    def convert(self, value: object) -> object:
        return len(value) if isinstance(value, bytes) else value


def check(base: Base, derived: Derived) -> None:
    assert_type(base.convert(1), int)
    assert_type(base.convert(b"abc"), object)
    assert_type(derived.convert(1), int)
    assert_type(derived.convert(b"abc"), int)
    assert_type(derived.convert("abc"), object)

pyrightconfig.json

{
    "include": ["main.py"],
    "pythonVersion": "3.13",
    "typeCheckingMode": "standard"
}

From that directory, run each built Pyright revision:

node <pyright-cli-entrypoint> --outputjson -p .

Base fa9b200906fadc093e862ce62ec1afa985c7233d

{
  "exit_code": 0,
  "diagnostics": []
}

PR 96880e546d0f6da58cbfc0d9252b2c554379adb3

{
  "exit_code": 1,
  "diagnostics": [
    {
      "file": "main.py",
      "severity": "error",
      "rule": "reportIncompatibleMethodOverride",
      "message": "Method \"convert\" overrides class \"Base\" in an incompatible manner\n  Override does not handle all overloads of base method",
      "range": {
        "start": [
          17,
          8
        ],
        "end": [
          17,
          15
        ]
      }
    }
  ]
}

Diagnostic ranges use zero-based line and character positions.

@bschnurr

Copy link
Copy Markdown
Member Author

/benchmark

@github-actions

Copy link
Copy Markdown
Contributor

Compared candidate 0eac25057a4f5d18d78709151e57e600dd9a5d3c against its first parent 9bf95be56744123da06567463df1eb5d6fe81896.

View the full release history charts with the base and PR results.

Execution time history

Execution time history

Peak memory history

Peak memory history

Download the chart artifact.

Type checker benchmark

🟢 No performance regressions detected.

Regression threshold: 20.0%
Statistic: median
Variance guard: >1.0s time and >100.0 MB memory

Package Checker Files checked Time Time delta Peak memory Memory delta Status
ansible pyright 583 11.379s +0.2% 1106.9 MB +0.7% 🟢 Pass
click pyright 17 2.931s -0.6% 353.9 MB -0.3% 🟢 Pass
homeassistant pyright 9850 98.076s +0.4% 6100.7 MB +0.1% 🟢 Pass
numpy pyright 356 36.635s +0.8% 1217.5 MB -0.9% 🟢 Pass
pandas pyright 1459 117.288s -2.5% 3658.7 MB +0.5% 🟢 Pass
pytest pyright 243 12.199s -0.9% 841.2 MB -1.6% 🟢 Pass
requests pyright 19 2.354s +1.7% 342.2 MB +0.0% 🟢 Pass
torch pyright 2400 135.421s -1.0% 4923.4 MB -2.1% 🟢 Pass
transformers pyright 2901 105.456s -0.6% 4964.1 MB -2.2% 🟢 Pass

Pyright stats

Package Parsed/bound Checked Find Read Tokenize Parse Imports Bind Check Cycles
ansible 989 583 0.020s 0.057s 0.257s 0.453s 0.160s 0.620s 9.237s 0.000s
click 111 17 0.000s 0.010s 0.123s 0.230s 0.030s 0.260s 1.977s 0.000s
homeassistant 11147 9850 0.233s 0.557s 2.107s 3.293s 1.647s 4.817s 83.127s 0.000s
numpy 603 356 0.010s 0.070s 0.397s 0.750s 0.273s 0.933s 33.787s 0.000s
pandas 1895 1459 0.050s 0.253s 1.167s 2.073s 0.277s 2.313s 109.383s 0.000s
pytest 542 243 0.020s 0.053s 0.350s 0.570s 0.110s 0.710s 10.003s 0.000s
requests 168 19 0.000s 0.020s 0.113s 0.220s 0.050s 0.263s 1.370s 0.000s
torch 3079 2400 0.140s 0.397s 2.127s 3.780s 0.627s 5.073s 121.183s 0.000s
transformers 3535 2901 0.090s 0.443s 2.070s 3.153s 0.823s 8.050s 93.573s 0.000s

@heejaechang

Copy link
Copy Markdown
Collaborator

I found an incompatible override that this change newly accepts. The baseline (7ddd3b12) reports reportIncompatibleMethodOverride, but the PR head (96880e54) reports no errors, even in strict mode with reportOverlappingOverload enabled.

The signatures below have different optional keyword parameters, but both accept f(1):

from typing import overload


class Base:
    @overload
    def f(self, x: int, *, a: int = 0) -> int: ...
    @overload
    def f(self, x: str, *, a: int = 0) -> str: ...

    def f(self, x: int | str, *, a: int = 0) -> int | str:
        return x


class Child(Base):
    @overload
    def f(self, x: int, *, b: int = 0) -> str: ...
    @overload
    def f(self, x: int, *, a: int = 0) -> int: ...
    @overload
    def f(self, x: str, *, a: int = 0) -> str: ...

    def f(self, x: int | str, **kwargs: int) -> int | str:
        if isinstance(x, int) and "a" not in kwargs:
            return "not an int"
        return x


def use_base(value: Base) -> int:
    return value.f(1) + 1


use_base(Child())  # TypeError in CPython 3.12.10

The new overlap check treats the extra child signature as disjoint, then accepts the later signatures as covering the base overloads. However, the shared call f(1) can return str, violating the base method's int return contract.

Could the overlap check account for shared calls when parameter names/defaults differ, and add a regression test? I also reproduced this with f(x: int) -> int versus an extra f(y: int) -> str: different parameter names still allow the same positional call.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of additional overloads matters in subclass where it shouldnt [reportIncompatibleMethodOverride]

2 participants