A where clause that is an or cannot prove a constraint that each disjunct implies
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start by reading the compiler's handling of where clause disjunctions and how it derives evidence from trait refinement; the issue does not name the relevant files or tests. Reproduce the needs_base and needs_copyable examples, then identify or add coverage for each. Done means both calls are accepted when every disjunct implies the required constraint, including the stdlib predicate cases.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When a function's where clause is a disjunction, the compiler can't use it to prove a constraint that follows from every disjunct.
Calls that need that constraint fail with "lacking evidence to prove correctness".
from std.traits import IsTriviallyCopyable
trait Base:
pass
trait Left(Base):
pass
trait Right(Base):
pass
def needs_base[T: AnyType]() where conforms_to(T, Base):
pass
def either_refinement[T: AnyType]() where conforms_to(T, Left) or conforms_to(
T, Right
):
needs_base[T]() # error
def needs_copyable[T: AnyType]() where conforms_to(T, Copyable):
pass
def trivially_copyable[T: AnyType]() where IsTriviallyCopyable[T]:
needs_copyable[T]() # error
error: invalid call to 'needs_base': lacking evidence to prove correctness
note: constraint declared here needs evidence for 'conforms_to(T, Base)'
error: invalid call to 'needs_copyable': lacking evidence to prove correctness
note: constraint declared here needs evidence for 'conforms_to(T, Copyable)'
Both Left and Right refine Base, so either disjunct proves conforms_to(T, Base).
The second case matters more. The stdlib's IsTriviallyCopyable, IsTriviallyMovable and IsTriviallyDeinitable are all disjunctions.
For example:
conforms_to(T, TrivialRegisterPassable) or
(conforms_to(T, Copyable) and downcast[T, Copyable].__copy_ctor_is_trivial)
So where IsTriviallyCopyable[T] proves only that exact proposition. It doesn't prove conforms_to(T, Copyable), and it doesn't prove that the copy constructor is trivial. That makes these stdlib predicates much less useful in generic code.
- Ngôn ngữ chính
- Mojo
- Star
- 30.2k
- Fork
- 3.2k
- Merge trung bình
- 6 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 25
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 modular/modular
-
bug_feature_triaged Team: Mojo Libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG]Incomplete Apache LicenseĐang mởbug bug_feature_triaged documentation mojo
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
`Counter.lt()` and `Counter.gt()` disagree with `__eq__`, and `a.lt(a)` can be `True`Có thể đã có người làm @YidaWeng đã nhận 1 ngày trước. Đang mởbug_feature_triaged Team: Mojo Libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
modular/modular#7696 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] `Counter` `-=`, `+=` and `&=` leave keys behind when they remove many keysCó thể đã có người làm @Tharun-Kumar-McW đã nhận 5 ngày trước. Đang mởbug bug_feature_triaged mojo-stdlib Team: Mojo Libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
modular/modular#7658 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] exp(NaN) returns infĐang mởbug bug_feature_triaged mojo Team: Mojo Libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
modular/modular#7646 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của modular/modular
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
midspiral/LemmaScript#355 · 1 bình luận ·
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
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 82/100
grame-cncm/faust#1409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LiteralFloatValue: derived PartialEq with manual Hash on f64 breaks the Eq/Hash contract for -0.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gleam-lang/gleam#6524 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BigQuery -> Snowflake: UNNEST WITH OFFSET column becomes x['off'] when the UNNEST is the only sourceĐang mở
Độ 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