aboutsummaryrefslogtreecommitdiff
path: root/test/pretty/resource/after/RecordPattern20.java
blob: 365b139fb1be5290751123941c0b14f49c8eb2d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
record Point(int x, int y) {
}
record Rectangle(Point upperLeft, Point lowerRight) {
}

public class RecordPattern20 {
	void recordPattern(Object o) {
		if (o instanceof Point(int x, int y)) {
		}
		if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) {
		}
	}

	void forEachSimple(Point[] pointArray) {
		for (Point(var x, var y) : pointArray) {
		}
	}
	void forEachNested(Rectangle[] rectangleArray) {
		for (Rectangle(Point(var x1, var y1), Point p) : rectangleArray) {
		}
	}
}