<div dir="ltr">Hi David! I`ve looked into compiler sources a bit, and this error is reported in Attr class when attributing switch expressions.Basically, compiler does not know which type to assign to switch expression, as there is not case return types, you could think of it as switch expression of "void" type, so it cant be nor assigned nor returned, so compiler treats it like an error. Its not a pattern matching thing, just general switch behaviour</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 2, 2024 at 5:58 AM David Alayachew <<a href="mailto:davidalayachew@gmail.com">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:monospace" class="gmail_default">Hello Amber Dev,<br><br>Apologies for not having tested many features lately for this project (and others). Juggling insane workloads at work.<br><br>Today is the first day I had a moment to breath in months, so I tried out some stuff, and I was confused.<br><br>I have a Switch Expression where the input is a Sealed Type. For this particular Switch Expression, almost every branch of it is going to throw an Exception of some sort. I added all of the failure cases to the Switch Expression, pressed compile, and it threw the following compilation error.<br><br>> InputFormat.java:161: error: switch expression does not have any result expressions<br>>                   switch (next)<br><br>Again, there is going to be one result expression, so I am not blocked by this compilation error.<br><br>I was just really surprised to see an intentional road block there.<br><br>Why is there a compilation error if all of the arms of a Switch Expression are just throwing Exceptions?</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">Thank you for your time and help!</div><div style="font-family:monospace" class="gmail_default">David Alayachew<br></div></div>
</blockquote></div>