On Wed, 5 Nov 2025 15:14:49 GMT, Jan Lahoda <[email protected]> wrote:
>> Having two assignments should not be a blocker for `->`, no? It ought to be
>> enough to use `{}`:
>>
>> switch (((OperatorSymbol)operator).opcode) {
>> case ByteCodes.ishl, ByteCodes.ishr, ByteCodes.iushr,
>> ByteCodes.ishll, ByteCodes.ishrl, ByteCodes.iushrl -> {
>> targetType = syms.intType;
>> maximumShift = 32;
>> }
>> case ByteCodes.lshl, ByteCodes.lshr, ByteCodes.lushr,
>> ByteCodes.lshll, ByteCodes.lshrl, ByteCodes.lushrl -> {
>> targetType = syms.longType;
>> maximumShift = 64;
>> }
>> default -> {
>> return;
>> }
>> }
>>
>>
>> I am not strictly insisting on using `->`, but it generally makes things
>> simpler as there's guaranteed no fallthrough.
>
> The `->` can be used, even when having general statements/multiple
> assignments/etc. - just wrap the code with `{}`, no?
>
>
> switch (((OperatorSymbol)operator).opcode) {
> case ByteCodes.ishl, ByteCodes.ishr, ByteCodes.iushr,
> ByteCodes.ishll, ByteCodes.ishrl, ByteCodes.iushrl -> {
> targetType = syms.intType;
> maximumShift = 32;
> }
> case ByteCodes.lshl, ByteCodes.lshr, ByteCodes.lushr,
> ByteCodes.lshll, ByteCodes.lshrl, ByteCodes.lushrl -> {
> targetType = syms.longType;
> maximumShift = 64;
> }
> default -> {
> return;
> }
> }
>
>
> I am not strictly insisting on using `->` but it is typically easier to
> reason about switches that are guaranteed to not have fallthrough.
> Having two assignments should not be a blocker for `->`, no? It ought to be
> enough to use `{}`:
Duh - of course you're right. Fixed in 89fe2fb1f93.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27102#discussion_r2495043399