Skip to content

Commit c7179ee

Browse files
committed
Unified: Document problematic convenience inheritence corner case
1 parent 5796f97 commit c7179ee

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎unified/ql/test/library-tests/static-name-binding/inheritance.swift‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ class M: L { // $ access=L
5757

5858
class N: L { // $ access=L
5959
override init(x: Int) { super.init(x: 0) } // $ access=Int
60+
61+
convenience init // name=N.init_conv
62+
(a: Int, b: Int, c: Int) // $ access=Int
63+
{
64+
self.init(x: a + b + c) // $ access=a access=b access=c
65+
}
66+
}
67+
68+
class O: N { // $ access=N
69+
override init(x: Int) { // $ access=Int
70+
super.init(x: x) // $ access=x
71+
}
6072
}
6173

6274
// Members of base classes can be accessed through derived classes
@@ -94,5 +106,9 @@ func t1() {
94106

95107
let x19 = M.init() // $ access=M access=M.init access=L.init_conv -- type inference should filter away the `M.init` target
96108

97-
let x20 = N.init(x: 0) // $ access=N access=N.init
109+
let x20 = N.init(x: 0) // $ access=N access=N.init access=N.init_conv -- type inference should filter away the `N.init_conv` target
110+
111+
let x21 = O.init(x: 0) // $ access=O access=O.init $ MISSING: access=N.init_conv -- type inference should filter away the `N.init_conv` target
112+
113+
let x22 = O.init(a: 1, b: 2, c: 3) // $ access=O access=O.init $ MISSING: access=N.init_conv -- type inference should filter away the `O.init` target
98114
}

0 commit comments

Comments
 (0)