mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
Update test expectations re: record-pattern type accesses
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(...))"
|
||||
|
||||
Reference in New Issue
Block a user