On Wed, 11 Oct 2023 15:43:19 GMT, Aggelos Biboudis <abimpou...@openjdk.org> wrote:
>> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/jep443-20231010/specs/instanceof-jls.html > > Aggelos Biboudis has updated the pull request incrementally with one > additional commit since the last revision: > > Fix duplicate method name and add a new test in > PrimitivePatternsSwitchErrors src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5055: > 5053: return (source.isPrimitive() && target.isPrimitive()) && > 5054: ((source.hasTag(BYTE) && !target.hasTag(CHAR) || > 5055: (source.hasTag(SHORT) && (target.hasTag(INT) || > target.hasTag(LONG) || target.hasTag(FLOAT) || target.hasTag(DOUBLE)))|| this code can also be simplified as suggested for similar code in SwitchBootstraps, actually here you have access to the infra already in TypeTag and can leverage it. src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 2910: > 2908: } > 2909: > 2910: public void visitTypeTest(JCInstanceOf tree) { would it make sense to document how the generated code should look like? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1357407958 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1357439742