Repository navigation
[PrincipalType] Finish and fix join and compose edge cases - #9301
Conversation
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.
There was a problem hiding this comment.
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.
|
Here is the plan:
|
|
@stevenfontanella, maybe you want to review this :) |
| value = other; | ||
| return true; | ||
| } | ||
| if (std::get_if<Index>(&value) || std::get_if<Index>(&other)) { |
There was a problem hiding this comment.
nit: use std::holds_alternative since we're not using the pointer
There was a problem hiding this comment.
I guess a lot of other code here uses get_if this way. Fine to keep as-is
There was a problem hiding this comment.
Yeah, there was a weird historical thing where we could use std::get_if but not most other variant functions because ancient mac system libraries were missing implementations for them. So we have way more uses of std::get_if than you would otherwise expect. This is possibly something we could clean up at some point.
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.