Repository navigation
fix(compiler)!: stabilize JS constructor tags across modules - #1488
Lorenzobattistela merged 1 commit into
Conversation
|
Thanks @oxura. A few notes on this one: The GUIDE is supposed to be written by hand, so please drop the GUIDE.md edit. The wording there could improve, but we'll do that ourselves. Two problems with the tests:
We'll discuss the tag change itself with @nicolas-abril before deciding on this PR. |
|
Addressed in 059c4ce:
Actual local verification: both fixtures print |
|
Please don't change the Changelog on PRs. |
|
Removed in 11ff026. |
Rebased onto main 252752c (bendlang#1506 removed js_marshal and marshal_tag_unknown; Nats cross as numbers), so the seam tag check and its test are gone.
11ff026 to
a9cc48b
Compare
Problem
A constructor's JS tag includes the namespace of the book that loaded it. A value exported by
a.bendhas tagCounter, but a module that imports the same type expectsa.Counter. So when one module's value goes into another, the match picks the wrong arm (on main,score(Left)gives 9 instead of 8, andflag(Off)gives 1 instead of 0).Fixes #1105.
Change
CID(...)for constructors.a.Counter{5n}. The show descriptor stores[tag, display]pairs.tests/io/constructor_interchange.bend/.js: two real modules, each using values built by the other (record, sum arms, enum arms). The test fails on main and prints0here.Breaking: a host that hard-codes a book-qualified tag string (
"a.Counter") no longer matches. Hosts that useCID()are unaffected. The repo has no such literals.Tags are unique only within a type. That is fine, because every JS dispatch on
.$is type-local.Rebased onto main 252752c. Since #1506 removed the JS seam check (
js_marshal), this PR no longer touches marshalling,marshal_tag_unknownis gone, and tests expect plain numbers (4/8/9). There is no unknown-tag check at the boundary, either on main or in this PR.Evidence
comp.ts 63,740 tok (cap 64k). Gates: repo 54/54, test 1635/1635, ping 58/58, perf 124/124, safe 0 false rejects. Interp, JS and C agree on cross-file cases (same ctor names in two files, generic holding the other file's type, three-level imports, effect building a value with
CID). CUDA and Windows were not run.