tomv564 / pyls-mypy

Mypy plugin for the Python Language Server
MIT License
110 stars 62 forks source link

An overloaded function outside a stub file must have an implementation #30

Closed AmjadHD closed 5 years ago

AmjadHD commented 5 years ago

I'm not sure whether this is pyls-mypy, pyls or mypy's issue: I have two files: mod.py:

def add(x, y):
    return x + y

and mod.pyi:

from typing import overload

@overload
def add(x: int, y: int) -> int: ...

@overload
def add(x: int, y: float) -> float: ...

in mod.pyi i get this error on the first overload: mypy

but when I check in the command line, I get no errors:

Microsoft Windows [version 10.0.17763.678]
(c) 2018 Microsoft Corporation. Tous droits réservés.

D:\Amjad\test_mypy>mypy mod.pyi

D:\Amjad\test_mypy>mypy mod.py

D:\Amjad\test_mypy>
tomv564 commented 5 years ago

Try turning off live_mode. In live_mode mypy is not run against “mod.pyi” but only against its text as provided by pyls. Because it’s only text, mypy doesn’t know that it’s a stub file.

AmjadHD commented 5 years ago

Try turning off live_mode

How do I do that ?

AmjadHD commented 5 years ago

Thanks @tomv564, that fixed it, but does disabling live_mode have side effects ?

tomv564 commented 5 years ago

Updated the readme to answer your questions