RFR: 8310128: Switch with unnamed patterns erroneously non-exhaustive [v2]
Vicente Romero
vromero at openjdk.org
Thu Jun 15 16:39:30 UTC 2023
On Thu, 15 Jun 2023 16:34:22 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> When a record pattern has an unnamed pattern with the type of the corresponding record component being primitive, the switch is erroneously deemed as non-exhaustive. This PR addresses this issue by introducing the correct type for unnamed patterns during exhaustivity check.
>
> Aggelos Biboudis has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Address comment
> - Merge branch 'master' into fix-#8310128
> - 8310128: Switch with unnamed patterns erroneously non-exhaustive
just a nit comment
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 3504:
> 3502: return new RecordPattern(record.type, componentTypes, nestedDescriptions);
> 3503: } else if (pattern instanceof JCAnyPattern) {
> 3504: Type type = types.isSubtype(selectorType, syms.objectType) || selectorType.isPrimitive()
it seems to me like we can drop this condition and just use the selectorType
-------------
Marked as reviewed by vromero (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14488#pullrequestreview-1481999891
PR Review Comment: https://git.openjdk.org/jdk/pull/14488#discussion_r1231275796
More information about the compiler-dev
mailing list