Repository navigation
Unboxing crash tests; move unboxing helpers to TypesUtils - #79
Merged
msridhar merged 2 commits intoOct 8, 2026
Merged
Conversation
…pe-variable operands
Erase only type variables and intersection types, and erase at most once per query.
Owner
|
@mernst I've invited you as a collaborator on this repo, so you can just push directly to the branch if you like |
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.
This PR is for typetools#8329.
Adds two regression tests that crash on this branch (and on
master):framework/tests/all-systems/TypeVarPrimitives.java: compound boolean assignment (x &= t,x |= t,x ^= t) whereT extends Boolean.CFGTranslationPhaseOne.visitCompoundAssignmentthrows "Both arguments to logical operation must be numeric or boolean".framework/tests/all-systems/TypeVarArrayDimension.java:new int[t]whereT extends Integer.ValueTreeAnnotator.handleDimensionsthrows "Unexpected null argument: compareByName(null, @BottomVal)". This test is in its own file so that the crash above does not mask it.These tests fail until those two crashes are fixed.
Moves the unboxing helpers out of
CFGTranslationPhaseOneintoTypesUtils(boxedPrimitiveForUnboxing,isUnboxable,unboxedTypeOrSelf), and uses them inTreeBuilder.buildPrimValueMethodAccess,TypesUtils.canBeNarrowingPrimitiveConversion,narrowAndBox,conversionRequiresNarrowing, andconditionalExprPromotion.Removes duplicated
isUnboxable(t) ? unboxedTypeOf(t) : tlogic, and renamesTreeInfo.isBoxedand local variables namedisBoxedPrimitive/isRightBoxedto reflect that they are also true for type variables.Erases a type only if it is a type variable or intersection type, and at most once per query, rather than on every assignment and argument conversion.