try...finally block ignores return as "early exit"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 57/100
Hướng nghiên cứu
Start by reproducing the reported behavior in the linked Pyrefly sandbox, then read the type-checker's control-flow handling for try...finally and early returns. The issue does not name source files or tests, so locate the relevant regression coverage before changing anything. Done means the else branch in finally is no longer reported unreachable when the try block returns early.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the Bug
pyrefly ignores a "return" as block exit and evaluates ok to be "True" at the end of the block. I think this is an regression coming from 1.4.0 to 1.4.1, but I didn't verify the exact version number.
import random
def func():
ok: bool = False
try:
if random.randint(0, 10) == 5:
return
ok = True
finally:
if ok:
print('I am ok')
else:
print('Unreachable, eh?') # <!-- tells us this is unreachable
func()
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
- Ngôn ngữ chính
- Rust
- Star
- 7.2k
- Fork
- 578
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 facebook/pyrefly
-
False positive: `Protocol` with `EXCLUDED_ATTRIBUTES` cannot be used with `issubclass()`Có thể đã có người làm @amas127 đã nhận hôm nay. Đang mởtypechecking
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
typechecking
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
-
configuration quansight
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
-
Version-gated early exits: `from copy import replace` is accepted but `copy.replace` is rejectedĐang mởquansight scoping-control-flow
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Tất cả issue của facebook/pyrefly
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
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 77/100
tauri-apps/plugins-workspace#3780 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/spark-local-inference#268 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datafusion-contrib/StreamFusion#653 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug CLI exec session
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày