Repository navigation
MAIN-R: the if-join judges branches against EACH OTHER, never against the declared return context — a well-typed coproduct construction is refused, and the verdict depends on corpus scope #10294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b574ca8
Two rows for a refusal decided by which unrelated modules are in the …
60908a8
Commit the specimen the row cites, and say the gate cannot go red
949f55a
Merge remote-tracking branch 'origin/main' into session/cool-koi-858
7271dd7
Correct the row's mechanism: the wall is alive, its candidate list is…
bcc0102
Merge remote-tracking branch 'origin/main' into session/cool-koi-858
4d079a2
Merge remote-tracking branch 'origin/main' into session/cool-koi-858
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| module fixtures.if_join_pool_binding.closure_with_collision | ||
|
|
||
| // THE RED ARM. Entry here puts BOTH modules in one closure and the compile REFUSES at | ||
| // `declaring_module`'s if-expression: | ||
| // | ||
| // if branches resolve to incompatible types: | ||
| // Coproduct(PoolSpecimenShape) vs Product(PoolSpecimenSquare) | ||
| // | ||
| // The refusal names `declaring_module`, which neither declares nor imports the competing type -- | ||
| // an innocent site. Note this module need not import the colliding SPELLING at all; importing any | ||
| // other member of `colliding_module` is enough, because pool MEMBERSHIP is the variable. | ||
| import fixtures.if_join_pool_binding.declaring_module { PoolSpecimenShape, pick_shape } | ||
| import fixtures.if_join_pool_binding.colliding_module { PoolSpecimenSquare } | ||
|
|
||
| fn refusing_use(c: Bool) -> PoolSpecimenShape { | ||
| pick_shape(c: c) | ||
| } | ||
|
|
||
| fn foreign_square() -> PoolSpecimenSquare { | ||
| PoolSpecimenSquare { s: 3 } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
fixtures/if_join_pool_binding/closure_without_collision.dag
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| module fixtures.if_join_pool_binding.closure_without_collision | ||
|
|
||
| // THE POSITIVE CONTROL, AND IT IS WHAT MAKES THE RED ARM DISCRIMINATING RATHER THAN MERELY RED. | ||
| // Entry here reaches the SAME BYTES of `declaring_module` with `colliding_module` absent from the | ||
| // closure, and the compile reports 0 blocking errors. Without this arm a reader could not tell a | ||
| // refusal caused by pool membership from a refusal caused by the specimen being ill-typed. | ||
| import fixtures.if_join_pool_binding.declaring_module { PoolSpecimenShape, pick_shape } | ||
|
|
||
| fn accepting_use(c: Bool) -> PoolSpecimenShape { | ||
| pick_shape(c: c) | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| module fixtures.if_join_pool_binding.colliding_module | ||
|
|
||
| // THE PERTURBATION, AND IT IS THE ONLY DIFFERENCE BETWEEN THE TWO CLOSURES. A standalone product | ||
| // spelled the same as an ARM of another module's coproduct. This module is not on | ||
| // `declaring_module`'s ancestor chain, does not import it, and is not imported by it. | ||
| // | ||
| // namespace-resolution-design.md section 13 (operator-ratified 2026-07-21, default | ||
| // NamespaceOnlyY) decides an off-chain candidate as ZERO-ON-CHAIN and therefore UnresolvedType. | ||
| // The type and variant-arm channel does not honour that: it binds here instead. | ||
| type PoolSpecimenSquare { s: Int } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| module fixtures.if_join_pool_binding.declaring_module | ||
|
|
||
| // THE SUBJECT. This module declares BOTH arms of its own coproduct and returns one arm per | ||
| // if-branch, which is a well-typed inhabitant of the declared return in every closure. Nothing | ||
| // here refers to any other module, and the file is BYTE-IDENTICAL across the two closures that | ||
| // disagree about it -- that invariance is the whole instrument. | ||
| // | ||
| // A coproduct ARM is pool-visible corpus-wide while NOT being a local binding under its own | ||
| // spelling, so `PoolSpecimenSquare` below misses local lookup and lands in the pool. When | ||
| // `colliding_module` is present it binds THERE, the arm stops widening to its owner coproduct, | ||
| // and the if-join then compares a widened arm against a bare product. Inside this module not even | ||
| // the unlisted-import advisory fires, because the spelling is in `source_visible_names` here -- | ||
| // which is why the class is silent at the site that causes it. | ||
| type PoolSpecimenShape | ||
| = PoolSpecimenCircle { r: Int } | ||
| | PoolSpecimenSquare { s: Int } | ||
|
|
||
| fn pick_shape(c: Bool) -> PoolSpecimenShape { | ||
| if c { PoolSpecimenCircle { r: 1 } } else { PoolSpecimenSquare { s: 2 } } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixture claims to prove that merely adding
colliding_moduleto the pool is sufficient and that the entry need not import the colliding spelling, but it imports and usesPoolSpecimenSquaredirectly, and that is the module's only declaration. Consequently the committed discriminator never exercises the stated “import any other member” case; add a differently named exported sentinel and use that to pull the module into the closure so the fixture actually isolates pool membership from importing the colliding declaration.Useful? React with 👍 / 👎.