Skip to content

Fix open world public types#8792

Open
tlively wants to merge 1 commit into
mainfrom
open-world-public-subtypes
Open

Fix open world public types#8792
tlively wants to merge 1 commit into
mainfrom
open-world-public-subtypes

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented May 30, 2026

In an open world, we have to assume that the environment may cast any public type down to any of its subtypes and expect that to work before and after optimization. We therefore must make public visibility propagate to subtypes.

But we can be more precise than this, because some types are public not because they can cross the module boundary, but rather because they are reachable in the definition of some other type that can cross the module boundary. Subtypes of such public types do not need to be public, since their values will never cross the module boundary. In addition, we do not need to make public the subtypes of types that are exposed only as exact references.

Allow Unsubtyping to operate in open-world mode and use it in tests that the visibility propagation works correctly.

Fixes #8718.

In an open world, we have to assume that the environment may cast any public type down to any of its subtypes and expect that to work before and after optimization. We therefore must make public visibility propagate to subtypes.

But we can be more precise than this, because some types are public not because they can cross the module boundary, but rather because they are reachable in the definition of some other type that can cross the module boundary. Subtypes of such public types do not need to be public, since their values will never cross the module boundary. In addition, we do not need to make public the subtypes of types that are exposed only as exact references.

Allow Unsubtyping to operate in open-world mode and use it in tests that the visibility propagation works correctly.

Fixes #8718.
@tlively tlively requested a review from a team as a code owner May 30, 2026 01:29
@tlively tlively requested review from kripken and stevenfontanella and removed request for a team May 30, 2026 01:29
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.

Open world --gufa bug

1 participant