Note that instanceof with a record pattern doesn't have a type access

This commit is contained in:
Chris Smowton
2023-11-03 17:21:28 +00:00
parent 11444a3ae7
commit a335109a20
2 changed files with 18 additions and 4 deletions

View File

@@ -48,7 +48,9 @@ predicate gapInChildren(Element e, int i) {
// is able.
not e instanceof Annotation and
// 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())
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)
}
predicate lateFirstChild(Element e, int i) {