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

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

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

評価

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

調査の方向性

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

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

説明

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

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

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

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

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

はじめの一歩

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

MagicStack/MagicPython のほかの issue

MagicStack/MagicPython の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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