[FIR Java] Hide function in scope in case it's an accessor by fact

#KT-42116 Fixed
This commit is contained in:
Mikhail Glukhikh
2020-09-24 12:01:04 +03:00
parent 70095712eb
commit fe8e3e99ab
10 changed files with 116 additions and 9 deletions
@@ -0,0 +1,26 @@
// FILE: PropertyDescriptor.java
public interface PropertyDescriptor extends DescriptorWithAccessor {
String getSetter();
boolean isDelegated();
}
// FILE: test.kt
interface DescriptorWithAccessor {
val setter: String
val isDelegated: Boolean
}
class WrappedPropertyDescriptor : PropertyDescriptor {
override val setter: String get() = "K"
override val isDelegated: Boolean get() = false
}
fun test() {
val descriptor = WrappedPropertyDescriptor()
val res1 = descriptor.setter
val res2 = descriptor.<!UNRESOLVED_REFERENCE!>getSetter<!>() // Should be error
val res3 = descriptor.isDelegated
val res4 = descriptor.<!UNRESOLVED_REFERENCE!>isDelegated<!>() // Should be error
}
@@ -0,0 +1,32 @@
FILE: test.kt
public abstract interface DescriptorWithAccessor : R|kotlin/Any| {
public abstract val setter: R|kotlin/String|
public get(): R|kotlin/String|
public abstract val isDelegated: R|kotlin/Boolean|
public get(): R|kotlin/Boolean|
}
public final class WrappedPropertyDescriptor : R|PropertyDescriptor| {
public constructor(): R|WrappedPropertyDescriptor| {
super<R|kotlin/Any|>()
}
public final override val setter: R|kotlin/String|
public get(): R|kotlin/String| {
^ String(K)
}
public final override val isDelegated: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ Boolean(false)
}
}
public final fun test(): R|kotlin/Unit| {
lval descriptor: R|WrappedPropertyDescriptor| = R|/WrappedPropertyDescriptor.WrappedPropertyDescriptor|()
lval res1: R|kotlin/String| = R|<local>/descriptor|.R|/WrappedPropertyDescriptor.setter|
lval res2: R|ERROR CLASS: Unresolved name: getSetter| = R|<local>/descriptor|.<Unresolved name: getSetter>#()
lval res3: R|kotlin/Boolean| = R|<local>/descriptor|.R|/WrappedPropertyDescriptor.isDelegated|
lval res4: R|ERROR CLASS: Unresolved name: isDelegated| = R|<local>/descriptor|.<Unresolved name: isDelegated>#()
}