Record coercion can turn an immutable field into a mutable one
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 57/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ệ
- ocaml
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start with Record_coercion.check_record_fields in compiler/ml/record_coercion.ml and read how it checks field names, optionality, runtime names, and field type subtyping. Trace the coercion checks for immutable and mutable fields, then add coverage for the shown ro to rw case and for fields mutable on both sides. Done when the first coercion is rejected and the mutable-to-mutable case requires equal field types.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
:> between record types accepts a target whose field is mutable when the source's field is not:
type ro = {x: float}
type rw = {mutable x: float}
let toRw = (r: ro) => (r :> rw)
compiles on master (1a49d918e) to
function toRw(r) {
return r;
}
So a value typed ro, whose x the type system treats as immutable, can be written through the coerced view:
let r: ro = {x: 0.}
let w = (r :> rw)
w.x = 1. // compiles; r.x is now 1.
Where
Record_coercion.check_record_fields (compiler/ml/record_coercion.ml) compares field names, optionality and runtime names, and passes the field types on for subtyping; it does not compare mutability.
Expected
A coercion should not grant write access the source does not have: a mutable target field requires a mutable source field. Where both are mutable, the field type is read and written, so it has to be equal (invariant) rather than a subtype.
- Ngôn ngữ chính
- OCaml
- Star
- 7.5k
- Fork
- 483
- Merge trung bình
- 20 giờ 50 phút
- Pull request đã merge (30 ngày)
- 230
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- 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 rescript-lang/rescript
-
Create interface drops attributes in front of type declarationsCó thể đã có người làm @cknitt đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
rescript-lang/rescript#9095 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dev dependencies interactingCó thể đã có người làm @CarlOlson đã nhận hôm nay. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 25/100
rescript-lang/rescript#9089 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
rescript-lang/rescript#9074 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
No completion for extensible variant constructorsCó thể đã có người làm @cknitt đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
rescript-lang/rescript#9073 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hover and completion on an applied functor show the functor body's typesCó thể đã có người làm @cknitt đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rescript-lang/rescript#9072 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rescript-lang/rescript
Issue tương tự
-
area:codegen backend:spirv bug direction:input
Độ 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 1 ngày
-
log1p loses all precision for small |x| wherever the polyfill runs (LLVM backend, Metal, WGSL)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/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 78/100
HansKristian-Work/dxil-spirv#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Removing nodes from a DFGĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
cucapra/calyx-libm#4 ·
-
Inline asm missing mnemonicsĐ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