Skip to content

Commit 0f1c76f

Browse files
mglukhikhSpace Team
authored andcommitted
FIR2IR: fix exception during recursive lazy annotation constructor creation
This commit handles a situation with two very similar tests. The test 'recursiveTypeAnnotationWithVararg.kt' reproduces KT-80885 in 2.2.20 branch, but in master KT-80940 reproduces instead and KT-80885 is not reproducible even after this fix, so we count KT-80885 obsolete. KT-80940 itself is reproducible in 2.1+ only and is fixed by this commit. The idea of the fix is to cache constructor symbol in FIR2IR before we started to handle constructor parameters that can reference the same constructor in certain situations (like these tests). #KT-80940 Fixed #KT-80885 Obsolete
1 parent f9951f5 commit 0f1c76f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ class Fir2IrDeclarationStorage(
513513

514514
// caching of created constructor is not called here, because `callablesGenerator` calls `cacheIrConstructor` by itself
515515
val symbol = IrConstructorSymbolImpl()
516+
cacheIrConstructorSymbol(constructor, symbol)
516517
if (potentiallyExternal) {
517518
val irParent = findIrParent(constructor, fakeOverrideOwnerLookupTag = null)
518519
if (irParent.isExternalParent()) {
@@ -527,7 +528,6 @@ class Fir2IrDeclarationStorage(
527528
}
528529
}
529530
}
530-
cacheIrConstructorSymbol(constructor, symbol)
531531

532532
return symbol
533533
}

compiler/testData/diagnostics/testsWithStdLib/annotations/recursiveTypeAnnotation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN_PIPELINE_TILL: FIR2IR
1+
// RUN_PIPELINE_TILL: BACKEND
22
// FIR_IDENTICAL
33
// ISSUE: KT-80940
44

compiler/testData/diagnostics/testsWithStdLib/annotations/recursiveTypeAnnotationWithVararg.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN_PIPELINE_TILL: FIR2IR
1+
// RUN_PIPELINE_TILL: BACKEND
22
// FIR_IDENTICAL
33
// ISSUE: KT-80885, KT-80940
44

0 commit comments

Comments
 (0)