Skip to content

constrain_go asserts the uniquely-keyed invariant it rests on - #74

Merged
dpmills merged 1 commit into
dmills/subtype-annotationsfrom
dmills/dup-key-invariant
Aug 17, 2026
Merged

constrain_go asserts the uniquely-keyed invariant it rests on#74
dpmills merged 1 commit into
dmills/subtype-annotationsfrom
dmills/dup-key-invariant

Conversation

@dpmills

@dpmills dpmills commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

constrain_go's record and variant arms look a key up with iter().find(..), so on a duplicate-keyed product the verdict depends on which copy comes first — and disagrees with the function's own trivial-equality short-circuit, which accepts t <: t where find-first demands Int <: Bool between the duplicates. Nothing in Type enforces uniqueness; the builders merely happen not to violate it. This adds a debug-only check ahead of the short-circuit, since t <: t is the case the two answer differently. No program in the suite trips it, so a builder that starts violating the invariant now fails loudly instead of silently making subtyping depend on incidental structure.

@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from ab34158 to bc45f84 Compare August 12, 2026 00:09
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from bc45f84 to 80a26c6 Compare August 12, 2026 00:38
@dpmills
dpmills marked this pull request as ready for review August 12, 2026 03:20
@dpmills
dpmills requested a review from a team as a code owner August 12, 2026 03:20
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from 80a26c6 to fe1164a Compare August 12, 2026 20:08
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from fe1164a to 0fca3d5 Compare August 12, 2026 20:41
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from 0fca3d5 to 5bd1690 Compare August 12, 2026 22:30
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from 5bd1690 to d03935f Compare August 12, 2026 22:45
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from d03935f to 9f2bccf Compare August 13, 2026 05:39
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from 9f2bccf to 931536f Compare August 13, 2026 06:01
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch 2 times, most recently from bfd485c to c77a33a Compare August 13, 2026 23:42
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from c77a33a to 8126527 Compare August 14, 2026 19:49
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from 8126527 to a655e5a Compare August 14, 2026 21:34
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from a655e5a to da6ef84 Compare August 14, 2026 21:41
`constrain_go`'s record and variant arms look a key up with `iter().find(..)`, so on a duplicate-keyed product the verdict depends on which copy comes first — and disagrees with the function's own trivial-equality short-circuit, which accepts `t <: t` where find-first demands `Int <: Bool` between the duplicates. Nothing in `Type` enforces uniqueness; the builders merely happen not to violate it. This adds a debug-only check ahead of the short-circuit, since `t <: t` is the case the two answer differently. No program in the suite trips it, so a builder that starts violating the invariant now fails loudly instead of silently making subtyping depend on incidental structure.
@dpmills
dpmills force-pushed the dmills/dup-key-invariant branch from da6ef84 to a8d5fd7 Compare August 14, 2026 23:11
@dpmills
dpmills merged commit 9055178 into main Aug 17, 2026
1 check passed
@dpmills
dpmills deleted the dmills/dup-key-invariant branch August 17, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants