MagicStack / MagicStack/MagicPython

[Bug] Class method 'self' looses special self scope with added type annotation

オープン
#209 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
1.4k
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

説明

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.
![image](https://user-images.githubusercontent.com/43916661/81209538-fa16f700-8fd0-11ea-80c4-73b9e1b86bd8.png)

When a type annotation is added to the `self` parameter the special scope for `self` is missing.
![image](https://user-images.githubusercontent.com/43916661/81209597-0602b900-8fd1-11ea-92b1-0444b29f0643.png)

## 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
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

再現された Python スニペットから始め、開発者向けのトークン検査ツールを使って、注釈付きおよび注釈なしの self パラメーターのトークンスコープを調べます。クラスメソッドのパラメーターを処理する構文ハイライトの経路を追跡します。完了条件は、self: Test が注釈なしの self と同じ特殊な self スコープを保持することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。