<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Hello Rémi, </div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<a href="https://github.com/openjdk/jdk/pull/15630/files#diff-06a9cd077d1cc0d23cc8810100b1ac02ac2a19904581f809bc79b49582971f69R35-R42" id="LPlnk681242">https://github.com/openjdk/jdk/pull/15630/files#diff-06a9cd077d1cc0d23cc8810100b1ac02ac2a19904581f809bc79b49582971f69R35-R42</a><br>
</div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
I added that pos test. I think this should compile ok (already did). Do I understand correctly?</div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
Angelos.</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Remi Forax <forax@univ-mlv.fr><br>
<b>Sent:</b> 02 October 2023 17:04<br>
<b>To:</b> Aggelos Biboudis <abimpoudis@openjdk.org><br>
<b>Cc:</b> compiler-dev <compiler-dev@openjdk.org><br>
<b>Subject:</b> Re: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">----- Original Message -----<br>
> From: "Aggelos Biboudis" <abimpoudis@openjdk.org><br>
> To: "compiler-dev" <compiler-dev@openjdk.org><br>
> Sent: Monday, October 2, 2023 12:19:40 PM<br>
> Subject: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch<br>
<br>
> In the following example while the case pattern does not introduce binding<br>
> variable, the guard does. `hasBindings` has been updated accordingly to accept<br>
> any trees and check them if they contain a `visitBindingPattern`. Not only<br>
> `JCPattern`'s.<br>
> <br>
> <br>
> static void test(Object o) {<br>
>    switch (o) {<br>
>      case R1() when o instanceof String s:<br>
>      case R2() when o instanceof Integer i:<br>
>        System.out.println("hello: " + i);<br>
>        break;<br>
>      default:<br>
>        break;<br>
>    }<br>
>  }<br>
<br>
I think, i've fully understand the issue, what about<br>
<br>
static void test(Object o) {<br>
   switch (o) {<br>
     case R1() when o instanceof String _:<br>
     case R2() when o instanceof Integer _:<br>
       System.out.println("hello: " + i);<br>
       break;<br>
     default:<br>
       break;<br>
   }<br>
 }<br>
<br>
regards,<br>
Rémi<br>
<br>
> <br>
> -------------<br>
> <br>
> Commit messages:<br>
> - 8314578: Non-verifiable code is emitted when two guards declare pattern<br>
> variables in colon-switch<br>
> <br>
> Changes: <a href="https://git.openjdk.org/jdk/pull/15630/files">https://git.openjdk.org/jdk/pull/15630/files</a><br>
> Webrev: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=15630&range=00">https://webrevs.openjdk.org/?repo=jdk&pr=15630&range=00</a><br>
>  Issue: <a href="https://bugs.openjdk.org/browse/JDK-8314578">https://bugs.openjdk.org/browse/JDK-8314578</a><br>
>  Stats: 41 lines in 3 files changed: 38 ins; 0 del; 3 mod<br>
>  Patch: <a href="https://git.openjdk.org/jdk/pull/15630.diff">https://git.openjdk.org/jdk/pull/15630.diff</a><br>
>  Fetch: git fetch <a href="https://git.openjdk.org/jdk.git">https://git.openjdk.org/jdk.git</a> pull/15630/head:pull/15630<br>
> <br>
> PR: <a href="https://git.openjdk.org/jdk/pull/15630">https://git.openjdk.org/jdk/pull/15630</a><br>
</div>
</span></font></div>
</body>
</html>