#190 compat re-exports are abstract aliases: FormerHome.Ctor, FormerHome.field and type equations stop compiling (2,303 alias lines in blend 0.0.39-beta.4)
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
- 22/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Start with test/module-move-compat.mjs and the acceptance criteria: it should cover an enum moved by an SCC merge and compile a constructor through the former home. Then trace the emitter that writes compat files and the type X = New.X alias lines, and find where moved-module information is recorded after #171 renames. Done means FormerHome.Ctor and type t = FormerHome.x = | … compile for enums, with shadowing handled in reused live homes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When #190 moves a type to another module, the former home gets a compatibility re-export of the form
type inputSizeV2 = HighchartsSharedSharedTypes.inputSizeV2
That keeps type annotations resolving, but it is an abstract alias, so everything else a consumer writes against the former home stops compiling:
- Constructors —
FormerHome.Md→The variant constructor FormerHome.Md can't be found. - Record fields —
{FormerHome.name: …}/x.FormerHome.nameno longer resolve. - Type equations —
type t = FormerHome.x = | A | B→This variant or record definition does not match that of type FormerHome.x. Their kinds differ.
So for variants and records the public path is only half preserved. The file header says "Old X.<name> annotations keep resolving", which is accurate, but most real usage of an enum is its constructors.
Evidence — @juspay/[email protected] (bindgen 1.4.0-beta.8)
Alias-only compat lines per module:
| Module | alias lines |
|---|---|
ContextSharedTypes |
1336 |
HighchartsSharedTypes |
866 |
SidebarV2Types |
30 |
DateRangePickerTypes |
27 |
TopbarV2Types |
15 |
ChartsV2Types |
14 |
DirectoryTypes |
8 |
InputsV2Types |
7 |
Upgrading a consumer app from 0.0.38-beta.1 to 0.0.39-beta.4:
- 60 references of the form
ContextSharedTypes.Md/.Lg/.Count/DateRangePickerTypes.Rightfailed with "constructor can't be found", although every one of those paths has a compat line. - The app already carries ~270 hand-written lines of narrow re-exports (
type menuAlignment = HighchartsSharedSharedTypes.menuAlignment = | @as("start") Start | …) to get constructors and fields back under the old module names. One of them broke again on this bump: it pointed atInputsV2Types.uploadStateInputsV22, which is now an alias, so the equation failed with "Their kinds differ". - The only alternative is referencing the 53k-line
HighchartsSharedSharedTypesdirectly from app code.
Minimal repro
// New.res
type size = | @as("sm") Sm | @as("md") Md
// Old.res (what bindgen emits today)
type size = New.size
// Consumer.res
let a: Old.size = Md // ok (type-directed)
let b = Old.Md // ✗ The variant constructor Old.Md can't be found
type mine = Old.size = | @as("sm") Sm | @as("md") Md // ✗ Their kinds differ
Proposed fix
Re-export with the definition repeated, which ReScript accepts and which keeps type identity:
type size = New.size =
| @as("sm") Sm
| @as("md") Md
Suggested staging:
- Part 1 —
kind: 'enum': the body has no type references, so it can be emitted verbatim. This alone restores everyFormerHome.Ctorpath. - Part 2 — records /
@unboxed/@tagvariants: same idea, with field types resolved from the former home's point of view (qualified to the new module).
Two details to handle:
- Constructor names must be final. #171 renames Class A collisions in place while the new home is emitted, so compat bodies have to be rendered after every live module has been emitted.
- A former home reused as a live module must not have its own constructors shadowed. If a re-exported enum shares a constructor name with the live module's own types, an unannotated
Host.Mdwould silently change type. Keep the abstract alias for that one type in that case.
Acceptance
FormerHome.Ctorcompiles for every moved enum, in standalone compat files and in reused live homes (unless it would shadow).type t = FormerHome.x = | …compiles.test/module-move-compat.mjscovers an enum moved by an SCC merge, with a compile check that uses the constructor through the former home.
- Ngôn ngữ chính
- ReScript
- Star
- 11
- Fork
- 0
- Merge trung bình
- 7 giờ 27 phút
- Pull request đã merge (30 ngày)
- 6
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 juspay/rescript-bindgen
-
--subpaths: a shadowed subpath export is dropped. Bind it under a subpath-qualified name (blend V1 deprecated paths)Có thể đã có người làm @jagguji đã nhận 2 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 64/100
juspay/rescript-bindgen#248 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
juspay/rescript-bindgen#164 · 2 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
juspay/rescript-bindgen#162 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
juspay/rescript-bindgen#160 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
juspay/rescript-bindgen#159 ·
Tất cả issue của juspay/rescript-bindgen
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
c1overzz/dsh-bili-scroll#213 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
conda/governance#490 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
enhancement
Độ 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
jonathanong/no-mistakes#5441 ·
-
bug
Độ 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 2 ngày