MagicPython
MagicPython copied to clipboard
[Bug] Class method 'self' looses special self scope with added type annotation
Got send here from 'vscode-python' https://github.com/microsoft/vscode-python/issues/11593
- Editor name and version: VS Code version: 1.44.2
- Platform: Windows_NT x64 10.0.17134
- Color scheme: Custom (close to Monokai)
- MagicPython version: Dunno which vscode uses
Without type annotation everything is just fine.

When a type annotation is added to the self parameter the special scope for self is missing.

Steps to reproduce:
Paste the following code into a *.py file and inspect the self parameter with the developer token inspect tool. Like in the screenshots above.
The self parameter of the bad_func should show the actual scopes and the self parameter of the good_func should show the expected scopes.
class Test:
def bad_func(self: Test):
pass
def good_func(self):
pass
Workaround: the new Pylance language server adds semantic highlighting which "fixes" this: https://github.com/microsoft/pylance-release#semantic-highlighting