K2: don't generate Java overridden synthetics for Kotlin get/sets
#KT-59038 Fixed
This commit is contained in:
committed by
Space Team
parent
9e39b7ef87
commit
d8a20f1975
+18
@@ -6493,6 +6493,24 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty2.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty2() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForSyntheticProperty.kt")
|
||||||
|
public void testGenericGetterForSyntheticProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForSyntheticProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("IntersectionTypesProblem.kt")
|
@TestMetadata("IntersectionTypesProblem.kt")
|
||||||
public void testIntersectionTypesProblem() throws Exception {
|
public void testIntersectionTypesProblem() throws Exception {
|
||||||
|
|||||||
+18
@@ -6493,6 +6493,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty2.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty2() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForSyntheticProperty.kt")
|
||||||
|
public void testGenericGetterForSyntheticProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForSyntheticProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("IntersectionTypesProblem.kt")
|
@TestMetadata("IntersectionTypesProblem.kt")
|
||||||
public void testIntersectionTypesProblem() throws Exception {
|
public void testIntersectionTypesProblem() throws Exception {
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
FILE: test.kt
|
||||||
|
public final class Base : R|kotlin/Any| {
|
||||||
|
public constructor(x: R|kotlin/Any|): R|Base| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val x: R|kotlin/Any| = R|<local>/x|
|
||||||
|
public get(): R|kotlin/Any|
|
||||||
|
|
||||||
|
public final fun <T> getFoo(): R|T| {
|
||||||
|
^getFoo (this@R|/Base|.R|/Base.x| as R|T|)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public final fun bar(some: R|Some|): R|kotlin/Unit| {
|
||||||
|
lval foo: <ERROR TYPE REF: Unresolved name: foo> = R|<local>/some|.<Unresolved name: foo>#
|
||||||
|
lval baz: <ERROR TYPE REF: Unresolved name: foo> = R|<local>/some|.<Unresolved name: foo>#<R|kotlin/String|>
|
||||||
|
lval getFoo: <ERROR TYPE REF: Cannot infer argument for type parameter T> = R|<local>/some|.R|/Base.getFoo<CS errors: /Base.getFoo>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>()
|
||||||
|
lval getBaz: R|kotlin/String| = R|<local>/some|.R|/Base.getFoo|<R|kotlin/String|>()
|
||||||
|
}
|
||||||
compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty.kt
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
// FILE: Some.java
|
||||||
|
|
||||||
|
public class Some extends Base {
|
||||||
|
public Some(Object o) {
|
||||||
|
super(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
class Base(val x: Any) {
|
||||||
|
fun <T> getFoo(): T = x <!UNCHECKED_CAST!>as T<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar(some: Some) {
|
||||||
|
val foo = some.<!UNRESOLVED_REFERENCE!>foo<!>
|
||||||
|
val baz = some.<!UNRESOLVED_REFERENCE!>foo<!><String>
|
||||||
|
|
||||||
|
val getFoo = some.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getFoo<!>()
|
||||||
|
val getBaz = some.getFoo<String>()
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
FILE: test.kt
|
||||||
|
public final class Base : R|kotlin/Any| {
|
||||||
|
public constructor(foo: R|kotlin/Any|): R|Base| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal final val foo: R|kotlin/Any| = R|<local>/foo|
|
||||||
|
internal get(): R|kotlin/Any|
|
||||||
|
|
||||||
|
public final fun <T> getFoo(): R|T| {
|
||||||
|
^getFoo (this@R|/Base|.R|/Base.foo| as R|T|)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public final fun bar(some: R|Some|): R|kotlin/Unit| {
|
||||||
|
lval foo: R|kotlin/Any| = R|<local>/some|.R|/Base.foo|
|
||||||
|
lval baz: R|kotlin/Any| = R|<local>/some|.R|/Base.foo|<R|kotlin/String|>
|
||||||
|
lval getFoo: <ERROR TYPE REF: Cannot infer argument for type parameter T> = R|<local>/some|.R|/Base.getFoo<CS errors: /Base.getFoo>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>()
|
||||||
|
lval getBaz: R|kotlin/String| = R|<local>/some|.R|/Base.getFoo|<R|kotlin/String|>()
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
// FILE: Some.java
|
||||||
|
|
||||||
|
public class Some extends Base {
|
||||||
|
public Some(Object o) {
|
||||||
|
super(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
class Base(internal val foo: Any) {
|
||||||
|
fun <T> getFoo(): T = foo <!UNCHECKED_CAST!>as T<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar(some: Some) {
|
||||||
|
val foo = some.foo
|
||||||
|
val baz = some.<!EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS!>foo<!><String>
|
||||||
|
|
||||||
|
val getFoo = some.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getFoo<!>()
|
||||||
|
val getBaz = some.getFoo<String>()
|
||||||
|
}
|
||||||
compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForSyntheticProperty.fir.txt
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
FILE: test.kt
|
||||||
|
public final fun bar(some: R|Some|): R|kotlin/Unit| {
|
||||||
|
lval foo: <ERROR TYPE REF: Unresolved name: foo> = R|<local>/some|.<Unresolved name: foo>#
|
||||||
|
lval baz: <ERROR TYPE REF: Unresolved name: foo> = R|<local>/some|.<Unresolved name: foo>#<R|kotlin/String|>
|
||||||
|
lval getFoo: <ERROR TYPE REF: Cannot infer argument for type parameter T> = R|<local>/some|.R|/Some.getFoo<CS errors: /Some.getFoo>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>()
|
||||||
|
lval getBaz: R|kotlin/String!| = R|<local>/some|.R|/Some.getFoo|<R|kotlin/String|>()
|
||||||
|
}
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// FILE: Some.java
|
||||||
|
|
||||||
|
public class Some {
|
||||||
|
public <T> T getFoo() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun bar(some: Some) {
|
||||||
|
val foo = some.<!UNRESOLVED_REFERENCE!>foo<!>
|
||||||
|
val baz = some.<!UNRESOLVED_REFERENCE!>foo<!><String>
|
||||||
|
|
||||||
|
val getFoo = some.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getFoo<!>()
|
||||||
|
val getBaz = some.getFoo<String>()
|
||||||
|
}
|
||||||
+18
@@ -6493,6 +6493,24 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty2.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty2() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForSyntheticProperty.kt")
|
||||||
|
public void testGenericGetterForSyntheticProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForSyntheticProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("IntersectionTypesProblem.kt")
|
@TestMetadata("IntersectionTypesProblem.kt")
|
||||||
public void testIntersectionTypesProblem() throws Exception {
|
public void testIntersectionTypesProblem() throws Exception {
|
||||||
|
|||||||
+18
@@ -6493,6 +6493,24 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForJavaOverriddenProperty2.kt")
|
||||||
|
public void testGenericGetterForJavaOverriddenProperty2() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForJavaOverriddenProperty2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("genericGetterForSyntheticProperty.kt")
|
||||||
|
public void testGenericGetterForSyntheticProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/genericGetterForSyntheticProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("IntersectionTypesProblem.kt")
|
@TestMetadata("IntersectionTypesProblem.kt")
|
||||||
public void testIntersectionTypesProblem() throws Exception {
|
public void testIntersectionTypesProblem() throws Exception {
|
||||||
|
|||||||
+6
@@ -18627,6 +18627,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
|||||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/typeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
+6
@@ -18627,6 +18627,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
|||||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/typeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
+6
@@ -2882,6 +2882,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
|||||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TypeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2882,6 +2882,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
|||||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TypeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
+8
-3
@@ -195,8 +195,13 @@ class JavaClassUseSiteMemberScope(
|
|||||||
val candidateReturnType = candidate.returnTypeRef.toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
val candidateReturnType = candidate.returnTypeRef.toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
||||||
|
|
||||||
candidateSymbol.takeIf {
|
candidateSymbol.takeIf {
|
||||||
// TODO: Decide something for the case when property type is not computed yet
|
when {
|
||||||
expectedReturnType == null || AbstractTypeChecker.isSubtypeOf(session.typeContext, candidateReturnType, expectedReturnType)
|
candidate.isJavaOrEnhancement ->
|
||||||
|
// TODO: Decide something for the case when property type is not computed yet
|
||||||
|
expectedReturnType == null ||
|
||||||
|
AbstractTypeChecker.isSubtypeOf(session.typeContext, candidateReturnType, expectedReturnType)
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,7 +220,7 @@ class JavaClassUseSiteMemberScope(
|
|||||||
candidate.valueParameters.single().returnTypeRef.toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
candidate.valueParameters.single().returnTypeRef.toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
||||||
|
|
||||||
candidateSymbol.takeIf {
|
candidateSymbol.takeIf {
|
||||||
AbstractTypeChecker.equalTypes(session.typeContext, parameterType, propertyType)
|
candidate.isJavaOrEnhancement && AbstractTypeChecker.equalTypes(session.typeContext, parameterType, propertyType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// IGNORE_BACKEND_K1: JVM_IR
|
||||||
|
// ISSUE: KT-59038
|
||||||
|
|
||||||
|
// FILE: C.java
|
||||||
|
abstract class C extends B {
|
||||||
|
protected C(A a) {
|
||||||
|
super(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
private class D(a: A) : C(a)
|
||||||
|
|
||||||
|
open class A
|
||||||
|
|
||||||
|
class E : A()
|
||||||
|
|
||||||
|
open class B(private val a: A) {
|
||||||
|
open fun <T : A> getA(): T {
|
||||||
|
return a as T
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val a = A()
|
||||||
|
val da = D(a)
|
||||||
|
val aa = da.getA<A>()
|
||||||
|
if (a !== aa) return "FAIL 1"
|
||||||
|
|
||||||
|
val e = E()
|
||||||
|
val de = D(e)
|
||||||
|
val ee = de.getA<E>()
|
||||||
|
if (e !== ee) return "FAIL 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+85
@@ -0,0 +1,85 @@
|
|||||||
|
FILE fqName:<root> fileName:/test.kt
|
||||||
|
CLASS CLASS name:D modality:FINAL visibility:private superTypes:[<root>.C]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D
|
||||||
|
CONSTRUCTOR visibility:public <> (a:<root>.A) returnType:<root>.D [primary]
|
||||||
|
VALUE_PARAMETER name:a index:0 type:<root>.A
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'protected/*protected and package*/ constructor <init> (a: @[FlexibleNullability] <root>.A?) declared in <root>.C'
|
||||||
|
a: GET_VAR 'a: <root>.A declared in <root>.D.<init>' type=<root>.A origin=null
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:private superTypes:[<root>.C]'
|
||||||
|
FUN FAKE_OVERRIDE name:getA visibility:public modality:OPEN <T> ($this:<root>.B) returnType:T of <root>.D.getA [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun getA <T> (): T of <root>.C.getA declared in <root>.C
|
||||||
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.A] reified:false
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.C
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in <root>.C
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in <root>.C
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||||
|
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Any]'
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS CLASS name:B modality:OPEN visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||||
|
CONSTRUCTOR visibility:public <> (a:<root>.A) returnType:<root>.B [primary]
|
||||||
|
VALUE_PARAMETER name:a index:0 type:<root>.A
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[kotlin.Any]'
|
||||||
|
PROPERTY name:a visibility:private modality:FINAL [val]
|
||||||
|
FIELD PROPERTY_BACKING_FIELD name:a type:<root>.A visibility:private [final]
|
||||||
|
EXPRESSION_BODY
|
||||||
|
GET_VAR 'a: <root>.A declared in <root>.B.<init>' type=<root>.A origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-a> visibility:private modality:FINAL <> ($this:<root>.B) returnType:<root>.A
|
||||||
|
correspondingProperty: PROPERTY name:a visibility:private modality:FINAL [val]
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='private final fun <get-a> (): <root>.A declared in <root>.B'
|
||||||
|
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:<root>.A visibility:private [final]' type=<root>.A origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.B declared in <root>.B.<get-a>' type=<root>.B origin=null
|
||||||
|
FUN name:getA visibility:public modality:OPEN <T> ($this:<root>.B) returnType:T of <root>.B.getA
|
||||||
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.A] reified:false
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public open fun getA <T> (): T of <root>.B.getA declared in <root>.B'
|
||||||
|
TYPE_OP type=T of <root>.B.getA origin=CAST typeOperand=T of <root>.B.getA
|
||||||
|
CALL 'private final fun <get-a> (): <root>.A declared in <root>.B' type=<root>.A origin=GET_PROPERTY
|
||||||
|
$this: GET_VAR '<this>: <root>.B declared in <root>.B.getA' type=<root>.B origin=null
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND_K1: JVM_IR
|
||||||
|
// ISSUE: KT-59038
|
||||||
|
|
||||||
|
// FILE: C.java
|
||||||
|
abstract class C extends B {
|
||||||
|
protected C(A a) {
|
||||||
|
super(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
private class D(a: A) : C(a)
|
||||||
|
|
||||||
|
open class A
|
||||||
|
|
||||||
|
open class B(private val a: A) {
|
||||||
|
open fun <T : A> getA(): T {
|
||||||
|
return a as T
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
private class D : C {
|
||||||
|
constructor(a: A) /* primary */ {
|
||||||
|
super/*C*/(a = a)
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
constructor() /* primary */ {
|
||||||
|
super/*Any*/()
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class B {
|
||||||
|
constructor(a: A) /* primary */ {
|
||||||
|
super/*Any*/()
|
||||||
|
/* <init>() */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private val a: A
|
||||||
|
field = a
|
||||||
|
private get
|
||||||
|
|
||||||
|
open fun <T : A> getA(): T {
|
||||||
|
return <this>.<get-a>() as T
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
// CHECK:
|
||||||
|
// Mangled name: A
|
||||||
|
// Public signature: /A|null[0]
|
||||||
|
open class A {
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: A#<init>(){}
|
||||||
|
// Public signature: /A.<init>|-5645683436151566731[0]
|
||||||
|
constructor() /* primary */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: B
|
||||||
|
// Public signature: /B|null[0]
|
||||||
|
open class B {
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: B{}a
|
||||||
|
// Public signature: /B.a|-1200697420457237799[0]
|
||||||
|
private val a: A
|
||||||
|
// CHECK JVM_IR:
|
||||||
|
// Mangled name: B#<get-a>(){}A
|
||||||
|
// Public signature: /B.a.<get-a>|736568356921033436[0]
|
||||||
|
private get
|
||||||
|
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: B#<init>(A){}
|
||||||
|
// Public signature: /B.<init>|-3166999336802030902[0]
|
||||||
|
constructor(a: A) /* primary */
|
||||||
|
|
||||||
|
// CHECK JVM_IR:
|
||||||
|
// Mangled name: B#getA(){0§<A>}0:0
|
||||||
|
// Public signature: /B.getA|6265629995120627543[0]
|
||||||
|
open fun <T : A> getA(): T
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: D
|
||||||
|
// Public signature: [ File '<unknown>' <- /D|null[0] ]
|
||||||
|
private class D : C {
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: D#<init>(A){}
|
||||||
|
// Public signature: /D.<init>|-3166999336802030902[0]
|
||||||
|
constructor(a: A) /* primary */
|
||||||
|
|
||||||
|
// CHECK:
|
||||||
|
// Mangled name: D#getA(){0§<A>}0:0
|
||||||
|
// Public signature: /D.getA|6265629995120627543[0]
|
||||||
|
/* fake */ override fun <T : A> getA(): T
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
+6
@@ -18627,6 +18627,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/typeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
+6
@@ -18627,6 +18627,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
|||||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/typeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
+6
@@ -2882,6 +2882,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
|||||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("TypeParameterInClashingAccessor.kt")
|
||||||
|
public void testTypeParameterInClashingAccessor() throws Exception {
|
||||||
|
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInClashingAccessor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||||
public void testTypeParameterInNestedClass() throws Exception {
|
public void testTypeParameterInNestedClass() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user