diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt index 7bced7ad3e1..08310b5da60 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt @@ -50,7 +50,7 @@ protected constructor( private val propertyDescriptors: MemoizedFunctionToNotNull> = storageManager.createMemoizedFunction { doGetProperties(it) } private val typeAliasDescriptors: MemoizedFunctionToNotNull> = - storageManager.createMemoizedFunction { doGetTypeAliases(it) } + storageManager.createMemoizedFunction( { doGetTypeAliases(it) }, onRecursiveCall = { _,_ -> emptyList() }) private val declaredFunctionDescriptors: MemoizedFunctionToNotNull> = storageManager.createMemoizedFunction { getDeclaredFunctions(it) } diff --git a/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt new file mode 100644 index 00000000000..c2efd713d78 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt @@ -0,0 +1,3 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER + +typealias R> = List diff --git a/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.kt b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.kt new file mode 100644 index 00000000000..1733bf2eb6a --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.kt @@ -0,0 +1,3 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER + +typealias RList<R>> = List diff --git a/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.txt b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.txt new file mode 100644 index 00000000000..c30a61d8f3f --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.txt @@ -0,0 +1,3 @@ +package + +public typealias R> = kotlin.collections.List 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 fbb0cacf8f4..1e91b1800d0 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 @@ -28653,6 +28653,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasRHS.kt"); } + @Test + @TestMetadata("boundsViolationRecursive.kt") + public void testBoundsViolationRecursive() throws Exception { + runTest("compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.kt"); + } + @Test @TestMetadata("capturingTypeParametersFromOuterClass.kt") public void testCapturingTypeParametersFromOuterClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 5e40236383c..ca3fc1a16c8 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -28557,6 +28557,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasRHS.kt"); } + @Test + @TestMetadata("boundsViolationRecursive.kt") + public void testBoundsViolationRecursive() throws Exception { + runTest("compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.kt"); + } + @Test @TestMetadata("capturingTypeParametersFromOuterClass.kt") public void testCapturingTypeParametersFromOuterClass() throws Exception {