The root cause of the problem is that we visit class annotations more
accurately than in the regular compiler transformer, so we have
a difference: the compiler assumes that annotation processing
of the class is called already inside this class, so it should enable
CLASS_HEADER_ANNOTATIONS mode to not capture extra context.
But we in LL FIR do this out of the class, so such context switching
is redundant and results in cutting out the outer class context
^KT-62587 Fixed
This call is redundant for annotation transformers because
they are override withRegularClass and add this call there,
so, as result, we have a class duplication in
containingClassDeclarations
^KT-62587
StubBasedBuiltInsSymbolProvider does not work for now for common modules (KT-61757)
but compiler builtins provider `FirBuiltinSymbolProvider` works.
Also, stub-based symbol providers should not be used in standalone mode.
Testdata from standalone is updated because of the difference
in property accessors (KT-62449) between stub and compiler builtin symbol providers.
Additionally, this commit fixes the behavior of `KotlinStaticPsiDeclarationFromBinaryModuleProvider`.
As compiler builtin declarations have no PSI attached,
`KotlinStaticPsiDeclarationFromBinaryModuleProvider` is used to get PSI
from `DecompiledPsiDeclarationProvider.findPsi`.
`DecompiledPsiDeclarationProvider` is only used in UAST standalone mode.
Previously, creating a declaration with Fir2IrCallableDeclarationsGenerator/
Fir2IrClassifiersGenerator didn't guarantee that this declaration will
be actually added to the list of parent class/file declarations, which
lead to situations when FIR2IR created some declarations in the air
(mostly fake-overrides)
It is needed to have an ability to distinguish those two cases in FIR2IR:
Without this change the following tests fail:
- org.jetbrains.kotlin.test.runners.codegen.FirPsiBlackBoxCodegenTestGenerated.Enum
- testEnumEntryReferenceFromInnerClassConstructor1()
- testEnumEntryReferenceFromInnerClassConstructor2()
- testEnumEntryReferenceFromInnerClassConstructor3()
- testInnerClassMethodInEnumEntryClass()
- testInnerClassMethodInEnumEntryClass2()
- testKt9711_2()
- testDeepInnerClassInEnumEntryClass()
- testKt7257_boundReference1()
- testInnerClassInEnumEntryClass()
- testKt44744_innerClass()
For reasoning refer to the message of the previous commit
It is the same as for `getIrFunctionSymbol`
There is one failing test here, caused by KT-61941
The issue was here before this commit, but it was hidden
It's incorrect to create fake-overrides with `getOrCreateIrFunction/Property`
call. FakeOverrideGenerator should be used instead. So this commit
just changes the place which creates static f/o generated from
I failed to reproduce the corresponding failure in compiler tests, but
without this change FP Kotlin test fails
Previously `getIrFunctionSymbol` effectively did the same thing as `getOrCreateIrFunction`,
but in a slightly different way. To avoid logic duplication and source of
potential inconsistencies, implementation was changed to just delegate to
`getOrCreateIrFunction`
Changes in `computeIrOrigin` were required because origin for callables in
`getOrCreateIrFunction` and `getIrFunctionSymbol` was computed differently,
so `computeIrOrigin` was changed to preserve existing behavior
^KT-60924
This change is intended to improve the intuition of developers.
After adding the two functions, many times developers (me) have
tried to use the 'wrong' (which is now the new name) function name.
KT-61634
https://youtrack.jetbrains.com/issue/KT-59916/K2-Disappeared-REPEATEDANNOTATION
FirAnnotationChecker does not detect repeated annotation on dynamic type, since FirTypeResolverImpl wrongly did not convert source annotations to attributes of ConeDynamicType.
This MR improves FirTypeResolverImpl to convert attributes of FirDynamicTypeRef to annotations and attach them to ConeDynamicType.
Merge-request: KT-MR-12551
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>