FIR: Fix Java scope in case of accessor with getter signature from supertype

^KT-45584 Fixed
This commit is contained in:
Denis.Zharkov
2021-03-25 16:28:48 +03:00
parent 24f35ef281
commit 1f074326bf
21 changed files with 94 additions and 33 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
@@ -9,4 +8,4 @@ class A : Hashtable<String, String>()
fun box(): String {
val sz = A().size
return "OK"
}
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: J.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FULL_JDK
// ISSUE: KT-45584
@@ -11,10 +10,12 @@ public interface PlaceholderExceptionSupport {
// FILE: PlaceholderException.java
public class PlaceholderException extends RuntimeException implements PlaceholderExceptionSupport {}
public class PlaceholderException extends RuntimeException implements PlaceholderExceptionSupport {
public PlaceholderException(String x) { super(x); }
}
// FILE: main.kt
class KotlinTestFailure : PlaceholderException() {} // <-- CONFLICTING_INHERITED_JVM_DECLARATIONS
class KotlinTestFailure : PlaceholderException("OK") {} // <-- CONFLICTING_INHERITED_JVM_DECLARATIONS
fun box(): String = "OK"
fun box(): String = KotlinTestFailure().message ?: "fail"
@@ -0,0 +1,21 @@
// TARGET_BACKEND: JVM
// FULL_JDK
// ISSUE: KT-45584
// FILE: PlaceholderExceptionSupport.java
public interface PlaceholderExceptionSupport {
String getMessage();
}
// FILE: PlaceholderException.java
public class PlaceholderException extends RuntimeException implements PlaceholderExceptionSupport {
public PlaceholderException(String x) { super(x); }
}
// FILE: main.kt
class KotlinTestFailure : PlaceholderException("OK") {} // <-- CONFLICTING_INHERITED_JVM_DECLARATIONS
fun box(): String = KotlinTestFailure().message ?: "fail"
@@ -108,7 +108,7 @@ public class A extends AImpl implements List<String> {
}
// FILE: X.kt
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class X<!> : A()
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class X<!> : A()
fun main() {
val x = X()
@@ -1,6 +0,0 @@
// FULL_JDK
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class C1<!> : java.util.Hashtable<String, Int>()
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class C2<!> : java.util.Hashtable<String, Int>() {
override fun get(key: String) = 123
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FULL_JDK
class C1 : java.util.Hashtable<String, Int>()
@@ -1,5 +0,0 @@
// FULL_JDK
import java.security.Provider
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class Example<!> : Provider("A", 1.0, "B")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FULL_JDK
import java.security.Provider
@@ -46,6 +46,7 @@ FILE fqName:<root> fileName:/varargFunImportedFromObject.kt
x: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 'p0: kotlin.String declared in <root>.test1.foo' type=kotlin.String origin=null
FUNCTION_REFERENCE 'local final fun foo (p0: kotlin.String): kotlin.String declared in <root>.test1' type=kotlin.Function1<kotlin.String, kotlin.String> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=null
$receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.String declared in <root>'
@@ -61,7 +61,7 @@ fun testImportedObjectMember(): String {
return receiver.importedObjectMemberWithVarargs(xs = [p0])
}
::importedObjectMemberWithVarargs
Host::importedObjectMemberWithVarargs
})
}
@@ -111,6 +111,7 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testImportedObjectMember.importedObjectMemberWithVarargs' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun importedObjectMemberWithVarargs (p0: kotlin.Int): kotlin.String declared in <root>.testImportedObjectMember' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=null
$receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
FUN name:testDefault0 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testDefault0 (): kotlin.String declared in <root>'
@@ -19,7 +19,7 @@ class Host {
receiver.withVararg(xs = [p0])
}
Host::withVararg
<this>::withVararg
})
}
@@ -31,6 +31,7 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testImplicitThis.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testImplicitThis' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=ADAPTED_FUNCTION_REFERENCE reflectionTarget=null
$receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.testImplicitThis' type=<root>.Host origin=null
FUN name:testBoundReceiverLocalVal visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY