Skip to content

Commit d49f847

Browse files
asgerfCopilot
andcommitted
Unified: Add test for subscript setter hidden by subclass overload
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 47d5c6c commit d49f847

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎unified/ql/test/library-tests/dataflow/subscripts.swift‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,17 @@ func s14() {
183183
c[0].f = sink(c.field) // $ SPURIOUS: hasValueFlow=s14.1
184184
sink(c.field) // $ hasValueFlow=s14.1
185185
}
186+
187+
func s15() {
188+
class Base {
189+
subscript(i: Int) -> String {
190+
get { "safe" }
191+
set { sink(newValue) } // $ MISSING: hasValueFlow=s15.1
192+
}
193+
}
194+
class Derived: Base {
195+
subscript(i: Int, j: Int) -> String { "safe" }
196+
}
197+
let d = Derived()
198+
d[0] = source("s15.1")
199+
}

0 commit comments

Comments
 (0)