Add additional visibility check for synthetic extensions

Use extension receiver as dispatch one, because it is effectively dispatch
(after some desugaring)
This commit is contained in:
Denis Zharkov
2016-03-31 12:26:14 +03:00
parent b5c9523e4b
commit bc1b34a989
8 changed files with 188 additions and 2 deletions
@@ -0,0 +1,45 @@
// FILE: abc/A.java
package abc;
public class A {
public int getAbc() {}
protected int getFoo() { return 1; }
public String getBar() { return ""; }
protected void setBar(String x) { }
}
// FILE: main.kt
import abc.A
class Data(var x: A)
class B : A() {
fun baz(a: A, b: B, d: Data) {
foo
bar = bar + ""
b.foo
b.bar = b.bar + ""
a.<!INVISIBLE_MEMBER!>foo<!>
// TODO: should be INVISIBLE_SETTER
a.bar = a.bar + ""
if (a is B) {
<!DEBUG_INFO_SMARTCAST!>a<!>.foo
<!DEBUG_INFO_SMARTCAST!>a<!>.bar = <!DEBUG_INFO_SMARTCAST!>a<!>.bar + ""
}
if (d.x is B) {
d.x.abc // Ok
d.x.<!INVISIBLE_MEMBER!>foo<!>
// TODO: should be INVISIBLE_SETTER
d.x.bar = d.x.bar + ""
}
}
}
fun baz(a: A) {
a.<!INVISIBLE_MEMBER!>foo<!>
<!INVISIBLE_SETTER!>a.bar<!> = a.bar + ""
}