[code-reflection] RFR: Test Switch Expression lowering when case is constant [v3]

Mourad Abbay mabbay at openjdk.org
Fri Jul 26 15:44:50 UTC 2024


On Thu, 25 Jul 2024 09:44:47 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Write code models without location info
>>  - Fix a typo
>>  - Add compiler tests of Switch Expression.
>
> test/langtools/tools/javac/reflect/SwitchExpressionTest2.java line 10:
> 
>> 8:  * @run main CodeReflectionTester SwitchExpressionTest2
>> 9:  */
>> 10: public class SwitchExpressionTest2 {
> 
> I'm a bit confused: the core of the fix is to add a conversion to the selector type is the case label is constant, right? But I don't see any `conv` node anywhere in the test (except for a single one where an explicit cast is used). Is the new code exercised in this test?

The core of the changes is to test switch expression when case is constant, in the process we found that we miss conversion of the constant to the the type of the selector expression, we added that. I agree that we should add tests that focus more on conversion.

-------------

PR Review Comment: https://git.openjdk.org/babylon/pull/169#discussion_r1693272590


More information about the babylon-dev mailing list