Commit Graph

42683 Commits

Author SHA1 Message Date
Egor Kulikov e810142d74 [FIR] Use AST nodes only for lambda parameter names
Eighth step for ^KT-52615

Merge-request: KT-MR-8700
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-02-08 10:47:15 +00:00
Denis.Zharkov 1898dfd40d K2: Rework RedundantVisibilityModifierSyntaxChecker::implicitVisibility
Avoid assumption there, that for accessors we have a containing property
in the context

This necessary as a part of getting rid context modifications in checkers
2023-02-08 10:22:42 +00:00
Denis.Zharkov 2cd6b8253f K2: Simplify condition in RedundantVisibilityModifierSyntaxChecker
element !is FirMemberDeclaration means that
`isAccessorWithSameVisibility == false` because
`FirPropertyAccessor <: FirMemberDeclaration`

Also, remove a function became unused
2023-02-08 10:22:42 +00:00
Dmitriy Novozhilov a967a242c7 [FIR] Allows use DSL for building FIR declarations from any FirExtension 2023-02-08 08:44:50 +00:00
Dmitriy Novozhilov 1248ee12d6 [FIR] Add ability to provide additional synthetic declarations to metadata from plugins
^KT-55885 Fixed
2023-02-08 08:44:49 +00:00
Dmitriy Novozhilov 8350226bad [FIR] Collect constructors from scope instead of .declarations in metadata serialization
This is needed to save in metadata constructors, generated by plugins
  with FirDeclarationGenerationExtension
2023-02-08 08:44:49 +00:00
Igor Chevdar 12d0b1e846 [K/N][codegen] Fixed wrong arguments evaluation order for IrSetField
#KT-56326 Fixed
2023-02-08 06:56:09 +00:00
Vladimir Dolzhenko b04b3d389f Add ability for DeclarationDescriptor validation
Not fully initialized DeclarationDescriptor could leak to bindingTrace.
It is hard to detect the outcome of that kind of leakage due to
possibility to have not fully initialized instances if PCE happens in
the middle of publication and instance full initialization.

#KT-56364
#KT-56388
#KT-54085
#KT-55150
2023-02-07 17:40:42 +00:00
Vladimir Dolzhenko a049fda75b Create SimpleFunctionDescriptorImpl under nonCancelableSection
SimpleFunctionDescriptorImpl initialization consists of two phases:
ctor + initialize.
When SimpleFunctionDescriptorImpl is created wrapped descriptor
(e.g. ValueParameterDescriptorImpl) is leaked through bindingTrace
with not fully initialized `containingDeclaration` (that is
SimpleFunctionDescriptorImpl).
If PCE happens after this unsafe publication prior to `initialize` then
it will be case with NPE on fully initialized instance reading.

#KT-56364 Fixed
2023-02-07 17:40:41 +00:00
Vladimir Dolzhenko 9be4aa2e02 Create PropertyDescriptorImpl under nonCancelableSection
PropertyDescriptorImpl initialization consists of two phases:
ctor + setType.
When PropertyDescriptorImpl is created wrapped descriptor
(e.g. WithDestructuringDeclaration) is leaked through bindingTrace
with not fully initialized `containingDeclaration` (that is
PropertyDescriptorImpl).
If PCE happens after this unsafe publication prior to `setType` then it
will be case with NPE on fully initialized instance reading.

#KT-56388 Fixed
2023-02-07 17:40:41 +00:00
Alexander.Likhachev 06fb658887 [Build] Remove remaining obsolete files of the new daemon
KT-50846 Related
2023-02-07 14:45:35 +00:00
Ivan Kochurkin 8cbb6ff47a [FIR2IR] Use convertToIrAndActualize() for JS CLI 2023-02-07 14:16:31 +00:00
Svyatoslav Scherbina cf4934f539 [FIR2IR] Make convertToIrAndActualize() more reusable across backends 2023-02-07 14:16:30 +00:00
Ivan Kochurkin 199b0e8cbe [FIR] Minor: Unify all create*Session functions across all factories
Rename: createJsLibrarySession -> createLibrarySession

Rename: createJsModuleBasedSession -> createModuleBasedSession
2023-02-07 14:16:30 +00:00
Ivan Kochurkin a9bac2f18b Add PackageAndMetadataPartProvider interface
Use it for parameter in MetadataSymbolProvider
2023-02-07 14:16:29 +00:00
Ivan Kochurkin f3e3cc0037 [FIR] Implement support of MPP in JS CLI 2023-02-07 14:16:29 +00:00
Ivan Kochurkin d401ff7b09 [FIR & IR] Implement JS MPP test infrastructure
^KT-55295 Fixed
2023-02-07 14:16:29 +00:00
Ilmir Usmanov e42efe1ee6 JVM IR: Ignore class type parameters if function is static
Otherwise, it leads to type parameters duplication in case of
suspendImpls, since they inherit type parameters from containing class.

 #KT-56407: Fixed
2023-02-07 13:39:25 +00:00
Ilmir Usmanov c7bc439661 JVM IR: Remove usages of PSI in coroutines codegen
Instead, use IR based reporter.
2023-02-07 13:12:19 +00:00
Dmitriy Novozhilov dfeabea0ab [Test] Skip tests with IGNORE_BACKEND_K1 directive in android runner 2023-02-07 09:49:21 +00:00
Dmitriy Novozhilov a0bdecd22b [Test] Ignore Native codegen test with IGNORE_BACKEND_...: ANY directive 2023-02-07 09:49:20 +00:00
Dmitriy Novozhilov ae7718514b [Test] Don't run LightAnalysisModeTest in presence IGNORE_BACKEND_K1 directive 2023-02-07 09:49:20 +00:00
Dmitriy Novozhilov 075e025452 [FIR2IR] Properly generate GetObject expression for callable reference on companion object
^KT-55909 Fixed
2023-02-07 09:49:20 +00:00
Alexander Udalov 1844869e8a Kapt+JVM_IR: fix ordering of properties in generated stubs
Apparently it depended on the ordering of the synthetic `$annotations`
methods generated for properties. And those methods were always
generated at the end of a Java stub by kapt because they lacked PSI
element, and thus `ClassFileToSourceStubConverter.convertClass` could
not compute their source position, and it placed them at the end as all
other synthetic methods.

The solution is to provide PSI element for `$annotations` methods in
JvmDeclarationOrigin. This origin is then collected in kapt in
`OriginCollectingClassBuilderFactory` and used for sorting, as in the
case of the old JVM backend.

 #KT-56360 Fixed
2023-02-06 21:34:10 +00:00
Kirill Rakhman e232cc92f9 [FIR] Eliminate ClassId.isSame call from FirClass.isSubclassOf
^KT-55664 Fixed
2023-02-06 17:51:32 +00:00
Dmitrii Gridin 6c24436657 [SLC] make INSTANCE field for object public
^KT-56441 Fixed
2023-02-06 17:48:37 +00:00
Dmitrii Gridin 8e815e943e [SLC] add tests on private object
^KT-56441
2023-02-06 17:48:37 +00:00
Dmitrii Gridin fa231f60ae [LC] rename testData for objects
^KT-56441
2023-02-06 17:48:37 +00:00
Dmitrii Gridin bd7e5fd324 [LC] update testData for objects
^KTIJ-24119
2023-02-06 17:48:36 +00:00
Vladimir Sukharev e75d739c7a Add tests for property const initializers
Merge-request: KT-MR-8661
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-06 15:43:41 +00:00
Oleksandr Karpovich dec9704cea Add more methods to DescriptorSerializerPlugin
New methods:
afterFunction, afterConstructor, afterProperty, afterTypealias
2023-02-06 11:15:53 +00:00
aleksandrina-streltsova 7db32f6430 [FIR] Fix unexpected primary constructor scope in secondary constructor
^KTIJ-23720
^KT-56353 Fixed
2023-02-06 10:30:28 +00:00
Dmitriy Novozhilov c25a5bc9c1 [FIR] Cleanup storing context for lambdas during body resolution 2023-02-06 10:08:37 +00:00
Dmitriy Novozhilov 791a7b1c31 [FIR] Extract function type kind for lambda in argument position
^KT-56381 Fixed
2023-02-06 10:08:37 +00:00
Dmitriy Novozhilov e36d3c94a5 [FIR] Add containingFunctionSymbol property to FirValueParameterSymbol 2023-02-06 10:08:36 +00:00
Dmitriy Novozhilov f479a56f5e [FIR] Fix reporting of CANNOT_INFER_PARAMETER_TYPE on lambda parameters
^KT-56138 Fixed
2023-02-06 08:09:57 +00:00
Dmitriy Novozhilov 76d360d793 [FIR] Properly set source for inferred return type of function 2023-02-06 08:09:56 +00:00
Dmitriy Novozhilov e9204521a9 [FIR] Properly create type ref for error type in various places 2023-02-06 08:09:56 +00:00
Dmitriy Novozhilov ad3ae0ff69 [FIR] Add ability to specify that diagnostic collector should visit nodes with specific fake kind 2023-02-06 08:09:55 +00:00
Anna Kozlova f784628ebf [CLI] reduce memory usage for compiler settings
make write protection directly in properties
it creates no additional wrapper with the link to the containing class
for ij project, this reduces memory usage for ~15 mb

^KT-56351
2023-02-06 07:57:53 +00:00
Vladimir Sukharev 441c74e2c8 Unmute test, fixed by KT-55462
Merge-request: KT-MR-8640
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-05 16:37:13 +00:00
Dmitrii Gridin 0608e44b17 [SLC] drop redundant testData
after 6fd79f4e2e

^KTIJ-24067
2023-02-03 19:49:16 +00:00
Dmitrii Gridin fb8e4e7c8d [FIR] FirBasedSymbol: add more info to kdoc
^KT-56046
2023-02-03 19:49:16 +00:00
Dmitrii Gridin 2c96933f5c [FIR] FirBasedSymbol: drop unused functions
^KT-56046
2023-02-03 19:49:15 +00:00
Dmitrii Gridin cc7527a5bc [FIR] CompilerRequiredAnnotationsHelper: update kdoc and drop commented values
^KT-56046
2023-02-03 19:49:15 +00:00
Dmitrii Gridin 38575cdbc1 [FIR] FirBasedSymbol: iterate annotations by index instead of iterator to avoid possible ConcurrentModificationException
^KT-56046
2023-02-03 19:49:05 +00:00
Dmitrii Gridin 09637a47d3 [SLC] update testData for 1.9 language
^KT-56046
2023-02-03 19:49:05 +00:00
Dmitrii Gridin 3b9318bd3a [SLC] LazyAnnotationsBox: drop redundant synchronization
We can use less strict rule for produced annotations:
* Previously: the same annotations from `findAnnotation` and `annotations`
have the same identity
* Now: the same annotations from `findAnnotation` and `annotations`
are equals by 'equals'

^KT-56046
2023-02-03 19:49:03 +00:00
Dmitrii Gridin e1c8b3d674 [SLC] avoid return type check for implicit types
we should avoid value class check in implicit return types
to avoid extra resolve

^KT-56046
^KT-55788
2023-02-03 19:49:03 +00:00
Dmitrii Gridin e021655001 [LC] AbstractCompilerLightClassTest: add an additional test extension
^KT-56046
2023-02-03 19:49:02 +00:00