Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Printed type declarations drop @tag, @notUndefined and runtime annotations

Đang mở
#9,134 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@cknitt đang làm issue này rồi.

Từ ngày 30/10/2026.

  • #9136 của @cknitt — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ocaml
Lĩnh vực
compilers

Hướng nghiên cứu

Start with Printtyp.tree_of_type_decl, which the issue identifies as the printer used by error messages, hover, and createInterface. Compare its handling of @unboxed and @immediate with @tag, @notUndefined, @typeOf, and @instanceOf; use the named expected-output files and the applied-functor example to check the affected paths. Done means printed declarations retain these annotations in diagnostics, hover, and generated interfaces. An open linked pull request already tracks the work.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Printed type declarations keep @unboxed and @immediate, but drop the other annotations of a declaration: @tag, @notUndefined and the runtime annotations (@typeOf, @instanceOf). @as on fields and constructors is kept. The printer is Printtyp.tree_of_type_decl, used by error messages, hover and createInterface.

Error messages. The declaration the message is about is printed without the annotation it names:

module M: {
  @tag("kind") type v = Circle({r: float}) | Square({side: float})
} = {
  @tag("type") type v = Circle({r: float}) | Square({side: float})
}
Type declarations do not match:
  type v = Circle({r: float}) | Square({side: float})
is not included in
  type v = Circle({r: float}) | Square({side: float})
...
Their @tag annotations differ.

The same happens with @notUndefined (tests/build_tests/super_errors/expected/not_undefined_functor_argument.res.expected, where the expected side prints as type t) and with @typeOf (runtime_annotation_interface_over_record.res.expected).

Generated interfaces. createInterface prints a type when it cannot copy its source, as for a type of an applied functor. The annotation is lost and the interface does not match its implementation:

module Make = (X: {type t}) => {
  @tag("kind") type wrapped = Value({value: X.t}) | Empty({reason: string})
}

module Applied = Make({
  type t = int
})

The generated interface has module Applied: { type wrapped = Value({value: int}) | Empty({reason: string}) }, and compiling it with the implementation fails:

In module Applied:
Type declarations do not match:
  type wrapped = Applied.wrapped = Value({value: int}) | Empty({reason: string})
is not included in
  type wrapped = Value({value: int}) | Empty({reason: string})
...
Their @tag annotations differ.

Hover prints types the same way, so it hides these annotations too.

Ngôn ngữ chính
OCaml
Star
7.5k
Fork
484
Merge trung bình
21 giờ 9 phút
Pull request đã merge (30 ngày)
255

Chuẩn bị môi trường

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rescript-lang/rescript

Tất cả issue của rescript-lang/rescript

Issue tương tự

Thêm issue về Compilers

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.