Update test expectations re: record-pattern type accesses

This commit is contained in:
Chris Smowton
2023-11-24 19:15:45 +00:00
parent b1cea1d91e
commit cc68169f43
3 changed files with 7 additions and 1 deletions

View File

@@ -50,7 +50,9 @@ predicate gapInChildren(Element e, int i) {
// Pattern case statements legitimately have a TypeAccess (-2) and a pattern (0) but not a rule (-1)
not (i = -1 and e instanceof PatternCase and not e.(PatternCase).isRule()) and
// Instanceof with a record pattern is not expected to have a type access in position 1
not (i = 1 and e.(InstanceOfExpr).getPattern() instanceof RecordPatternExpr)
not (i = 1 and e.(InstanceOfExpr).getPattern() instanceof RecordPatternExpr) and
// RecordPatternExpr extracts type-accesses only for its LocalVariableDeclExpr children
not (i < 0 and e instanceof RecordPatternExpr)
}
predicate lateFirstChild(Element e, int i) {

View File

@@ -42,7 +42,10 @@ Test.java:
# 14| 0: [InstanceOfExpr] ...instanceof...
# 14| 0: [VarAccess] o
# 14| 2: [RecordPatternExpr] Outer(...)
# 14| -2: [TypeAccess] String
# 14| 0: [RecordPatternExpr] Inner(...)
# 14| -2: [TypeAccess] String
# 14| -1: [TypeAccess] String
# 14| 0: [LocalVariableDeclExpr] tainted
# 14| 1: [LocalVariableDeclExpr] notTainted
# 14| 1: [LocalVariableDeclExpr] alsoNotTainted

View File

@@ -291,6 +291,7 @@ A.java:
# 105| -1: [VarAccess] field
# 105| 0: [RecordPatternExpr] Middle(...)
# 105| 0: [RecordPatternExpr] Inner(...)
# 105| -1: [TypeAccess] String
# 105| 0: [LocalVariableDeclExpr] field
# 106| 1: [DefaultCase] default
# 106| -1: [StringLiteral] "Doesn't match pattern Middle(Inner(...))"