<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Tesla Ice Zhang" <ice1000kotlin@foxmail.com><br><b>To: </b>"amber-dev" <amber-dev@openjdk.org><br><b>Sent: </b>Tuesday, September 27, 2022 1:18:24 AM<br><b>Subject: </b>Mixing record patterns and literal/enum patterns? <br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div>Hi, </div><br><div>Is it currently possible/planned to have mixed literal or enum patterns? E.g., </div><br><div>enum E { a, b }</div><div>record R(E e) {}</div><br><div>And use the pattern</div><br><div>case R(E.a) something something</div></blockquote><div><br></div><div>It's what we call a constant pattern. The syntax is still in flux.</div><div><br data-mce-bogus="1"></div><div>Given that a switch on an enum does not require the class of the enum constant to be specified, another possible syntax may be case R(a),</div><div>or we may want a quoting mechanism for the constants, case R('E.a) or case R(== E.a).</div><div><br data-mce-bogus="1"></div><div>Anyway, you can already write case R(E e) when e == E.a.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br><div><hr style="margin: 0 0 10px 0;border: 0;border-bottom:1px solid #E6E8EB;height:0;line-height:0;font-size:0;padding: 20px 0 0 0;width: 50px;"><div class="xm_write_text_sign">Regards,<br>Tesla</div></div></blockquote><div><br></div><div>regards,<br data-mce-bogus="1"></div><div>RĂ©mi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div></div></div></body></html>