From ad35c80843c88e8717f62770a8b0531de8615947 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Fri, 26 Aug 2022 00:53:47 +0200 Subject: [jdk19] Add support for record pattern --- test/pretty/resource/after/RecordPattern.java | 15 +++++++++++++++ test/pretty/resource/before/RecordPattern.java | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/pretty/resource/after/RecordPattern.java create mode 100644 test/pretty/resource/before/RecordPattern.java (limited to 'test/pretty') diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern.java new file mode 100644 index 00000000..ad9fae0b --- /dev/null +++ b/test/pretty/resource/after/RecordPattern.java @@ -0,0 +1,15 @@ +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Point(int x, int y) p) { + } + if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) { + } + } +} \ No newline at end of file diff --git a/test/pretty/resource/before/RecordPattern.java b/test/pretty/resource/before/RecordPattern.java new file mode 100644 index 00000000..93c07965 --- /dev/null +++ b/test/pretty/resource/before/RecordPattern.java @@ -0,0 +1,16 @@ +// version 19: +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Point(int x, int y) p) { + } + if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) { + } + } +} \ No newline at end of file -- cgit