Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8289196

Pattern domination not working properly for record patterns

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2
    • Resolution: Fixed
    • 19
    • 19
    • tools
    • b31
    • Verified

    Backports

      Description

        Consider this code:
        ---
        class RecordPatternDomination {
            void test(Object o) {
                switch (o) {
                    case R(int i) -> {}
                    case R(int i) -> {} //error here - the pattern is dominated
                    default -> {}
                }
            }
            record R(int i) {}
        }
        ---

        This should produce an error, because the second `R(int i)` pattern dominates the first one (JLS 14.30.3), but it does no produce it.

        Attachments

          Issue Links

            Activity

              People

                jlahoda Jan Lahoda
                jlahoda Jan Lahoda
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: