diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index 3da8df48108..d83a7d9462a 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -19606,6 +19606,24 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index d95a9680320..086e9d541a6 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -19606,6 +19606,24 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index ec75030428f..c6fc7dbe9b3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -19271,6 +19271,24 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 87a69318d09..35a0d5ba960 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -19271,6 +19271,24 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index bcf3141b8d8..ef9af5d08a6 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -19271,6 +19271,24 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt index 3ab2aa36424..13444240b7e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/overrides/IrOverrideChecker.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.types.createIrTypeCheckerState import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo.* import org.jetbrains.kotlin.types.AbstractTypeChecker +import org.jetbrains.kotlin.types.TypeCheckerState class IrOverrideChecker( private val typeSystem: IrTypeSystemContext, @@ -100,36 +101,48 @@ class IrOverrideChecker( superValueParameters.size != subValueParameters.size -> return incompatible("Value parameter number mismatch") } - // TODO: check the bounds. See OverridingUtil.areTypeParametersEquivalent() -// superTypeParameters.forEachIndexed { index, parameter -> -// if (!AbstractTypeChecker.areTypeParametersEquivalent( -// typeCheckerContext as AbstractTypeCheckerContext, -// subTypeParameters[index].type, -// parameter.type -// ) -// ) return OverrideCompatibilityInfo.incompatible("Type parameter bounds mismatch") -// } - val typeCheckerState = createIrTypeCheckerState( - IrTypeSystemContextWithAdditionalAxioms( - typeSystem, - superTypeParameters, - subTypeParameters - ) + IrTypeSystemContextWithAdditionalAxioms(typeSystem, superTypeParameters, subTypeParameters) ) - superValueParameters.forEachIndexed { index, parameter -> - if (!AbstractTypeChecker.equalTypes( - typeCheckerState, - subValueParameters[index].type, - parameter.type - ) - ) return incompatible("Value parameter type mismatch") + for ((index, superTypeParameter) in superTypeParameters.withIndex()) { + if (!areTypeParametersEquivalent(superTypeParameter, subTypeParameters[index], typeCheckerState)) { + return incompatible("Type parameter bounds mismatch") + } + } + + for ((index, superValueParameter) in superValueParameters.withIndex()) { + if (!AbstractTypeChecker.equalTypes(typeCheckerState, subValueParameters[index].type, superValueParameter.type)) { + return incompatible("Value parameter type mismatch") + } } return success() } + private fun areTypeParametersEquivalent( + superTypeParameter: IrTypeParameter, + subTypeParameter: IrTypeParameter, + typeCheckerState: TypeCheckerState, + ): Boolean { + val superBounds = superTypeParameter.superTypes + val subBounds = subTypeParameter.superTypes.toMutableList() + if (superBounds.size != subBounds.size) return false + outer@ for (superBound in superBounds) { + val it = subBounds.listIterator() + while (it.hasNext()) { + val subBound = it.next() + if (AbstractTypeChecker.equalTypes(typeCheckerState, superBound, subBound)) { + it.remove() + continue@outer + } + } + return false + } + return true + } + + private fun runExternalOverridabilityConditions( superMember: IrOverridableMember, subMember: IrOverridableMember, diff --git a/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.fir.ir.txt b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.fir.ir.txt new file mode 100644 index 00000000000..913872c99a9 --- /dev/null +++ b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.fir.ir.txt @@ -0,0 +1,165 @@ +FILE fqName: fileName:/functionsDifferInTypeParameterBounds.kt + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.A]' + 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 .A + $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 declared in .A + $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 declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.A]' + 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 .A + $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 declared in .A + $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 declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X + CONSTRUCTOR visibility:public <> () returnType:.X [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:FINAL ($this:.X, s:S1 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S1 index:0 variance: superTypes:[.A] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S1 of .X.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (s: S1 of .X.foo): kotlin.String declared in .X' + BLOCK type=kotlin.String origin=WHEN + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:S1 of .X.foo [val] + GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + WHEN type=kotlin.String origin=WHEN + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.B + GET_VAR 'val tmp_0: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + then: CALL 'public abstract fun foo (s: S2 of .X.foo): kotlin.String declared in .X' type=kotlin.String origin=null + : .A + $this: GET_VAR ': .X declared in .X.foo' type=.X origin=null + s: GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.C + GET_VAR 'val tmp_0: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + then: CALL 'public abstract fun foo (s: S3 of .X.foo): kotlin.String declared in .X' type=kotlin.String origin=null + : .A + $this: GET_VAR ': .X declared in .X.foo' type=.X origin=null + s: GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.Any?) declared in java.lang.AssertionError' type=java.lang.AssertionError origin=null + p0: GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + FUN name:foo visibility:public modality:ABSTRACT ($this:.X, s:S2 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S2 index:0 variance: superTypes:[.B] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S2 of .X.foo + FUN name:foo visibility:public modality:ABSTRACT ($this:.X, s:S3 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S3 index:0 variance: superTypes:[.C] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S3 of .X.foo + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:Y modality:FINAL visibility:public superTypes:[.X] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Y + CONSTRUCTOR visibility:public <> () returnType:.Y [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .X' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Y modality:FINAL visibility:public superTypes:[.X]' + FUN name:foo visibility:public modality:OPEN ($this:.Y, s:S4 of .Y.foo) returnType:kotlin.String + overridden: + public abstract fun foo (s: S2 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S4 index:0 variance: superTypes:[.B] reified:false + $this: VALUE_PARAMETER name: type:.Y + VALUE_PARAMETER name:s index:0 type:S4 of .Y.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (s: S4 of .Y.foo): kotlin.String declared in .Y' + CONST String type=kotlin.String value="O" + FUN name:foo visibility:public modality:OPEN ($this:.Y, s:S5 of .Y.foo) returnType:kotlin.String + overridden: + public abstract fun foo (s: S3 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S5 index:0 variance: superTypes:[.C] reified:false + $this: VALUE_PARAMETER name: type:.Y + VALUE_PARAMETER name:s index:0 type:S5 of .Y.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (s: S5 of .Y.foo): kotlin.String declared in .Y' + CONST String type=kotlin.String value="K" + FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL ($this:.X, s:S1 of .Y.foo) returnType:kotlin.String [fake_override] + overridden: + public final fun foo (s: S1 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S1 index:0 variance: superTypes:[.A] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S1 of .Y.foo + 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 .X + $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 declared in .X + $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 declared in .X + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public open fun foo (s: S4 of .Y.foo): kotlin.String declared in .Y' type=kotlin.String origin=null + : .B + $this: CONSTRUCTOR_CALL 'public constructor () declared in .Y' type=.Y origin=null + s: CONSTRUCTOR_CALL 'public constructor () declared in .B' type=.B origin=null + other: CALL 'public open fun foo (s: S5 of .Y.foo): kotlin.String declared in .Y' type=kotlin.String origin=null + : .C + $this: CONSTRUCTOR_CALL 'public constructor () declared in .Y' type=.Y origin=null + s: CONSTRUCTOR_CALL 'public constructor () declared in .C' type=.C origin=null diff --git a/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.ir.txt b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.ir.txt new file mode 100644 index 00000000000..3e39adce72a --- /dev/null +++ b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.ir.txt @@ -0,0 +1,167 @@ +FILE fqName: fileName:/functionsDifferInTypeParameterBounds.kt + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.A]' + 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 .A + $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 declared in .A + $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 declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.A]' + 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 .A + $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 declared in .A + $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 declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X + CONSTRUCTOR visibility:public <> () returnType:.X [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:FINAL ($this:.X, s:S1 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S1 index:0 variance: superTypes:[.A] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S1 of .X.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (s: S1 of .X.foo): kotlin.String declared in .X' + BLOCK type=kotlin.String origin=WHEN + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:S1 of .X.foo [val] + GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + WHEN type=kotlin.String origin=WHEN + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.B + GET_VAR 'val tmp_0: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + then: CALL 'public abstract fun foo (s: S2 of .X.foo): kotlin.String declared in .X' type=kotlin.String origin=null + : .B + $this: GET_VAR ': .X declared in .X.foo' type=.X origin=null + s: TYPE_OP type=.B origin=IMPLICIT_CAST typeOperand=.B + GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.C + GET_VAR 'val tmp_0: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + then: CALL 'public abstract fun foo (s: S3 of .X.foo): kotlin.String declared in .X' type=kotlin.String origin=null + : .C + $this: GET_VAR ': .X declared in .X.foo' type=.X origin=null + s: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C + GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.Any?) declared in java.lang.AssertionError' type=java.lang.AssertionError origin=null + p0: GET_VAR 's: S1 of .X.foo declared in .X.foo' type=S1 of .X.foo origin=null + FUN name:foo visibility:public modality:ABSTRACT ($this:.X, s:S2 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S2 index:0 variance: superTypes:[.B] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S2 of .X.foo + FUN name:foo visibility:public modality:ABSTRACT ($this:.X, s:S3 of .X.foo) returnType:kotlin.String + TYPE_PARAMETER name:S3 index:0 variance: superTypes:[.C] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S3 of .X.foo + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:Y modality:FINAL visibility:public superTypes:[.X] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Y + CONSTRUCTOR visibility:public <> () returnType:.Y [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .X' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Y modality:FINAL visibility:public superTypes:[.X]' + FUN name:foo visibility:public modality:OPEN ($this:.Y, s:S4 of .Y.foo) returnType:kotlin.String + overridden: + public abstract fun foo (s: S2 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S4 index:0 variance: superTypes:[.B] reified:false + $this: VALUE_PARAMETER name: type:.Y + VALUE_PARAMETER name:s index:0 type:S4 of .Y.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (s: S4 of .Y.foo): kotlin.String declared in .Y' + CONST String type=kotlin.String value="O" + FUN name:foo visibility:public modality:OPEN ($this:.Y, s:S5 of .Y.foo) returnType:kotlin.String + overridden: + public abstract fun foo (s: S3 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S5 index:0 variance: superTypes:[.C] reified:false + $this: VALUE_PARAMETER name: type:.Y + VALUE_PARAMETER name:s index:0 type:S5 of .Y.foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (s: S5 of .Y.foo): kotlin.String declared in .Y' + CONST String type=kotlin.String value="K" + FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL ($this:.X, s:S1 of .Y.foo) returnType:kotlin.String [fake_override] + overridden: + public final fun foo (s: S1 of .X.foo): kotlin.String declared in .X + TYPE_PARAMETER name:S1 index:0 variance: superTypes:[.A] reified:false + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:s index:0 type:S1 of .Y.foo + 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 .X + $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 declared in .X + $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 declared in .X + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public open fun foo (s: S4 of .Y.foo): kotlin.String declared in .Y' type=kotlin.String origin=null + : .B + $this: CONSTRUCTOR_CALL 'public constructor () declared in .Y' type=.Y origin=null + s: CONSTRUCTOR_CALL 'public constructor () declared in .B' type=.B origin=null + other: CALL 'public open fun foo (s: S5 of .Y.foo): kotlin.String declared in .Y' type=kotlin.String origin=null + : .C + $this: CONSTRUCTOR_CALL 'public constructor () declared in .Y' type=.Y origin=null + s: CONSTRUCTOR_CALL 'public constructor () declared in .C' type=.C origin=null diff --git a/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt new file mode 100644 index 00000000000..bd1a1799f35 --- /dev/null +++ b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt @@ -0,0 +1,26 @@ +// IGNORE_BACKEND_K2: WASM + +// DUMP_IR +// ^ Note that K2 IR dump has incorrectly inferred type arguments: KT-63846. + +interface A +open class B : A +open class C : A + +abstract class X { + fun foo(s: S1): String = when (s) { + is B -> foo(s) + is C -> foo(s) + else -> throw AssertionError(s) + } + + abstract fun foo(s: S2): String + abstract fun foo(s: S3): String +} + +class Y : X() { + override fun foo(s: S4): String = "O" + override fun foo(s: S5): String = "K" +} + +fun box(): String = Y().foo(B()) + Y().foo(C()) diff --git a/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt new file mode 100644 index 00000000000..d97c71e6c2c --- /dev/null +++ b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt @@ -0,0 +1,52 @@ +open class A +open class B +open class C + +interface X { + fun foo(t1: T1, t2: T2, t3: T3): String + fun foo(t1: T1, t2: T2, t3: T3): String + fun foo(t1: T1, t2: T2, t3: T3): String + fun foo(t1: T1, t2: T2, t3: T3): String + + fun foo(t1: T11, t2: T12, t3: T13): String + fun foo(t1: T21, t2: T22, t3: T23): String + fun foo(t1: T31, t2: T32, t3: T33): String + fun foo(t1: T41, t2: T42, t3: T43): String + fun foo(t1: T51, t2: T52, t3: T53): String + fun foo(t1: T61, t2: T62, t3: T63): String +} + +class Y : X { + override fun foo(t1: S1, t2: S2, t3: S3): String = "___" + override fun foo(t1: S1, t2: S2, t3: S3): String = "_B_" + override fun foo(t1: S1, t2: S2, t3: S3): String = "C_A" + override fun foo(t1: S1, t2: S2, t3: S3): String = "_AB" + + override fun foo(t1: S11, t2: S12, t3: S13): String = "ABC" + override fun foo(t1: S21, t2: S22, t3: S23): String = "ACB" + override fun foo(t1: S31, t2: S32, t3: S33): String = "BAC" + override fun foo(t1: S41, t2: S42, t3: S43): String = "BCA" + override fun foo(t1: S51, t2: S52, t3: S53): String = "CAB" + override fun foo(t1: S61, t2: S62, t3: S63): String = "CBA" +} + +fun box(): String { + val a = A() + val b = B() + val c = C() + val y = Y() + + if (y.foo("_", "_", "_") != "___") return "Fail ___" + if (y.foo("_", b, "_") != "_B_") return "Fail _B_" + if (y.foo(c, "_", a) != "C_A") return "Fail C_A" + if (y.foo("_", a, b) != "_AB") return "Fail _AB" + + if (y.foo(a, b, c) != "ABC") return "Fail ABC" + if (y.foo(a, c, b) != "ACB") return "Fail ACB" + if (y.foo(b, a, c) != "BAC") return "Fail BAC" + if (y.foo(b, c, a) != "BCA") return "Fail BCA" + if (y.foo(c, a, b) != "CAB") return "Fail CAB" + if (y.foo(c, b, a) != "CBA") return "Fail CBA" + + return "OK" +} diff --git a/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt new file mode 100644 index 00000000000..ca1804129c7 --- /dev/null +++ b/compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt @@ -0,0 +1,32 @@ +interface A +interface B +interface C +interface D +interface Inv + +open class K + +interface X { + fun foo(t: T): String where T : A, T : B, T : C, T : D + fun foo(t: T): String where T : K, T : Inv, T : A? + fun foo(t: T): String where T : Inv>, T : Any +} + +class Y : X { + override fun foo(t: T): String where T : A, T : C, T : B, T : D = "1" + override fun foo(t: T): String where T : K, T : A?, T : Inv = "2" + override fun foo(t: T): String where T : Any, T : Inv> = "3" +} + +fun box(): String { + val abcd = object : A, B, C, D {} + val kab = object : K(), A, Inv {} + val iic = object : Inv> {} + val y = Y() + + if (y.foo(abcd) != "1") return "Fail 1" + if (y.foo(kab) != "2") return "Fail 2" + if (y.foo(iic) != "3") return "Fail 3" + + return "OK" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 7c8e1ba660d..53eb9bfbb16 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -18341,6 +18341,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("incorrectBytecodeWithEnhancedNullability.kt") public void testIncorrectBytecodeWithEnhancedNullability() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index ff01ef9b879..c1eafe72e3c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -19271,6 +19271,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index e95b8d394ac..caceb0a577d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -19271,6 +19271,24 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4c212fecdd4..1dbfbb232e4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16071,6 +16071,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/fir/flexibleStaticConstantFromJava.kt"); } + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @TestMetadata("getOnNullableTypeAlias.kt") public void testGetOnNullableTypeAlias() throws Exception { runTest("compiler/testData/codegen/box/fir/getOnNullableTypeAlias.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 73396c90155..adcfacf123a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -14297,6 +14297,24 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index dd2cdf2279a..3673933f590 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -14297,6 +14297,24 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index f89aa57b119..af52fd8db4c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -14297,6 +14297,24 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 343fe8cd27d..c13ceb43c82 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -14297,6 +14297,24 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index ba86d783bab..672b95e0c6b 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -15703,6 +15703,24 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index e2550f7c5e2..013b272605b 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -16075,6 +16075,24 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index 51c9d60ae2c..38c029908a7 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -15331,6 +15331,24 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 606c2156c7d..a70f195861b 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -15704,6 +15704,24 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 5a30176b857..21f570b0bf8 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -14273,6 +14273,24 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 00e5b9a215a..576e47680a3 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -14273,6 +14273,24 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); } + @Test + @TestMetadata("functionsDifferInTypeParameterBounds.kt") + public void testFunctionsDifferInTypeParameterBounds() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds2.kt") + public void testFunctionsDifferInTypeParameterBounds2() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds2.kt"); + } + + @Test + @TestMetadata("functionsDifferInTypeParameterBounds3.kt") + public void testFunctionsDifferInTypeParameterBounds3() throws Exception { + runTest("compiler/testData/codegen/box/fir/functionsDifferInTypeParameterBounds3.kt"); + } + @Test @TestMetadata("listAssignmentInWhen.kt") public void testListAssignmentInWhen() throws Exception {