yield can not be followed by an underscore ?

Olexandr Rotan rotanolexandr842 at gmail.com
Tue Jun 25 10:11:39 UTC 2024


Hello Remi. Have you created issue related to this bug? It seems like it
has been around for quite a while based on what I saw in block parsing code
of javac

On Tue, Jun 25, 2024, 10:05 Remi Forax <forax at univ-mlv.fr> wrote:

> Hello,
> javac is not able to parse "yield _ -> ...".
>
> Here is a reproducer.
>
> public class SwitchYieldAndUnderscore {
>   public static void main(String[] args) {
>     Consumer<String> value = switch (args[0]) {
>       case "foo" -> {
>         yield _ -> {};
>       }
>       default -> throw new AssertionError();
>     };
>   }
> }
>
> regards,
> Rémi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240625/7863a9a4/attachment-0001.htm>


More information about the amber-dev mailing list