Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug]: Iterator of the for loop is treated as an object in get_code_dependency

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r
領域
tooling

調査の方向性

報告に記載された R の例を再現し、報告で言及されている get_code_dependency/get_code エントリーポイントから開始します。for ループのイテレーター x が依存関係として記録される仕組みを追跡し、その後、get_code(q, names = 'x') が一時的なループオブジェクトを抽出しなくなり、x <- 5 は保持されることを確認します。

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

説明

bug core

If object is treated as an iterator in a for loop, like x below, then get_code treats this case as this object created in this for loop, hence even though it's a temporary object (just for the time of the for loop execution) it gets extracted in the get_code

library(teal.code)
q <- within(qenv(), {
  a <- 1
  b <- 2
}) |> within({
  for (x in c(1, 2)) {
    b <- a
    b <- b + a + 1
    b + 3 -> b
  }
}) |> within({
  x <- 5
})

get_code(q, names = 'x') |> cat()
#> a <- 1
#> b <- 2
#> for (x in c(1, 2)) {
#>     b <- a
#>     b <- b + a + 1
#>     b <- b + 3
#> }
#> x <- 5

Created on 2024-11-27 with reprex v2.1.1

主要言語
R
スター
12
フォーク
11
平均マージ
8日 15時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

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

insightsengineering/teal.code のほかの issue

insightsengineering/teal.code の issue をすべて見る

似ている issue

R の issue をもっと見る

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

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