RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch [v2]
Vicente Romero
vromero at openjdk.org
Mon Oct 2 19:51:23 UTC 2023
On Mon, 2 Oct 2023 16:07:56 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> In the following example while the case pattern does not introduce binding variable, the guard does. `hasBindings` has been updated accordingly to accept any trees and check them if they contain a `visitBindingPattern`. Not only `JCPattern`'s.
>>
>>
>> static void test(Object o) {
>> switch (o) {
>> case R1() when o instanceof String s:
>> case R2() when o instanceof Integer i:
>> System.out.println("hello: " + i);
>> break;
>> default:
>> break;
>> }
>> }
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test with unnamed in guard
looks reasonable to me
-------------
Marked as reviewed by vromero (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15630#pullrequestreview-1653389057
More information about the compiler-dev
mailing list