Skip to content

Commit cc68169

Browse files
committed
Update test expectations re: record-pattern type accesses
1 parent b1cea1d commit cc68169

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

java/ql/consistency-queries/children.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ predicate gapInChildren(Element e, int i) {
5050
// Pattern case statements legitimately have a TypeAccess (-2) and a pattern (0) but not a rule (-1)
5151
not (i = -1 and e instanceof PatternCase and not e.(PatternCase).isRule()) and
5252
// Instanceof with a record pattern is not expected to have a type access in position 1
53-
not (i = 1 and e.(InstanceOfExpr).getPattern() instanceof RecordPatternExpr)
53+
not (i = 1 and e.(InstanceOfExpr).getPattern() instanceof RecordPatternExpr) and
54+
// RecordPatternExpr extracts type-accesses only for its LocalVariableDeclExpr children
55+
not (i < 0 and e instanceof RecordPatternExpr)
5456
}
5557

5658
predicate lateFirstChild(Element e, int i) {

java/ql/test/library-tests/pattern-instanceof/PrintAst.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ Test.java:
4242
# 14| 0: [InstanceOfExpr] ...instanceof...
4343
# 14| 0: [VarAccess] o
4444
# 14| 2: [RecordPatternExpr] Outer(...)
45+
# 14| -2: [TypeAccess] String
4546
# 14| 0: [RecordPatternExpr] Inner(...)
47+
# 14| -2: [TypeAccess] String
48+
# 14| -1: [TypeAccess] String
4649
# 14| 0: [LocalVariableDeclExpr] tainted
4750
# 14| 1: [LocalVariableDeclExpr] notTainted
4851
# 14| 1: [LocalVariableDeclExpr] alsoNotTainted

java/ql/test/library-tests/printAst/PrintAst.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ A.java:
291291
# 105| -1: [VarAccess] field
292292
# 105| 0: [RecordPatternExpr] Middle(...)
293293
# 105| 0: [RecordPatternExpr] Inner(...)
294+
# 105| -1: [TypeAccess] String
294295
# 105| 0: [LocalVariableDeclExpr] field
295296
# 106| 1: [DefaultCase] default
296297
# 106| -1: [StringLiteral] "Doesn't match pattern Middle(Inner(...))"

0 commit comments

Comments
 (0)