Integrated: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

Aggelos Biboudis abimpoudis at openjdk.org
Tue Oct 17 12:55:11 UTC 2023


On Fri, 8 Sep 2023 09:32:50 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;
>     }
>   }

This pull request has now been integrated.

Changeset: 15588e08
Author:    Aggelos Biboudis <abimpoudis at openjdk.org>
Committer: Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/15588e08ed455eac356aa923c35503beaecd5b6d
Stats:     52 lines in 3 files changed: 49 ins; 0 del; 3 mod

8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

Reviewed-by: vromero

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

PR: https://git.openjdk.org/jdk/pull/15630


More information about the compiler-dev mailing list