Skip to content

Commit 4a89a30

Browse files
committed
Add failing test
1 parent c8bcfb7 commit 4a89a30

File tree

1 file changed

+17
-0
lines changed
  • swift/ql/test/library-tests/dataflow/dataflow

1 file changed

+17
-0
lines changed

swift/ql/test/library-tests/dataflow/dataflow/test.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,20 @@ func testOptionals2(y: Int?) {
457457
sink(arg: y) // (taint but not data flow)
458458
}
459459
}
460+
461+
class C {
462+
var x: Int?
463+
}
464+
465+
func testOptionalPropertyAccess(y: Int?) {
466+
let x = optionalSource()
467+
let cx = C()
468+
cx.x = x
469+
let cy = C()
470+
cy.x = y
471+
472+
guard let z1 = cx.x else { return }
473+
sink(arg: z1) // $ flow=259
474+
guard let z2 = cy.x else { return }
475+
sink(arg: z2)
476+
}

0 commit comments

Comments
 (0)