Commit Graph

1804 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00
Dmitriy Novozhilov 4bddb27ca3 [FIR] Get rid of candidateSymbol in FirNamedReference
`candidateSymbol` has any reasonable meaning only for references with
  not completed candidate, so this property is moved from FirNamedReference
  to new node FirNamedReferenceWithCandidateSymbol, which has real
  implementation only in :resolve module (`FirNamedReferenceWithCandidate`)
2022-12-20 08:12:07 +00:00
Artem Vasilev 1e1f96f73e [LL FIR] fix more possible NPEs at lock access
Depending on the execution, some accesses to lock could cause NPE.
The best solution we've found so far is to make lock volatile, so that
reads between lock and value are consistent between threads.
It requires further work to determine if we can have one volatile field.
2022-12-16 17:56:49 +00:00
Artem Vasilev 04924dbfed [LL FIR] replace guard with ReentrantLock.holdCount
Previously, there was a guard variable that prevented recursive
locks. It can be replaced with lock.holdCount check.
2022-12-16 17:56:49 +00:00
Artem Vasilev 879f6c3432 [LL FIR] restructure lock assertion to prevent NPEs
When the other thread has already computed the value and cleared the
lock, the other thread could still enter the computeValueWithoutLock()
and see lock == null
2022-12-16 17:56:49 +00:00
Ilya Kirillov 561df74419 [kotlin] fix NPE from lockWithPCECheck when action lambda returns a nullable value 2022-12-16 17:17:13 +01:00
Anna Kozlova a529f8510d [LL] ensure FirConstExpression's annotations are not lost (KTIJ-23968) 2022-12-15 14:31:48 +00:00
Dmitriy Novozhilov 7334694fd9 [FIR] Remove some rare used utilities 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov b53c4a6353 [FIR] Introduce some typed FirReference.toResolvedXXXSymbol utilities 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov cffc32ec76 [FIR] Fir utils for FirReference in package org.jetbrains.kotlin.fir.references 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov b174bb8844 [FIR] Update testdata after introducing FirResolvedErrorReference 2022-12-15 12:12:19 +00:00
Dmitriy Novozhilov dde64c10ea [FIR] Create FirResolvedErrorReference for error reference with single candidate
Note that this reference won't be created for hidden candidates,
  because they are designed to be truly invisible from the user side
2022-12-15 12:12:19 +00:00
Mikhail Glukhikh b271b409c7 Fix final -> open modality in new test data after 2022-12-14 23:19:37 +01:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Ilya Kirillov 68a17242b3 [FIR] fix NPE on missing java annotations qualifier
^KTIJ-23075 fixed
2022-12-14 09:58:07 +00:00
Ilya Kirillov 8b88315a69 [LL FIR] do not allocate lambda for the ValueWithPostCompute.guard
to reduce a memory consumption for a little

ValueWithPostCompute are created very often
2022-12-14 08:33:07 +00:00
Ilya Kirillov 2bb3b41348 [LL FIR] clear implementation details in ValueWithPostCompute after the value is computed
to save some memory
2022-12-14 08:33:07 +00:00
Ilya Kirillov f9298d8e85 [LL FIR] try to check for PCE in ValueWithPostCompute to avoid possible deadlocks 2022-12-14 08:33:06 +00:00
Ilya Kirillov de7383ff15 [LL FIR] check for PCE after acquiring the lock for resolve
To the moment we acquire the lock, the computation might not be needed
2022-12-14 08:33:06 +00:00
Ilya Kirillov c80221afd3 [LL FIR] always use lockWithPCECheck for resolve to check possible PCE 2022-12-14 08:33:06 +00:00
Ilya Kirillov d7ee312b83 [Analysis API] do not rethrow java.lang.Error
Errors as OutOfMemoryError should not be caught or wrapped
2022-12-14 08:33:05 +00:00
Ilya Kirillov 9cf77e19be [LL FIR] fix memory leak from LLFirSessionProvider for the module
LLFirSessionProvider stores all transitive module dependencies,
even if they are not needed or already invalidated and garbage collected

Now, the dependencies are stored on the weak references, and so then nobody uses them, they will be garbage collected
2022-12-14 08:33:05 +00:00
Dmitrii Gridin 34e4645385 [ULC] avoid resolve from KtUltraLightClassModifierList.hasModifierProperty in most cases
^KT-55445 Fixed
2022-12-13 18:18:00 +00:00
Dmitrii Gridin cebccee4be [SLC] add inheritors testData for facade class 2022-12-13 16:54:26 +00:00
Dmitrii Gridin 66dc7a3168 [SLC] make inheritors testData more human-readable 2022-12-13 16:54:26 +00:00
Dmitrii Gridin 69d308edac [SLC] change 'inh.txt' extension to 'inheritors.txt' for tests 2022-12-13 16:54:25 +00:00
Dmitrii Gridin aa625ffb0d [SLC] implement 'isInheritor' for 'DefaultImpls'
^KT-55442 Fixed
2022-12-13 16:54:25 +00:00
Dmitrii Gridin b2c0a37050 [SLC] implement infrastructure for light class hierarchy tests 2022-12-13 16:54:25 +00:00
Dmitrii Gridin feff03894f [SLC] fix testData dir name 2022-12-13 16:54:24 +00:00
Ilya Kirillov 573811a199 [LL FIR] make FirDesignation.path type more precise. I's always a FirRegularClass 2022-12-13 13:16:33 +00:00
Ilya Kirillov cd83fec078 [LL FIR] fix lazy resolve of status for the members of the nested class
^KTIJ-23932 fixed
2022-12-13 13:16:32 +00:00
Ilya Kirillov 7bac119f20 [FIR] add lazy resolution contract checks in resolve 2022-12-12 16:21:06 +00:00
Mikhail Glukhikh df5aa59185 K2: Don't use FirTypeParameterSymbol.resolvedBounds() from inference 2022-12-12 16:21:05 +00:00
Roman Golyshev 9702b97d8d [kotlin] KTIJ-23832 Select proper argument for Kotlin annotations in KtDefaultAnnotationArgumentReference
Kotlin annotations can be called without named parameters even if their
names are different from `value`. So there's no need to search for the
property named "value", since there might be none
2022-12-12 14:13:42 +01:00
Jinseong Jeon cc7083d59e SLC: implement PsiMethod#getThrowsList 2022-12-11 15:22:11 +00:00
Ilya Kirillov b75bd179d4 [LL FIR] remove checkPce parameter from resolve, now we always check for PCE 2022-12-09 16:21:09 +00:00
Ilya Kirillov c2c615be99 [LL FIR] rework lazy annotation resolve for file to remove hacks
The previous solution blocked implementation of parallel resolve
2022-12-09 16:21:08 +00:00
Ilya Kirillov 3ad2b8a209 [LL FIR] rework FirDeclarationDesignation, so it can work with FirElementWithResolvePhase as a target 2022-12-09 16:21:08 +00:00
Dmitriy Novozhilov bd3a28d04d [FE 1.0] Report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE in missing cases
Covered places:
- local properties
- vars
- return positions of functions and lambdas

^KT-45970 Fixed
^KT-55358 Fixed
2022-12-09 15:10:03 +00:00
Dmitriy Novozhilov a979960e63 [FE 1.0] Add test for KT-45970 2022-12-09 15:10:02 +00:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Mikhail Glukhikh d5c8d9fecc FE: add test reproducing KT-54411 2022-12-09 15:00:38 +00:00
Dmitriy Novozhilov d898e256ca [FIR] Don't update explicit delegated constructor calls of classes with @JvmRecord
^KT-54573 Fixed
2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov 2aad466d00 [FIR] Add test for KT-55286 2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov f3da26946b [FIR] Change priority of K2_VISIBILITY_ERROR CandidateApplicability
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
  candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
  candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  or `INAPPLICABLE_WRONG_RECEIVER` applicability

This is needed to allow resolution to invisible symbols (and later
  suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`

^KT-55026 Fixed
^KT-55234
2022-12-09 12:02:05 +00:00
Egor Kulikov dbfe33c00d [FIR] Make default values for value parameters lazy in RawFirBuilder
Sixth step for ^KT-52615

Merge-request: KT-MR-7926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-08 13:32:37 +00:00
Yan Zhulanow c8e9cfde0b [FE] Read Java static field initializer lazily (KTIJ-23043) 2022-12-08 10:46:43 +00:00
Dmitriy Novozhilov 44fd9ddf85 [Test] Add test for KT-55338 2022-12-08 10:19:36 +00:00
pyos 06b71f8300 FIR DFA: drop data flow edges from postponed lambdas in return values
This is a temporary hack to avoid compiler crashes in some code that
uses builder inference, conditional early returns from lambdas, and
expected types in a certain way. It is not correct - dropping data flow
edges never is - but it is much easier to implement for now than a
proper fix.
2022-12-08 10:19:36 +00:00
pyos d66be3f82d FIR CFG: do not assume all arguments to inline funs are called in place
Only values for non-noinline, non-crossinline, functional type
parameters qualify.
2022-12-08 10:19:32 +00:00