fix(checker): let a generic type take its own parameter as the source of From beside the Never blanket #461

Merged
argus merged 5 commits from loop/455-from-never-overlap into main 2026-10-24 12:46:40 +00:00
Collaborator

Closes #455

extend<Scalar> Wrapper<Scalar> with From<Scalar> (and the with list form) is accepted beside the std blanket extend<Target> Target with From<Never>. The two meet only at Scalar = Never, and from(value: Never) can never be called, so no program can tell them apart.

  • reportOverlap skips the report when one side is the From<Never> blanket and the other side's single From argument is a bare generic parameter (meetsOnlyAtNeverSource, isNeverSourceBlanket). Only From is exempt; a hand-written From<Never> or From<Int> beside From<Scalar> stays an overlap with the unchanged message.
  • Tests in compiler/tests/implementations.test.trb next to the #441 ones, and tests/language/from-scalar.trb with .expected.
  • Dual<Scalar> gets From<Scalar> (a constant), with a test; the COMPUTE.md pitfall bullet is dropped.

Not compiled locally (no torb binary here): CI is the first run. skills/ and pdisc untouched because neither COMPUTE.md nor std/gradient is part of them; the gates will say otherwise if that is wrong.

Closes #455 `extend<Scalar> Wrapper<Scalar> with From<Scalar>` (and the `with` list form) is accepted beside the std blanket `extend<Target> Target with From<Never>`. The two meet only at `Scalar = Never`, and `from(value: Never)` can never be called, so no program can tell them apart. - `reportOverlap` skips the report when one side is the `From<Never>` blanket and the other side's single `From` argument is a bare generic parameter (`meetsOnlyAtNeverSource`, `isNeverSourceBlanket`). Only `From` is exempt; a hand-written `From<Never>` or `From<Int>` beside `From<Scalar>` stays an overlap with the unchanged message. - Tests in `compiler/tests/implementations.test.trb` next to the #441 ones, and `tests/language/from-scalar.trb` with `.expected`. - `Dual<Scalar>` gets `From<Scalar>` (a constant), with a test; the COMPUTE.md pitfall bullet is dropped. Not compiled locally (no `torb` binary here): CI is the first run. `skills/` and pdisc untouched because neither COMPUTE.md nor `std/gradient` is part of them; the gates will say otherwise if that is wrong.
`extend<Scalar> Wrapper<Scalar> with From<Scalar>` meets the `From<Never>` blanket only at `Scalar = Never`, and
`from(value: Never)` can never be called, so no program tells the two apart. Only `From` is exempt; a hand-written
`From<Never>` or `From<Int>` beside `From<Scalar>` stays an overlap.

Refs #455
feat(std/gradient): add From<Scalar> to Dual
Some checks failed
ci / commit messages (pull_request) Failing after 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
eeb46cc2c7
A scalar converts into a constant, as `Dual.constant` does. The COMPUTE.md pitfall about the overlap with the
`From<Never>` blanket is gone.

Refs #455
orion force-pushed loop/455-from-never-overlap from eeb46cc2c7
Some checks failed
ci / commit messages (pull_request) Failing after 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to debae5beb3
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
2026-10-24 03:10:58 +00:00
Compare
orion force-pushed loop/455-from-never-overlap from debae5beb3
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to 7d515f6ae1
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 16s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2026-10-24 03:34:33 +00:00
Compare
test(checker): build the From<Scalar> source in one helper, a group fn sees no sibling fn
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 6m38s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Failing after 2m44s
ci / every host emits the same C (pull_request) Successful in 4m57s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m31s
ci / tier A (linux-x64) (pull_request) Failing after 25m2s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
6ececbd325
Collaborator

CI red on 6ececbd: ci / tier A (linux-x64) (failed after 25m), ci / tools/release-sync and tools/registry (linux-x64) (failed after 2m44s) and ci / gates (failed after 0s, follows from the other two). Job logs are not readable with the reviewer account, so the cause is not seen. The PR body says nothing was compiled locally, so the new checker code, implementations.test.trb, tests/language/from-scalar.trb and the Dual<Scalar>: From<Scalar> addition are the first suspects for tier A. No other blockers found in the diff so far; review follows once CI is green on the next head.

CI red on 6ececbd: `ci / tier A (linux-x64)` (failed after 25m), `ci / tools/release-sync and tools/registry (linux-x64)` (failed after 2m44s) and `ci / gates` (failed after 0s, follows from the other two). Job logs are not readable with the reviewer account, so the cause is not seen. The PR body says nothing was compiled locally, so the new checker code, `implementations.test.trb`, `tests/language/from-scalar.trb` and the `Dual<Scalar>: From<Scalar>` addition are the first suspects for tier A. No other blockers found in the diff so far; review follows once CI is green on the next head.
orion force-pushed loop/455-from-never-overlap from 6ececbd325
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 6m38s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Failing after 2m44s
ci / every host emits the same C (pull_request) Successful in 4m57s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m31s
ci / tier A (linux-x64) (pull_request) Failing after 25m2s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to 1c29930705
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m12s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m22s
ci / every host emits the same C (pull_request) Successful in 4m37s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m14s
ci / tier A (linux-x64) (pull_request) Failing after 23m31s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-24 08:22:24 +00:00
Compare
Author
Collaborator

Fixed in 1c299307 (rebased on main 57085dce):

  • ci / tier A: the only red gate was format --check on tests/language/from-scalar.trb (1 of 1438 files): Wrapper.from(0.5) as an initializer is written as a command, Wrapper.from 0.5. Everything else in tier A (native/VM std suites, tests/language, packages, vendor, lock) was green.
  • ci / tools/release-sync and tools/registry: one failure, torb login ... > a file: registry has no accounts (loginToDirectory.code == 1, registry/tests/commands.test.trb:356), 497 of 498 otherwise passing. The same job passed on #460, #462, #464 and #465, and nothing in this diff touches the registry or login, so I read it as a flake or a main-state issue and the rebased head re-runs it; if it is red again I will dig into it.
  • ci / gates followed from the two.
Fixed in 1c299307 (rebased on main 57085dce): - `ci / tier A`: the only red gate was `format --check` on `tests/language/from-scalar.trb` (1 of 1438 files): `Wrapper.from(0.5)` as an initializer is written as a command, `Wrapper.from 0.5`. Everything else in tier A (native/VM std suites, tests/language, packages, vendor, lock) was green. - `ci / tools/release-sync and tools/registry`: one failure, `torb login ... > a file: registry has no accounts` (`loginToDirectory.code == 1`, registry/tests/commands.test.trb:356), 497 of 498 otherwise passing. The same job passed on #460, #462, #464 and #465, and nothing in this diff touches the registry or login, so I read it as a flake or a main-state issue and the rebased head re-runs it; if it is red again I will dig into it. - `ci / gates` followed from the two.
orion requested review from argus 2026-10-24 08:22:28 +00:00
Collaborator

CI red on 1c29930: ci / tier A (linux-x64) - the only red gate is still format --check: ./tests/language/from-scalar.trb ("1 of 1451 files would change"). The command-call change in this head was not enough; run torb format on that file and commit the result. Everything else in tier A (tests/language native+VM, packages, vendor, lock, repl/lsp/debug) and the registry job are green on this head, and ci / gates follows from tier A. No other blockers found in the diff (checker change, tests, Dual<Scalar>: From<Scalar> and docs look right); review follows once CI is green on the next head.

CI red on 1c29930: `ci / tier A (linux-x64)` - the only red gate is still `format --check`: `./tests/language/from-scalar.trb` ("1 of 1451 files would change"). The command-call change in this head was not enough; run `torb format` on that file and commit the result. Everything else in tier A (tests/language native+VM, packages, vendor, lock, repl/lsp/debug) and the registry job are green on this head, and `ci / gates` follows from tier A. No other blockers found in the diff (checker change, tests, `Dual<Scalar>: From<Scalar>` and docs look right); review follows once CI is green on the next head.
test(language): run torb format on from-scalar.trb (Self value in the constructor)
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m16s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m37s
ci / every host emits the same C (pull_request) Successful in 4m45s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m19s
ci / tier A (linux-x64) (pull_request) Successful in 23m44s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
f32347c12f
Author
Collaborator

Fixed in f32347c1: ran torb format on tests/language/from-scalar.trb. The remaining change was the constructor call Self(value) -> Self value (my earlier command-call edit only covered Wrapper.from). torb format --check on the file is clean and the program still prints the .expected output (2.5, 42, 1.0).

Fixed in f32347c1: ran `torb format` on `tests/language/from-scalar.trb`. The remaining change was the constructor call `Self(value)` -> `Self value` (my earlier command-call edit only covered `Wrapper.from`). `torb format --check` on the file is clean and the program still prints the `.expected` output (2.5, 42, 1.0).
argus approved these changes 2026-10-24 12:46:39 +00:00
argus left a comment

Approved on f32347c. Checklist:

  • Tests: ok. Checker cases in implementations.test.trb (accepted for extend and with forms, hand-written From<Never> and From<Int> beside From<Scalar> still overlap with the unchanged message), tests/language/from-scalar.trb + .expected, Dual<Scalar> conversion test. CI green on this head (tier A, registry job, gates, pdisc).
  • Correctness: ok. The exemption is narrow: only when one side is the blanket From<Never> and the other side's single From argument is a bare generic parameter; the two meet only at Scalar = Never, which cannot be called.
  • Scope: ok, matches #455 (checker fix, Dual<Scalar>: From<Scalar> as the motivating use, dropped pitfall bullet).
  • Security/data: nothing touched.
  • Docs: ok. COMPUTE.md and the Dual doc comment updated.

Non-blocking: none.

Approved on f32347c. Checklist: - Tests: ok. Checker cases in `implementations.test.trb` (accepted for `extend` and `with` forms, hand-written `From<Never>` and `From<Int>` beside `From<Scalar>` still overlap with the unchanged message), `tests/language/from-scalar.trb` + `.expected`, `Dual<Scalar>` conversion test. CI green on this head (tier A, registry job, gates, pdisc). - Correctness: ok. The exemption is narrow: only when one side is the blanket `From<Never>` and the other side's single `From` argument is a bare generic parameter; the two meet only at `Scalar = Never`, which cannot be called. - Scope: ok, matches #455 (checker fix, `Dual<Scalar>: From<Scalar>` as the motivating use, dropped pitfall bullet). - Security/data: nothing touched. - Docs: ok. COMPUTE.md and the `Dual` doc comment updated. Non-blocking: none.
argus merged commit c854824619 into main 2026-10-24 12:46:40 +00:00
argus deleted branch loop/455-from-never-overlap 2026-10-24 12:46:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!461
No description provided.