Commit Graph

844 Commits

Author SHA1 Message Date
Mikhail Glukhikh 70366c3bcb FIR: forbid java.lang.String deprecated constructors #KT-51364 Fixed 2022-03-21 13:58:13 +00:00
Roman Golyshev 644db43e67 [FIR IDE] Filter non-implicit smart-casts in KtSmartCastProviderMixIn
Also, make `getSmartCastInfo` work more like SMART_CAST slice for
binding context

^KTIJ-21013 Fixed
2022-03-18 01:01:46 +04:00
Yan Zhulanow dd2afb558e Port stub-relating changes from 'master' of IntelliJ 2022-03-17 17:44:55 +09:00
Roman Golyshev 7bcd67068c [FIR IDE] Resolve explicit invoke calls more correctly
Also, enable some muted tests

^KTIJ-21343 Fixed
2022-03-15 21:29:36 +03:00
Ilya Kirillov 8b8d81cf2f [symbol lc] fix compilation of SymbolLightClassesForLibraryFrontendApiTestConfiguratorService 2022-03-15 19:50:19 +03:00
Jinseong Jeon a106ec6530 Do not create FastJarFileSystem when USE_PSI_CLASS_FILES_READING
because the intention of that configuration is to use "slower" class
reading.

In the near future, even though FIR is enabled, which uses experimental
faster jar file system, FIR clients (e.g., FIR UAST or Android Lint) may
still need to use slower class reading. So, we need to handle that
configuration before checking others.
2022-03-15 19:50:18 +03:00
Jinseong Jeon 24ec1e0cab AA: include root when populating files for scope of KtLibraryModule 2022-03-15 19:50:18 +03:00
Jinseong Jeon 6ec6def8e3 AA: reuse CoreJarFileSystem from KotlinCoreEnvironment in tests 2022-03-15 19:50:17 +03:00
Jinseong Jeon 89725941df AA: showcase an error in resolution to stdlib in standalone mode 2022-03-15 19:50:16 +03:00
Mikhail Glukhikh 3251c474a2 FIR: add test for KT-51621 (qualifiers conflict case) 2022-03-15 13:21:02 +00:00
Mikhail Glukhikh 0a7da903f4 FE1.0/FIR: add test for "double import" situation 2022-03-15 13:21:00 +00:00
Mikhail Glukhikh 6b53ac8367 FIR: forbid top-level destructuring declarations #KT-50468 Fixed 2022-03-15 13:08:18 +00:00
Mikhail Glukhikh 6ecc97575d FIR: make deeper recursive type alias expansion check (see KT-37000) 2022-03-15 13:08:18 +00:00
Yan Zhulanow c334a44e02 Preserve synthetic enum methods in stub-based 'ClsClassImpl'
'ClsClassImpl' instances created by the platform contain synthetic
enum methods (added by 'ClassInnerStuffCache.calcMethods()'). Such
convention is common in IntelliJ (see KT-36095 and
'9a8b345adaded83fe13980a28db5d9f9acc7450d' in the IntelliJ repository).

This commit makes Kotlin's stub-based classes consistent with the
convention. Instead, a filter is added in place of 'ClsClassImpl' usage.

See also the following commits:
- 7c86911f44
- 43468c6d55
2022-03-14 17:53:55 +09:00
Yan Zhulanow fa4dadf9b7 Update KotlinClassInnerStuffCache implementation
'KotlinClassInnerStuffCache' was copy-pasted from the platform's
'ClassInnerStuffCache' several years ago. After J2K and other changes,
it became quite dirty.

Besides cleaning things up, enum synthetic method handling have
significantly improved. Before, such methods were handled only in
'processDeclarationsInEnum', and 'getMethods()' didn't return them.
This led to inconsistent behavior and was reason for providing special
ad-hoc support in '1b6ded600518176b21cc308ed3e032ef8d04cc90'.
2022-03-14 17:53:55 +09:00
Yan Zhulanow 955d0841bd Remove unused modification tracker in KotlinClassInnerStuffCache
'dropCaches()' is not used anywhere both in the compiler and in the IDE.
2022-03-14 17:53:55 +09:00
Yan Zhulanow f237631f05 Revert "FIR/LC: create synthetic members of enum class"
This reverts commit 1b6ded60
2022-03-14 17:53:55 +09:00
Jinseong Jeon 46707b0426 AA: test evaluation mode with same test inputs 2022-03-11 13:51:16 +01:00
Jinseong Jeon a7fcbfb717 AA: move logic to evaluate constant property initializer
so as to handle composite expressions w/ constant property
2022-03-11 13:51:16 +01:00
Jinseong Jeon 606033e1e6 AA: introduce KtConstantEvaluationMode 2022-03-11 13:51:15 +01:00
Jinseong Jeon ee23a52e54 AA: avoid conversions to KtInitializerValue in constant evaluator 2022-03-11 13:51:15 +01:00
Jinseong Jeon 1f93630a9c AA: evaluate constant property initializers 2022-03-11 13:51:14 +01:00
Jinseong Jeon 7ec7cc47a9 AA: ignore evaluating named reference (to avoid exceptions) 2022-03-11 13:51:14 +01:00
Jinseong Jeon e36bf55807 AA: avoid NPE while evaluating operations with non-numbers 2022-03-11 13:51:13 +01:00
Dmitriy Novozhilov ade2307345 [FIR] Fix exponential analysis of augmented array access calls
^KT-50861 Fixed
2022-03-11 15:36:05 +03:00
Mikhail Glukhikh f073e86c93 Update FIR Analysis API test data 2022-03-10 20:42:42 +00:00
Mikhail Glukhikh 59a1c68081 FIR LL: add predicate based provider to library resolvable session 2022-03-10 20:42:42 +00:00
Mikhail Glukhikh 34998473f5 FIR: Move deprecation resolve earlier 2022-03-10 20:42:41 +00:00
Mikhail Glukhikh 3505b285f7 FirLazyDeclarationResolver: drop skipPhaseInLazyResolve 2022-03-10 20:42:41 +00:00
Mikhail Glukhikh 30fa0230ec FIR: rename ANNOTATION_FOR_PLUGINS into COMPILER_REQUIRED_ANNOTATIONS 2022-03-10 20:42:40 +00:00
Mikhail Glukhikh 9aaf7b7d24 FIR: drop pluginPhase special parameter 2022-03-10 20:42:40 +00:00
Mikhail Glukhikh 14eec6cfc0 FE 1.0: implement typed this label resolve warning for KT-51433
#KT-51433 Fixed
2022-03-09 15:19:27 +00:00
Mikhail Glukhikh b5e2c492c6 FE 1.0: implement initial label resolve warning for KT-51433 2022-03-09 15:19:26 +00:00
Ilya Kirillov 092550aaee [Symbol LC] fix invalid caching for FirLightClassBase
Previously, value created by FirLightClassesLazyCreator was never recalculated based on dependencies changes
2022-03-03 20:12:56 +03:00
Mikhail Glukhikh ebed224f82 FE 1.0: use TYPE_VARIANCE_CONFLICT deprecation factory 2022-03-03 12:57:04 +00:00
Mikhail Glukhikh 7781413a93 FE 1.0: report TYPE_VARIANCE_CONFLICT also on qualifier type arguments
#KT-51439 Fixed
2022-03-03 12:57:04 +00:00
Jinseong Jeon 870cdfd226 AA: add an API to configure proj env w/o explicit KtFiles
We can retrieve source files from compiler configuration.
Then, we can search for corresponding KtFiles for them.
2022-03-02 21:11:54 +01:00
Jinseong Jeon 47b0e66ca1 AA: remove unnecessary source path retrieval/cache
Instead, use source module's contentScope
2022-03-02 21:11:54 +01:00
Jinseong Jeon a68fd25982 AA: relax the assertion about referenced ClassId and qualified access
If an import alias is involved, they could be not identical.
Since an import alias ends with a simple identifer, we can simply drop
the first segment of qualified access and try the assertion again.
2022-03-02 20:30:31 +01:00
Dmitriy Novozhilov 18fc2802e5 [FIR] Make FirTypeParameter.containingDeclarationSymbol not null
Also fix initializing this property in all places
2022-02-28 11:42:34 +03:00
Roman Golyshev 8bcdc70adc FIR IDE: Add IDE tests for sample compiler plugin 2022-02-25 23:08:26 +03:00
Roman Golyshev fed08aaff5 FIR IDE: Consider COMPANION_GENERATION phase in lazy resolve 2022-02-25 23:08:26 +03:00
Roman Golyshev 6e649dd29c FIR IDE: Add a way to use test compiler plugin in FIR IDE tests
Compiler plugins can be enabled
by WITH_FIR_TEST_COMPILER_PLUGIN directive
2022-02-25 23:08:26 +03:00
Roman Golyshev 1a77643ad0 FIR IDE: Add static implementation of KotlinAnnotationsResolver 2022-02-25 23:08:26 +03:00
Roman Golyshev 765af5f18a FIR IDE: Register plugins-related session components in IDE session
Move registering CLI-specific plugin-related components to
`registerCliCompilerOnlyComponents`
2022-02-25 23:08:25 +03:00
Roman Golyshev 8d9d46dae3 FIR IDE: Lift extensions registration higher in session creation process
We want to do that before creating symbol providers
2022-02-25 23:08:25 +03:00
Roman Golyshev b1b99e1673 FIR IDE: Add the simplest support for PLUGIN KtDeclarationOrigin 2022-02-25 23:08:25 +03:00
Roman Golyshev 6d6a3fbe21 FIR IDE: Consider generated names in KtFirPackageScope
If scope doesn't return generated names from `getPossibleCallableNames`,
it's impossible to query them from the scope, since you have to know the
name of callable/classifier to query it
2022-02-25 23:08:25 +03:00
Roman Golyshev 13cc0ddf97 FIR: Implement FirIdePredicateBasedProvider 2022-02-25 23:08:25 +03:00
Roman Golyshev 08b6353431 FIR: Add IDE implementation for FirRegisteredPluginAnnotations
It works on `KotlinAnnotationsResolver`, which means that it uses
PSI indices to search for the annotations
2022-02-25 23:08:25 +03:00