Skip to content

[PrincipalType] Finish and fix join and compose edge cases - #9301

Open
tlively wants to merge 1 commit into
mainfrom
principal-types-fixes
Open

tlively wants to merge 1 commit into
mainfrom
principal-types-fixes

Conversation

@tlively

@tlively tlively commented Oct 23, 2026

Copy link
Copy Markdown
Member

Default-initialize PrincipalType::unreachable so the Signature constructor does not leave it uninitialized, and grow AssignmentClasses sets up to max(i, *other) before looking up classes.getRoot(*other).

Implement the remaining join cases for VarNullability, VarExactness, VarSharedness, VarHeapType (including mixed abstract/defined heap types and defined heap types with basic LUBs), and VarRef/Type, as well as erasing leading unreachable elements at the bottom of results in PrincipalType::compose.

Default-initialize PrincipalType::unreachable so the Signature constructor does not leave it uninitialized, and grow AssignmentClasses sets up to max(i, *other) before looking up classes.getRoot(*other).

Implement the remaining join cases for VarNullability, VarExactness, VarSharedness, VarHeapType (including mixed abstract/defined heap types and defined heap types with basic LUBs), and VarRef/Type, as well as erasing leading unreachable elements at the bottom of results in PrincipalType::compose.
@tlively
tlively requested a review from a team as a code owner October 23, 2026 21:31
@tlively
tlively requested review from aheejin and kripken and removed request for a team October 23, 2026 21:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements support for joining abstract and defined heap types, refactors nullability, exactness, and sharedness join operations, and improves the handling of unreachable types during principal type composition. It also adds comprehensive unit tests to verify these changes. As there are no review comments, I have no feedback to provide.

@tlively

tlively commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Here is the plan:

  1. Finish implementing composition of principal types (this PR)
  2. Fix bugs in child-typer.h and use it as part of PrincipalType::fromExpression
    1. At this point, progress on Outlining will be unblocked
  3. Add a ConcreteChildTyper utility that computes the upper bounds on the types of children from an upper bound on the type of the parent.
    1. For efficiency, this will not actually use PrincipalType because the forward principal types property lets us do this kind of analysis without having to worry about any kind of polymorphism.
    2. There will be a test-only pass that checks that ConcreteChildTyper and an analysis using PrincipalType give the same results. We will run this in the fuzzer.
  4. Use ConcreteChildTyper in TypeGeneralizing, StripRefiningCasts, etc.

This branch has not been deployed

No deployments
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.

1 participant