File tree Expand file tree Collapse file tree
unified/ql/test/library-tests/variables Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,3 +307,30 @@ func t34() {
307307 print ( x) // $ access=x2
308308 }
309309}
310+
311+ // While-let optional binding
312+ func t35( optional: Int ? ) { // name=optional1
313+ while let x = optional { // $ access=optional1 // name=x1
314+ print ( x) // $ MISSING: access=x1
315+ }
316+ }
317+
318+ // While with a sequence of variable bindings in the condition
319+ func t36( a: Int ? , b: Int ? ) {
320+ while let x = a, // $ access=a
321+ let y = b, // $ access=b
322+ x < y { // $ $ access=x access=y
323+ print ( x) // $ MISSING: access=x
324+ print ( y) // $ MISSING: access=y
325+ }
326+ }
327+
328+ // While-let with a sequence of shadowing variable declarations
329+ func t37( ) {
330+ let x = 1 // name=x1
331+ while let x = x, // $ access=x1 // name=x2
332+ let x = x, // $ access=x2 // name=x3
333+ x > 0 { // $ access=x3
334+ print ( x) // $ MISSING: access=x3 SPURIOUS: access=x1
335+ }
336+ }
You can’t perform that action at this time.
0 commit comments