[jdk19] RFR: 8289196: Patttern domination not working property for record patterns

Vicente Romero vromero at openjdk.org
Fri Jul 1 16:30:54 UTC 2022


On Tue, 28 Jun 2022 13:11:25 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> When checking that a pattern in a switch case is not dominated by a preceding pattern, handling for record pattern is mostly missing. This patch is attempting to fix that, and as it requires a bit more code, it moves the check into `Check`.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 4423:

> 4421:             }
> 4422:             if (existingPatternType.isPrimitive()) {
> 4423:                 if (!types.isSameType(existingPatternType, currentPatternType)) {

note: shouldn't we return true if both are primitive and they are the same type? I mean this method seems to returns the right thing in that case but it is doing some extra analysis that doesn't seem to be necessary IMO

-------------

PR: https://git.openjdk.org/jdk19/pull/84


More information about the compiler-dev mailing list