A parenthesized assignment target such as `(x) = 7` is emitted with its parentheses, and Dafny cannot parse it
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- compilers
調査の方向性
バグは tools/src/extract.ts の desugarStmtExpr にあります。この関数は、ParenthesizedExpression を展開せずに getText() から代入先を取得しています。また、extractStmts 内の havoc() のチェックも、左辺のオペランドに対して Node.isIdentifier を使っています。まず lsc gen --backend=dafny で (x) = 7 の例を再現してください。括弧付きの代入先が、括弧なしの形と同じ x := 7; を出力し、その書き込みが havoc パスで追跡されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
An assignment whose target is in parentheses, such as (x) = 7, is extracted with the parentheses kept in the target name. lsc emits (x) := 7;, which Dafny cannot parse. Because the target is the string "(x)", the write is also invisible to the passes that track assignments to x.
Reproduced on upstream main at 2ccd0a5 (0.6.11) with Dafny 4.11.0.
Reproduction
export function parenAssign(p: number): number {
let x = p;
(x) = 7;
return x;
}
lsc gen --backend=dafny emits (x) := 7;, and Dafny reports:
(6,6): Error: invalid Suffix
1 parse errors detected
(p) = 7 on a parameter, (x) += 2 and (x)++ fail the same way, and --backend=lean also emits (x) := 7.
Expected
Extract should strip parentheses from assignment and update targets, so (x) = 7 produces the same output as x = 7.
Likely cause
desugarStmtExpr in tools/src/extract.ts takes the target from getText() on the left operand (and on the operand of ++/--) without unwrapping a ParenthesizedExpression. The havoc() assignment check in extractStmts uses Node.isIdentifier(expr.getLeft()) and misses parenthesized targets for the same reason.
Related
- #356: an assignment in expression position, including the parenthesized statement
(x = 7);, is extracted as an equality test, and a falseensuresverifies. Both need parentheses unwrapped indesugarStmtExpr.
- 主要言語
- TypeScript
- スター
- 113
- フォーク
- 13
- 平均マージ
- 15時間 35分
- マージ済み PR(30日)
- 56
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
midspiral/LemmaScript のほかの issue
-
In a pure function body, a `const` declared inside an `if` branch stays in scope after the `if`, so a false `ensures` can verify対応中かも @namin が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
midspiral/LemmaScript#362 ·
メンテナーはふだん 1 日以内に返信
-
A `const` or `let` inside a bare `{ }` block stays in scope after the block, so a false `ensures` can verify対応中かも @namin が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
midspiral/LemmaScript#361 ·
メンテナーはふだん 1 日以内に返信
-
A closure declared before a same-name `const` or `let` in its block reads the outer variable, so a false `ensures` can verify対応中かも @namin が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
midspiral/LemmaScript#360 ·
メンテナーはふだん 1 日以内に返信
-
An assignment used as an expression, such as `(x = 7);` or `const y = (x = 7)`, is extracted as an equality test, so a false `ensures` can verify対応中かも @namin が今日担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 30/100
midspiral/LemmaScript#356 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
midspiral/LemmaScript#354 ·
メンテナーはふだん 1 日以内に返信
midspiral/LemmaScript の issue をすべて見る
似ている issue
-
bug done
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
neavo/LinguaGacha#1124 ·
メンテナーはふだん 1 日以内に返信
-
[fullsend] E2E: backstage-microsoft-auth — catalogQuery missing error handler for network errors対応中かも @fullsend-ai-coder が今日担当しました。 オープンe2e-failure ready-to-code
難易度 2/5 1時間未満 初心者へのやさしさ 78/100
redhat-developer/rhdh-plugin-export-overlays#4821 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
brylie/mission-island#225 ·
メンテナーはふだん 1 日以内に返信
-
status/need-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google-gemini/gemini-cli#30412 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信