A parenthesized assignment target such as `(x) = 7` is emitted with its parentheses, and Dafny cannot parse it
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Lỗi nằm ở desugarStmtExpr trong tools/src/extract.ts, hàm này lấy vế đích của phép gán từ getText() mà không bóc ParenthesizedExpression; kiểm tra havoc() trong extractStmts cũng dùng Node.isIdentifier trên toán hạng bên trái. Bắt đầu bằng cách tái hiện ví dụ (x) = 7 với lsc gen --backend=dafny. Hoàn thành khi vế đích có ngoặc phát ra x := 7;, giống đầu ra của dạng không có ngoặc, và thao tác ghi được theo dõi bởi lượt havoc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 113
- Fork
- 13
- Merge trung bình
- 15 giờ 35 phút
- Pull request đã merge (30 ngày)
- 56
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của midspiral/LemmaScript
-
In a pure function body, a `const` declared inside an `if` branch stays in scope after the `if`, so a false `ensures` can verifyCó thể đã có người làm @namin đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
midspiral/LemmaScript#362 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A `const` or `let` inside a bare `{ }` block stays in scope after the block, so a false `ensures` can verifyCó thể đã có người làm @namin đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
midspiral/LemmaScript#361 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A closure declared before a same-name `const` or `let` in its block reads the outer variable, so a false `ensures` can verifyCó thể đã có người làm @namin đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
midspiral/LemmaScript#360 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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 verifyCó thể đã có người làm @namin đã nhận hôm nay. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 30/100
midspiral/LemmaScript#356 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
midspiral/LemmaScript#354 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của midspiral/LemmaScript
Issue tương tự
-
infra needs-triage
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
LucasSantana-Dev/Lucky#3331 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
kOaDT/oss-oopssec-store#381 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nocobase/nocobase#11669 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaudeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: API Bug Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
Maintainer thường phản hồi trong vòng 1 ngày