[code-reflection] RFR: Fix lowering type pattern
Mourad Abbay
mabbay at openjdk.org
Fri Dec 19 22:35:17 UTC 2025
On Fri, 19 Dec 2025 21:48:07 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> The lowering of TypePattern was performing unnecessary check by invoking inexistent method on ExactConversionSupport e.g. `isIntToIntExact.
>
> src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/java/JavaOp.java line 4937:
>
>> 4935: );
>> 4936: private static boolean isNarrowingPrimitiveConv(PrimitiveType s, PrimitiveType t) {
>> 4937: return narrowingOrder.get(t) <= narrowingOrder.get(s) && !s.equals(t); // need to be strict, to not consider int -> int as narrowing
>
> Can you replace with `narrowingOrder.get(t) < narrowingOrder.get(s) || !s.equals(t)`?
this way `byte -> int` will be considered narrowing
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/772#discussion_r2636484249
More information about the babylon-dev
mailing list