diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 98b9946b7bd..3dfa331f303 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -30478,12 +30478,6 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/resolve/capturedTypesInLambdaParameter.kt"); } - @Test - @TestMetadata("companionPropertyAndTypeParameter.kt") - public void testCompanionPropertyAndTypeParameter() throws Exception { - runTest("compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt"); - } - @Test @TestMetadata("constructorVsCompanion.kt") public void testConstructorVsCompanion() throws Exception { @@ -37374,6 +37368,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/typeParameters/cannotHaveManyClassUpperBounds.kt"); } + @Test + @TestMetadata("companionPropertyAndTypeParameter.kt") + public void testCompanionPropertyAndTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt"); + } + + @Test + @TestMetadata("companionPropertyAndTypeParameter2.kt") + public void testCompanionPropertyAndTypeParameter2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt"); + } + @Test @TestMetadata("deprecatedSyntax.kt") public void testDeprecatedSyntax() throws Exception { @@ -37482,6 +37488,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass2.kt") + public void testMemberTypeParameterVsNestedClass2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt"); + } + + @Test + @TestMetadata("memberTypeParameterVsNestedClassReference.kt") + public void testMemberTypeParameterVsNestedClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index f07ab0a146d..d43659729f2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -30478,12 +30478,6 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/resolve/capturedTypesInLambdaParameter.kt"); } - @Test - @TestMetadata("companionPropertyAndTypeParameter.kt") - public void testCompanionPropertyAndTypeParameter() throws Exception { - runTest("compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt"); - } - @Test @TestMetadata("constructorVsCompanion.kt") public void testConstructorVsCompanion() throws Exception { @@ -37374,6 +37368,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/typeParameters/cannotHaveManyClassUpperBounds.kt"); } + @Test + @TestMetadata("companionPropertyAndTypeParameter.kt") + public void testCompanionPropertyAndTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt"); + } + + @Test + @TestMetadata("companionPropertyAndTypeParameter2.kt") + public void testCompanionPropertyAndTypeParameter2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt"); + } + @Test @TestMetadata("deprecatedSyntax.kt") public void testDeprecatedSyntax() throws Exception { @@ -37482,6 +37488,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass2.kt") + public void testMemberTypeParameterVsNestedClass2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt"); + } + + @Test + @TestMetadata("memberTypeParameterVsNestedClassReference.kt") + public void testMemberTypeParameterVsNestedClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 527cfb32149..995e81f92c5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -28460,12 +28460,6 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/resolve/capturedTypesInLambdaParameter.kt"); } - @Test - @TestMetadata("companionPropertyAndTypeParameter.kt") - public void testCompanionPropertyAndTypeParameter() throws Exception { - runTest("compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt"); - } - @Test @TestMetadata("constructorVsCompanion.kt") public void testConstructorVsCompanion() throws Exception { @@ -35248,6 +35242,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/typeParameters/cannotHaveManyClassUpperBounds.kt"); } + @Test + @TestMetadata("companionPropertyAndTypeParameter.kt") + public void testCompanionPropertyAndTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt"); + } + + @Test + @TestMetadata("companionPropertyAndTypeParameter2.kt") + public void testCompanionPropertyAndTypeParameter2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt"); + } + @Test @TestMetadata("deprecatedSyntax.kt") public void testDeprecatedSyntax() throws Exception { @@ -35356,6 +35362,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass2.kt") + public void testMemberTypeParameterVsNestedClass2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt"); + } + + @Test + @TestMetadata("memberTypeParameterVsNestedClassReference.kt") + public void testMemberTypeParameterVsNestedClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 24cc88636ee..1bb84d8a0f0 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -28472,12 +28472,6 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/resolve/capturedTypesInLambdaParameter.kt"); } - @Test - @TestMetadata("companionPropertyAndTypeParameter.kt") - public void testCompanionPropertyAndTypeParameter() throws Exception { - runTest("compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt"); - } - @Test @TestMetadata("constructorVsCompanion.kt") public void testConstructorVsCompanion() throws Exception { @@ -35368,6 +35362,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/typeParameters/cannotHaveManyClassUpperBounds.kt"); } + @Test + @TestMetadata("companionPropertyAndTypeParameter.kt") + public void testCompanionPropertyAndTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt"); + } + + @Test + @TestMetadata("companionPropertyAndTypeParameter2.kt") + public void testCompanionPropertyAndTypeParameter2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt"); + } + @Test @TestMetadata("deprecatedSyntax.kt") public void testDeprecatedSyntax() throws Exception { @@ -35476,6 +35482,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass2.kt") + public void testMemberTypeParameterVsNestedClass2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt"); + } + + @Test + @TestMetadata("memberTypeParameterVsNestedClassReference.kt") + public void testMemberTypeParameterVsNestedClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { diff --git a/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.fir.txt b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.fir.txt new file mode 100644 index 00000000000..d8819f428fe --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.fir.txt @@ -0,0 +1,101 @@ +FILE: companionPropertyAndTypeParameter.kt + public open class Base : R|kotlin/Any| { + public constructor(any: R|kotlin/Any|): R|Base| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|Base.Companion| { + super() + } + + public final val test: R|kotlin/Long| = Long(42) + public get(): R|kotlin/Long| + + } + + } + public final class C1 : R|Base| { + public constructor(): R|C1| { + super(this@R|/C1.Companion|.R|/C1.Companion.test|) + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|C1.Companion| { + super() + } + + public final val test: R|kotlin/Int| = Int(12) + public get(): R|kotlin/Int| + + public final val some: R|kotlin/Int| = this@R|/C1.Companion|.R|/C1.Companion.test| + public get(): R|kotlin/Int| + + } + + public final val test: R|kotlin/String| = String() + public get(): R|kotlin/String| + + public final val some: R|kotlin/String| = this@R|/C1|.R|/C1.test| + public get(): R|kotlin/String| + + public final fun f(): R|kotlin/Unit| { + lval test: R|kotlin/Double| = Double(1.0) + lval some: R|kotlin/Double| = R|/test| + } + + } + public final class C2 : R|Base| { + public constructor(): R|C2| { + super(this@R|/C2.Companion|.R|/C2.Companion.test|) + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|C2.Companion| { + super() + } + + public final val test: R|kotlin/Int| = Int(12) + public get(): R|kotlin/Int| + + public final val some: R|kotlin/Int| = this@R|/C2.Companion|.R|/C2.Companion.test| + public get(): R|kotlin/Int| + + } + + public final val some: R|kotlin/Int| = this@R|/C2.Companion|.R|/C2.Companion.test| + public get(): R|kotlin/Int| + + public final fun f(): R|kotlin/Unit| { + lval test: R|kotlin/Double| = Double(1.0) + lval some: R|kotlin/Double| = R|/test| + } + + } + public final class C3 : R|Base| { + public constructor(): R|C3| { + super(this@R|/Base.Companion|.R|/Base.Companion.test|) + } + + public final val some: R|kotlin/Long| = this@R|/Base.Companion|.R|/Base.Companion.test| + public get(): R|kotlin/Long| + + public final fun f(): R|kotlin/Unit| { + lval test: R|kotlin/Double| = Double(1.0) + lval some: R|kotlin/Double| = R|/test| + } + + } + public final class C4 : R|kotlin/Any| { + public constructor(): R|C4| { + super() + } + + public final val some: = R|?| + public get(): + + public final fun f(): R|kotlin/Unit| { + lval some: = R|?| + } + + } diff --git a/compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt similarity index 97% rename from compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt rename to compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt index a10a08391e3..ff4c4ba3eb2 100644 --- a/compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt @@ -1,4 +1,6 @@ // FIR_IDENTICAL +// ISSUE: KT-58028 +// FIR_DUMP // DIAGNOSTICS: -UNUSED_VARIABLE open class Base(any: Any) { diff --git a/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.kt new file mode 100644 index 00000000000..ee672a244d3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.kt @@ -0,0 +1,16 @@ +// ISSUE: KT-58028, KT-63377 +// FIR_DUMP + +class Owner { + companion object { + val test = 12 + } + + inner class I { + val some = test + + fun foo() { + val some = test + } + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.txt b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.txt new file mode 100644 index 00000000000..1853c5c804e --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.fir.txt @@ -0,0 +1,31 @@ +FILE: companionPropertyAndTypeParameter2.fir.kt + public final class Owner : R|kotlin/Any| { + public constructor(): R|Owner| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|Owner.Companion| { + super() + } + + public final val test: R|kotlin/Int| = Int(12) + public get(): R|kotlin/Int| + + } + + public final inner class I : R|kotlin/Any| { + public Owner.constructor(): R|Owner.I| { + super() + } + + public final val some: = R|?| + public get(): + + public final fun foo(): R|kotlin/Unit| { + lval some: = R|?| + } + + } + + } diff --git a/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt new file mode 100644 index 00000000000..7308a498dd6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt @@ -0,0 +1,16 @@ +// ISSUE: KT-58028, KT-63377 +// FIR_DUMP + +class Owner { + companion object { + val test = 12 + } + + inner class I { + val some = test + + fun foo() { + val some = test + } + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.kt new file mode 100644 index 00000000000..2cf41379d2b --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.kt @@ -0,0 +1,28 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class Outer { + class T + + inline fun foo() { + T::class + val x: T? = null + val y: T? = T() + } + + fun bar() { + T::class + val x: T? = null + val y: T? = T() + } +} + +class Owner { + class T + + fun baz() { + T::class + val x: T? = null + val y: T? = T() + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.txt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.txt new file mode 100644 index 00000000000..2588ef932e3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.fir.txt @@ -0,0 +1,45 @@ +FILE: memberTypeParameterVsNestedClass2.fir.kt + public final class Outer : R|kotlin/Any| { + public constructor(): R|Outer| { + super() + } + + public final class T : R|kotlin/Any| { + public constructor(): R|Outer.T| { + super() + } + + } + + public final inline fun foo(): R|kotlin/Unit| { + (R|T|) + lval x: R|T?| = Null(null) + lval y: R|T?| = R|/Outer.T.T#|() + } + + public final fun bar(): R|kotlin/Unit| { + (R|?|) + lval x: R|T?| = Null(null) + lval y: R|T?| = R|/Outer.T.T#|() + } + + } + public final class Owner : R|kotlin/Any| { + public constructor(): R|Owner| { + super() + } + + public final class T : R|kotlin/Any| { + public constructor(): R|Owner.T| { + super() + } + + } + + public final fun baz(): R|kotlin/Unit| { + (R|?|) + lval x: R|Owner.T?| = Null(null) + lval y: R|Owner.T?| = R|/Owner.T.T|() + } + + } diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt new file mode 100644 index 00000000000..ae088595364 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt @@ -0,0 +1,28 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class Outer { + class T + + inline fun foo() { + T::class + val x: T? = null + val y: T? = T() + } + + fun bar() { + T::class + val x: T? = null + val y: T? = T() + } +} + +class Owner { + class T + + fun baz() { + T::class + val x: T? = null + val y: T? = T() + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.kt new file mode 100644 index 00000000000..04a1b76e065 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.kt @@ -0,0 +1,54 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class OuterClassWithObject { + object OuterParam { + fun foo() {} + } + + val k = ::OuterParam + val l = OuterParam::foo + + fun foo() { + val k = ::OuterParam + val l = OuterParam::foo + } + + inner class Inner(t: NestedParam) { + val k = ::OuterParam + val l = OuterParam::foo + + init { + val k = ::OuterParam + val l = OuterParam::foo + } + } +} + +class OuterClassWithClass { + class OuterParam { + fun foo() {} + } + + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + + fun foo() { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + } + + inner class Inner(t: NestedParam) { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + + init { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + } + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.txt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.txt new file mode 100644 index 00000000000..dd1d1e42c13 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.fir.txt @@ -0,0 +1,99 @@ +FILE: memberTypeParameterVsNestedClassReference.fir.kt + public final class OuterClassWithObject : R|kotlin/Any| { + public constructor(): R|OuterClassWithObject| { + super() + } + + public final object OuterParam : R|kotlin/Any| { + private constructor(): R|OuterClassWithObject.OuterParam| { + super() + } + + public final fun foo(): R|kotlin/Unit| { + } + + } + + public final val k: = ::# + public get(): + + public final val l: R|kotlin/reflect/KFunction0| = Q|OuterClassWithObject.OuterParam|::R|/OuterClassWithObject.OuterParam.foo| + public get(): R|kotlin/reflect/KFunction0| + + public final fun foo(): R|kotlin/Unit| { + lval k: = ::# + lval l: R|kotlin/reflect/KFunction0| = Q|OuterClassWithObject.OuterParam|::R|/OuterClassWithObject.OuterParam.foo| + } + + public final inner class Inner : R|kotlin/Any| { + public OuterClassWithObject.constructor(t: R|NestedParam|): R|OuterClassWithObject.Inner| { + super() + } + + public final val k: = ::# + public get(): + + public final val l: R|kotlin/reflect/KFunction0| = Q|OuterClassWithObject.OuterParam|::R|/OuterClassWithObject.OuterParam.foo| + public get(): R|kotlin/reflect/KFunction0| + + init { + lval k: = ::# + lval l: R|kotlin/reflect/KFunction0| = Q|OuterClassWithObject.OuterParam|::R|/OuterClassWithObject.OuterParam.foo| + } + + } + + } + public final class OuterClassWithClass : R|kotlin/Any| { + public constructor(): R|OuterClassWithClass| { + super() + } + + public final class OuterParam : R|kotlin/Any| { + public constructor(): R|OuterClassWithClass.OuterParam| { + super() + } + + public final fun foo(): R|kotlin/Unit| { + } + + } + + public final val k: R|kotlin/reflect/KFunction0| = ::R|/OuterClassWithClass.OuterParam.OuterParam| + public get(): R|kotlin/reflect/KFunction0| + + public final val l: = R|?|::# + public get(): + + public final val m: R|kotlin/reflect/KFunction0| = R|/OuterClassWithClass.OuterParam.OuterParam|()::R|/OuterClassWithClass.OuterParam.foo| + public get(): R|kotlin/reflect/KFunction0| + + public final fun foo(): R|kotlin/Unit| { + lval k: R|kotlin/reflect/KFunction0| = ::R|/OuterClassWithClass.OuterParam.OuterParam| + lval l: = R|?|::# + lval m: R|kotlin/reflect/KFunction0| = R|/OuterClassWithClass.OuterParam.OuterParam|()::R|/OuterClassWithClass.OuterParam.foo| + } + + public final inner class Inner : R|kotlin/Any| { + public OuterClassWithClass.constructor(t: R|NestedParam|): R|OuterClassWithClass.Inner| { + super() + } + + public final val k: R|kotlin/reflect/KFunction0| = ::R|/OuterClassWithClass.OuterParam.OuterParam| + public get(): R|kotlin/reflect/KFunction0| + + public final val l: = R|?|::# + public get(): + + public final val m: R|kotlin/reflect/KFunction0| = R|/OuterClassWithClass.OuterParam.OuterParam|()::R|/OuterClassWithClass.OuterParam.foo| + public get(): R|kotlin/reflect/KFunction0| + + init { + lval k: R|kotlin/reflect/KFunction0| = ::R|/OuterClassWithClass.OuterParam.OuterParam| + lval l: = R|?|::# + lval m: R|kotlin/reflect/KFunction0| = R|/OuterClassWithClass.OuterParam.OuterParam|()::R|/OuterClassWithClass.OuterParam.foo| + } + + } + + } diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt new file mode 100644 index 00000000000..4e6551685d1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt @@ -0,0 +1,54 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class OuterClassWithObject { + object OuterParam { + fun foo() {} + } + + val k = ::OuterParam + val l = OuterParam::foo + + fun foo() { + val k = ::OuterParam + val l = OuterParam::foo + } + + inner class Inner(t: NestedParam) { + val k = ::OuterParam + val l = OuterParam::foo + + init { + val k = ::OuterParam + val l = OuterParam::foo + } + } +} + +class OuterClassWithClass { + class OuterParam { + fun foo() {} + } + + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + + fun foo() { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + } + + inner class Inner(t: NestedParam) { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + + init { + val k = ::OuterParam + val l = OuterParam::foo + val m = OuterParam()::foo + } + } +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 5b43f84a2cb..5abb15d0269 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -30478,12 +30478,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/resolve/capturedTypesInLambdaParameter.kt"); } - @Test - @TestMetadata("companionPropertyAndTypeParameter.kt") - public void testCompanionPropertyAndTypeParameter() throws Exception { - runTest("compiler/testData/diagnostics/tests/resolve/companionPropertyAndTypeParameter.kt"); - } - @Test @TestMetadata("constructorVsCompanion.kt") public void testConstructorVsCompanion() throws Exception { @@ -37374,6 +37368,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/typeParameters/cannotHaveManyClassUpperBounds.kt"); } + @Test + @TestMetadata("companionPropertyAndTypeParameter.kt") + public void testCompanionPropertyAndTypeParameter() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter.kt"); + } + + @Test + @TestMetadata("companionPropertyAndTypeParameter2.kt") + public void testCompanionPropertyAndTypeParameter2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/companionPropertyAndTypeParameter2.kt"); + } + @Test @TestMetadata("deprecatedSyntax.kt") public void testDeprecatedSyntax() throws Exception { @@ -37482,6 +37488,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass2.kt") + public void testMemberTypeParameterVsNestedClass2() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass2.kt"); + } + + @Test + @TestMetadata("memberTypeParameterVsNestedClassReference.kt") + public void testMemberTypeParameterVsNestedClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClassReference.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception {