Scala: given...with instance methods leak to the file and collide with same-named trait methods
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #4131 @rajatnagda45 による — マージされずにクローズ
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
調査の方向性
Start by reading the Scala extraction path exposed as extract_scala and how class_types handles given_definition and with_template_body. Use the given.scala reproduction to check the graph. Done means intShow owns show and helper, the call stays within the given, and the trait's show node is untouched.
索引モデルが issue の本文から書いたものです。
説明
Version / commit
v0.9.77 (v8 @ 5c7b847)
Environment
macOS, Python 3.13, clean checkout of v8.
What happens
A Scala 3 given name: T with { ... } instance owns method implementations, but it is not modelled as a container. Its methods leak to the file node, and when a given method shares a name with a method of the trait it implements (the normal case — it IS the implementation), the leaked file-level node collides with the trait's method node. The trait node then wrongly carries the given's call/reference edges, corrupting the graph.
Minimal reproduction
// given.scala
trait Show[A]:
def show(a: A): String
given intShow: Show[Int] with
def show(a: Int): String = helper(a)
def helper(a: Int): String = a.toString
from graphify.extract import extract_scala
r = extract_scala("given.scala")
print([n["label"] for n in r["nodes"]])
# -> no 'intShow' node; a stray file-level 'helper' appears
print([(e["source"], e["target"]) for e in r["edges"] if e["relation"] == "calls"])
# the show -> helper call is attributed to the TRAIT's show node, not the given's
Expected vs actual
- Expected: an
intShownode owningshow/helper; theshow -> helpercall stays inside the given; the trait node is untouched. - Actual: no given node; methods leak to the file; the trait
shownode is polluted with the given's edges.
Root cause
given_definition is absent from the Scala class_types, so the engine never opens a scope for its with_template_body; the members are walked as if they were file-level definitions and their ids collide with equally-named trait members.
A clean checkout of v8 reproduces it. Fix PR to follow.
- 主要言語
- Python
- スター
- 124k
- フォーク
- 11.9k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Graphify-Labs/graphify のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
Graphify-Labs/graphify#3763 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Graphify-Labs/graphify#3611 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Nix supportオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Graphify-Labs/graphify#3193 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Graphify-Labs/graphify#2871 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Graphify-Labs/graphify#2865 ·
メンテナーはふだん 1 日以内に返信
Graphify-Labs/graphify の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
huggingface/sentence-transformers#4186 ·
メンテナーはふだん 5 日以内に返信
-
documentation good first issue
難易度 2/5 半日 初心者へのやさしさ 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
SCIInstitute/SCIRun#2842 ·
メンテナーはふだん 3 日以内に返信