constrain_go asserts the uniquely-keyed invariant it rests on - #74
Merged
Merged
Conversation
Contributor
Author
This was referenced Aug 11, 2026
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 00:09
ab34158 to
bc45f84
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 00:38
bc45f84 to
80a26c6
Compare
dpmills
marked this pull request as ready for review
August 12, 2026 03:20
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 20:08
80a26c6 to
fe1164a
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 20:41
fe1164a to
0fca3d5
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 22:30
0fca3d5 to
5bd1690
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 12, 2026 22:45
5bd1690 to
d03935f
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 13, 2026 05:39
d03935f to
9f2bccf
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 13, 2026 06:01
9f2bccf to
931536f
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
2 times, most recently
from
August 13, 2026 23:42
bfd485c to
c77a33a
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 14, 2026 19:49
c77a33a to
8126527
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 14, 2026 21:34
8126527 to
a655e5a
Compare
dpmills
force-pushed
the
dmills/dup-key-invariant
branch
from
August 14, 2026 21:41
a655e5a to
da6ef84
Compare
sortalongo
approved these changes
Aug 14, 2026
`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
force-pushed
the
dmills/dup-key-invariant
branch
from
August 14, 2026 23:11
da6ef84 to
a8d5fd7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
constrain_go's record and variant arms look a key up withiter().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 acceptst <: twhere find-first demandsInt <: Boolbetween the duplicates. Nothing inTypeenforces uniqueness; the builders merely happen not to violate it. This adds a debug-only check ahead of the short-circuit, sincet <: tis 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.