From 25cb03b707a0e3b5be18f33501716621f1e04425 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 17 Mar 2023 17:29:42 +0100 Subject: [PATCH] Add test ensuring the case of KT-57022 is fixed --- .../FirLightTreeJvmIrTextTestGenerated.java | 6 +++ .../ir/FirPsiJvmIrTextTestGenerated.java | 6 +++ ...reComputationComplexJavaGeneric.fir.ir.txt | 42 +++++++++++++++++++ ...reComputationComplexJavaGeneric.fir.kt.txt | 16 +++++++ ...natureComputationComplexJavaGeneric.ir.txt | 42 +++++++++++++++++++ .../SignatureComputationComplexJavaGeneric.kt | 19 +++++++++ ...natureComputationComplexJavaGeneric.kt.txt | 16 +++++++ .../ir/ClassicJvmIrTextTestGenerated.java | 6 +++ .../klib/KlibIrTextTestCaseGenerated.java | 5 +++ .../FirLightTreeJsIrTextTestGenerated.java | 6 +++ .../test/fir/FirPsiJsIrTextTestGenerated.java | 6 +++ .../test/ir/ClassicJsIrTextTestGenerated.java | 6 +++ 12 files changed, 176 insertions(+) create mode 100644 compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.ir.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.ir.txt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt create mode 100644 compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java index 82497ce6f30..6c56e1b8b0c 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java @@ -2792,6 +2792,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java index 84723ccd4f7..01072d0ef84 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java @@ -2792,6 +2792,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { diff --git a/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.ir.txt b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.ir.txt new file mode 100644 index 00000000000..2e99d62d88e --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.ir.txt @@ -0,0 +1,42 @@ +FILE fqName: fileName:/test.kt + CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.J.Test>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test.Test> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> (x:T of .Test) returnType:.Test.Test> [primary] + VALUE_PARAMETER name:x index:0 type:T of .Test + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .J' + : T of .Test + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.J.Test>]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final] + EXPRESSION_BODY + GET_VAR 'x: T of .Test declared in .Test.' type=T of .Test origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test.Test>) returnType:T of .Test + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Test.Test> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Test declared in .Test' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final]' type=T of .Test origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.' type=.Test.Test> origin=null + FUN name:test visibility:public modality:FINAL <> ($this:.Test.Test>, b:.J.B.Test>) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Test.Test> + VALUE_PARAMETER name:b index:0 type:.J.B.Test> + BLOCK_BODY + CALL 'public open fun output (x: @[EnhancedNullability] T of .Test): kotlin.Unit [fake_override] declared in .J.B' type=kotlin.Unit origin=null + $this: GET_VAR 'b: .J.B.Test> declared in .Test.test' type=.J.B.Test> origin=null + x: CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=GET_PROPERTY + $this: GET_VAR ': .Test.Test> declared in .Test.test' type=.Test.Test> 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 [fake_override,operator] declared in .J + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .J + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .J + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.kt.txt new file mode 100644 index 00000000000..ffa97e0147f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.fir.kt.txt @@ -0,0 +1,16 @@ +class Test : J { + constructor(x: T) /* primary */ { + super/*J*/() + /* () */ + + } + + val x: T + field = x + get + + fun test(b: B) { + b.output(x = .()) + } + +} diff --git a/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.ir.txt b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.ir.txt new file mode 100644 index 00000000000..ea7ade7d7f1 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.ir.txt @@ -0,0 +1,42 @@ +FILE fqName: fileName:/test.kt + CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.J.Test>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test.Test> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> (x:T of .Test) returnType:.Test.Test> [primary] + VALUE_PARAMETER name:x index:0 type:T of .Test + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .J' + : T of .Test + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.J.Test>]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final] + EXPRESSION_BODY + GET_VAR 'x: T of .Test declared in .Test.' type=T of .Test origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test.Test>) returnType:T of .Test + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Test.Test> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Test declared in .Test' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final]' type=T of .Test origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.' type=.Test.Test> origin=null + FUN name:test visibility:public modality:FINAL <> ($this:.Test.Test>, b:.J.B.Test>) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Test.Test> + VALUE_PARAMETER name:b index:0 type:.J.B.Test> + BLOCK_BODY + CALL 'public open fun output (x: @[EnhancedNullability] T of .J): kotlin.Unit [fake_override] declared in .J.B' type=kotlin.Unit origin=null + $this: GET_VAR 'b: .J.B.Test> declared in .Test.test' type=.J.B.Test> origin=null + x: CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=GET_PROPERTY + $this: GET_VAR ': .Test.Test> declared in .Test.test' type=.Test.Test> 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 [fake_override,operator] declared in .J + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .J + $this: VALUE_PARAMETER name: 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 [fake_override] declared in .J + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt new file mode 100644 index 00000000000..1f7567eaee2 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt @@ -0,0 +1,19 @@ +// SKIP_KLIB_TEST +// IGNORE_BACKEND: JS_IR +// IGNORE_BACKEND: JS_IR_ES6 +// FILE: J.java + +import org.jetbrains.annotations.Nullable; + +public class J { + public class A { + public void output(T x) {} + } + public class B extends A {} +} + +// FILE: test.kt + +class Test(val x: T) : J() { + fun test(b: B) { b.output(x) } +} diff --git a/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt.txt new file mode 100644 index 00000000000..ffa97e0147f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt.txt @@ -0,0 +1,16 @@ +class Test : J { + constructor(x: T) /* primary */ { + super/*J*/() + /* () */ + + } + + val x: T + field = x + get + + fun test(b: B) { + b.output(x = .()) + } + +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java index ce8d35994e6..5295749e1c0 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java @@ -2792,6 +2792,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java index 93273936c01..c6b00aa97bf 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java @@ -1985,6 +1985,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { runTest("compiler/testData/ir/irText/firProblems/SimpleTypeMarker.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java index d5e722fa5a9..5abe0683ab7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java @@ -2276,6 +2276,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java index 07f997eb2b9..2a011d31380 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java @@ -2276,6 +2276,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java index 31739b94fce..fa53d0b69fd 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java @@ -2276,6 +2276,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest { runTest("compiler/testData/ir/irText/firProblems/SignatureClash.kt"); } + @Test + @TestMetadata("SignatureComputationComplexJavaGeneric.kt") + public void testSignatureComputationComplexJavaGeneric() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/SignatureComputationComplexJavaGeneric.kt"); + } + @Test @TestMetadata("SimpleTypeMarker.kt") public void testSimpleTypeMarker() throws Exception {