FIR: Do not create synthetic properties for non-Java accessors
^KT-35495 Fixed
This commit is contained in:
-82
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* There is some complex rules for conversions from java method `get...` to property
|
||||
* (see `JavaSyntheticPropertiesScope`), but they are not supported in FIR
|
||||
* It's possible to support them in `JavaClassUseSiteMemberScope`
|
||||
* But problem is that we also have `FirSyntheticPropertiesScope` that creates
|
||||
* synthetic properties for everithig
|
||||
*
|
||||
* Because of that such code is also resolves incorrect:
|
||||
*
|
||||
* class A {
|
||||
* fun getX(): Int = 1
|
||||
* }
|
||||
*
|
||||
* fun test(a: A) {
|
||||
* a.x // resolves to `getX`
|
||||
* }
|
||||
*/
|
||||
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
public String getVMParameters() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: B.java
|
||||
|
||||
public class B {
|
||||
public Integer getVmParameters() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: C.java
|
||||
|
||||
public class C {
|
||||
public String getVMParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getVmParameters() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: D.java
|
||||
|
||||
public class D {
|
||||
public boolean isGood() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test_1(x: A) {
|
||||
val str1 = x.vmParameters // OK
|
||||
val str2 = x.<!UNRESOLVED_REFERENCE!>vMParameters<!> // should be error
|
||||
}
|
||||
|
||||
fun test_2(x: B) {
|
||||
val int = x.vmParameters // OK
|
||||
val error = x.<!UNRESOLVED_REFERENCE!>vMParameters<!> // should be error
|
||||
}
|
||||
|
||||
fun test_3(x: C) {
|
||||
val error = x.<!AMBIGUITY!>vmParameters<!> // should be error
|
||||
val int = x.<!UNRESOLVED_REFERENCE!>vMParameters<!> // should be error
|
||||
}
|
||||
|
||||
class Foo {
|
||||
fun getX(): Int = 1
|
||||
}
|
||||
|
||||
fun test_4(foo: Foo) {
|
||||
foo.x // should be error
|
||||
}
|
||||
|
||||
fun test_5(x: D) {
|
||||
x.isGood
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
FILE: main.kt
|
||||
public final fun test_1(x: R|A|): R|kotlin/Unit| {
|
||||
lval str1: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/x|.R|/A.vmParameters|
|
||||
lval str2: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
|
||||
}
|
||||
public final fun test_2(x: R|B|): R|kotlin/Unit| {
|
||||
lval int: R|ft<kotlin/Int, kotlin/Int?>!| = R|<local>/x|.R|/B.vmParameters|
|
||||
lval error: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
|
||||
}
|
||||
public final fun test_3(x: R|C|): R|kotlin/Unit| {
|
||||
lval error: <ERROR TYPE REF: Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]> = R|<local>/x|.<Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]>#
|
||||
lval int: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
|
||||
}
|
||||
public final class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun getX(): R|kotlin/Int| {
|
||||
^getX Int(1)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_4(foo: R|Foo|): R|kotlin/Unit| {
|
||||
R|<local>/foo|.R|/Foo.x|
|
||||
}
|
||||
public final fun test_5(x: R|D|): R|kotlin/Unit| {
|
||||
R|<local>/x|.R|/D.isGood|
|
||||
}
|
||||
Reference in New Issue
Block a user