compiler: update typecore; tests: add VariantCoercionConstructUsed; d…
…ocs: update AGENTS; docstring_tests: update DocTest outputs
rescript
npm i https://pkg.pr.new/rescript-lang/rescript@7839
@rescript/darwin-arm64
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7839
@rescript/darwin-x64
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7839
@rescript/linux-arm64
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7839
@rescript/linux-x64
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7839
@rescript/runtime
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7839
@rescript/win32-x64
npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7839
commit: 6012c86
The example is wrong, it does not trigger the warning. Update the example to be:
// Repro for incorrect "constructor ... is never used" warning with coercions
// This should compile cleanly without warnings when coercing from a -> b.
type a = A | B
module DoNotWarn: {
let log: a => unit
} = {
type b =
| ...a
| C
let log = (x: a) => Js.log((x :> b))
}
let _ = DoNotWarn.log(A)
The example is wrong, it does not trigger the warning. Update the example to be:
// Repro for incorrect "constructor ... is never used" warning with coercions // This should compile cleanly without warnings when coercing from a -> b. type a = A | B module DoNotWarn: { let log: a => unit } = { type b = | ...a | C let log = (x: a) => Js.log((x :> b)) } let _ = DoNotWarn.log(A)
Took it from the chat. Let me close this and start again.
@jfrolich can you verify whether the test added to this branch gives the expected warning (warns about 1 constructor)?
Yes it should warn about C, but not about the other constructors!
Great! So @cristianoc it seems the implementation is correct. I think we can move ahead with cleanup.
Great! So @cristianoc it seems the implementation is correct. I think we can move ahead with cleanup.
Any more cases to test? With interfaces? If not, then cleanup.
Great! So @cristianoc it seems the implementation is correct. I think we can move ahead with cleanup.
Any more cases to test? With interfaces? If not, then cleanup.
It only triggers for things with interfaces. I guess for completeness sake we could add an example where the new type is just a spread of the other type, with no new constructors added (but still using coercion), to see that all constructors are marked as being used.
@zth take another look
@cristianoc added a few comments. The changelog text is quite convoluted as well, but I'm not sure I care too much about that.
@zth would you take over the PR? Getting diminishing returns going back and forth for little things later, we can "create an environment for this repo."
Let's close it if so, and someone can use the insights here as the base for fixing this later on.
Let's close it if so, and someone can use the insights here as the base for fixing this later on.
hold on, our assistant is thinking
@codex try to build the compiler and run tests now, report if it worked
Summary
- Build failed:
maketerminated while compiling the Rust-based rewatch component, preventing the subsequentdune buildstep from running - Build environment missing
dune; direct invocation showsbash: command not found: dune - Test suite did not run:
make testsimilarly terminated during the rewatch build phase
Testing
- ❌
make(terminated during rewatch build; could not reach compiler build step) - ❌
dune build(dune not installed) - ❌
make test(terminated during rewatch build; tests not executed)
@codex try again to build the compiler now that internet access is enabled in the sandbox
Summary
- Bootstrapped and installed Dune 3.17 to satisfy the repository’s required Dune language version.
makestill failed because opam packages such asflow_parser,yojson,ounit2,cmarkit, and the toolcppowere missing from the environmentmake testlikewise failed for the same missing dependencies, so the test suite could not run
Testing
- ❌
make - ❌
make test
Notes
- Access to opam repositories is blocked (HTTP 403), preventing installation of the required OCaml packages and tools.
CODEX: I reviewed the latest change to mark shared constructors as used after variant→variant coercions. Verified there’s no redundancy in typecore and no leftover duplication; the extra exposed-decl marking was removed and inclusion handles propagation. Tests cover no spurious warning and still warn for target-only constructors. CHANGELOG updated.
@zth Anything else to address here? If not, we’re good to merge. Thanks!