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

Binding patterns with inferred type have erroneous node in the AST

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 23
    • tools
    • None
    • b26

      Consider code like:
      ---
      public class Test {
          record R(int i) {}
          int test(Object o) {
              return switch (o) {
                  case R(var v) -> 0;
                  default -> 0;
              };
          }
      }
      ---

      javac compiles it without problems, but the type of "var v" in the AST is an Erroneous tree node, not a PrimitiveTypeTree, as could be expected.

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

              Created:
              Updated:
              Resolved: