[FIR] Add INVISIBLE_SETTER

This commit is contained in:
Ivan Kochurkin
2021-10-01 00:05:49 +03:00
parent c97587cc53
commit 75b40e4b75
54 changed files with 393 additions and 232 deletions
@@ -1,9 +0,0 @@
class A<T> {
public var x: Int = 0
private set
}
fun main() {
val a = A<Any>()
a.x = 1
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A<T> {
public var x: Int = 0
private set
@@ -0,0 +1,9 @@
// FIR_IDENTICAL
class Test(protected var prop1: Int = 1) {
protected var prop2: Int = 2
private fun test() {
prop1 = 3
prop2 = 4
}
}
@@ -0,0 +1,11 @@
package
public final class Test {
public constructor Test(/*0*/ prop1: kotlin.Int = ...)
protected final var prop1: kotlin.Int
protected final var prop2: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
private final fun test(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -22,8 +22,7 @@ class B : A() {
b.bar = b.bar + ""
a.<!INVISIBLE_REFERENCE!>foo<!>
// TODO: should be INVISIBLE_SETTER
a.bar = a.bar + ""
<!INVISIBLE_SETTER!>a.bar<!> = a.bar + ""
if (a is B) {
a.foo
@@ -33,13 +32,12 @@ class B : A() {
if (d.x is B) {
d.x.abc // Ok
d.x.<!INVISIBLE_REFERENCE!>foo<!>
// TODO: should be INVISIBLE_SETTER
d.x.bar = d.x.bar + ""
<!INVISIBLE_SETTER!>d.x.bar<!> = d.x.bar + ""
}
}
}
fun baz(a: A) {
a.<!INVISIBLE_REFERENCE!>foo<!>
a.bar = a.bar + ""
<!INVISIBLE_SETTER!>a.bar<!> = a.bar + ""
}
@@ -22,7 +22,6 @@ class B : A() {
b.bar = b.bar + ""
a.<!INVISIBLE_MEMBER!>foo<!>
// TODO: should be INVISIBLE_SETTER
a.<!INVISIBLE_SETTER!>bar<!> = a.bar + ""
if (a is B) {
@@ -33,7 +32,6 @@ class B : A() {
if (d.x is B) {
d.x.abc // Ok
d.x.<!INVISIBLE_MEMBER!>foo<!>
// TODO: should be INVISIBLE_SETTER
d.x.<!INVISIBLE_SETTER!>bar<!> = d.x.bar + ""
}
}
@@ -15,7 +15,7 @@ class Derived : Base() {
x.<!INVISIBLE_REFERENCE!>bar<!>()
x.<!INVISIBLE_REFERENCE!>x<!> = x.<!INVISIBLE_REFERENCE!>x<!> + 1
x.y = x.y + 1
<!INVISIBLE_SETTER!>x.y<!> = x.y + 1
if (x is Derived) {
x.foo()
@@ -0,0 +1,21 @@
// FIR_IDENTICAL
// FILE: Java.java
public abstract class Java {
private String _name = null;
void setName(String name) {
this._name = name;
}
public String getName() {
return _name;
}
}
// FILE: main.kt
fun Java.test(name: String) {
this.name = name
}
@@ -0,0 +1,13 @@
package
public fun Java.test(/*0*/ name: kotlin.String): kotlin.Unit
public abstract class Java {
public constructor Java()
private final var _name: kotlin.String!
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun getName(): kotlin.String!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public/*package*/ open fun setName(/*0*/ name: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}