RFR: 8254286: Wrong inference in switch expression with "null" arm

Jan Lahoda jlahoda at openjdk.java.net
Fri Oct 9 17:17:16 UTC 2020

Basically, for code like:

        var t1 = switch (s) {
            case 1 -> i1;
            case 2 -> null;
            default -> i2;

Attr.condType is currently passing <type-of-i1>, BOT, <type-of-i2> to Types.lub. But Types.lub needs the list without
BOT, so filtering BOT(s) out of the list.


Commit messages:
 - Improving tests.
 - 8254286: Wrong inference in switch expression with "null" arm

Changes: https://git.openjdk.java.net/jdk/pull/583/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=583&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254286
  Stats: 58 lines in 3 files changed: 55 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/583.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/583/head:pull/583

PR: https://git.openjdk.java.net/jdk/pull/583

More information about the compiler-dev mailing list