Commit Graph

25534 Commits

Author SHA1 Message Date
Ilya Kirillov 81baf4fae5 FIR IDE: collect diagnostics under read lock 2021-03-09 18:30:35 +01:00
Ilya Kirillov 770468c78e FIR IDE: refactor designated lazy transformers 2021-03-09 18:30:35 +01:00
Pavel Kirpichenkov 4bc019736b [MPP] Add KotlinSDK to the set of predefined test SDKs
^KT-45145 Fixed
2021-03-09 20:05:32 +03:00
Nikolay Krasko 9e5bf7e05c Increase amount of memory for Gradle Importing Tests
We have OOM in recent tests executions
2021-03-09 13:32:27 +03:00
Ilmir Usmanov e79c9a3618 Extend LVT record of alive variables to end of next suspension point
Otherwise, arguments of suspend call become invisible in async stack
trace
 #KT-44714
2021-03-08 23:56:40 +01:00
Ilya Kirillov 7c11dde2cf FIR IDE: add support of FirStatement in getKtExpressionType 2021-03-07 19:48:08 +01:00
Ilya Kirillov d311fe21f8 FIR IDE: add additional tests for expression types 2021-03-07 19:48:08 +01:00
Ilya Kirillov 8a28175302 FIR IDE: fix CCE in getKtExpressionType on loops 2021-03-07 19:48:08 +01:00
Ilya Kirillov 0130ecd21d FIR IDE: fix CCE in getKtExpressionType on assignment target 2021-03-07 19:48:08 +01:00
Andrey Uskov b7e13d677d Fixed loading Gradle script templates located on WSL2
#KT-45042 Fixed
2021-03-07 19:40:13 +03:00
Andrey Uskov 63925ee018 Implemented collecting projectId from Gradle
#KT-45337 Fixed
2021-03-07 19:40:08 +03:00
Mikhail Glukhikh 037505d9f2 FIR IDE: regenerate diagnostics 2021-03-06 09:22:35 +03:00
Alexander Udalov 566f97ae3e JVM IR: remove dependency of 'backend.jvm' on 'psi2ir', 'ir.serialization.jvm'
Add a new module 'backend.jvm.entrypoint' which depends on psi2ir and
contains code that runs psi2ir + JVM IR backend with serialization
implementations.

Hopefully this will allow to compile these modules in parallel and
reduce the build time.
2021-03-05 20:46:33 +01:00
Andrei Klunnyi a0b901b23a Revert "[FIR]: sealed hierarchy processor for IDE"
This reverts commit e6ccdff2
2021-03-05 16:37:47 +01:00
Ilya Kirillov 1d42c70056 FIR IDE: generate diagnostics 2021-03-05 15:04:07 +01:00
Tianyu Geng 8158a07063 FIR IDE: add quickfix for NESTED_CLASS_NOT_ALLOWED 2021-03-05 13:27:36 +01:00
Bingran 03df752e8e Update min supported gradle version to 6.1
This PR also updates the min agp version we test with because older agp
versions are using gradle apis which doesn't exist in gradle 6.0+.

GH PR: #4155
2021-03-05 14:11:10 +03:00
Andrei Klunnyi e6ccdff2f7 [FIR]: sealed hierarchy processor for IDE
From now on sealed declarations get resolved with the help of
FirIdeSealedHierarchyProcessor. This change entails correct IDE side
check for sealed when exhaustiveness.
2021-03-05 10:20:19 +00:00
Jinseong Jeon d348e58183 FIR: rename util to retrieve primary constructor 2021-03-04 17:56:30 +03:00
Jinseong Jeon e009b71f88 FIR checker: report uninitialized member/extension properties 2021-03-04 17:56:29 +03:00
Jinseong Jeon e8028e7825 FIR checker: report nullable/non-class LHS of class literals 2021-03-04 17:09:52 +03:00
Dmitriy Novozhilov 2cb24fbd49 Fix compiler warning in ide test utils 2021-03-04 17:09:17 +03:00
Vladimir Dolzhenko cb92474af9 Use highlight visitor instead of custom general like highlighting pass
#KTIJ-1760 Fixed
#KT-45254 Fixed
2021-03-04 07:11:58 +00:00
Tianyu Geng 89ce629352 FIR: report VARARG_OUTSIDE_PARENTHESES 2021-03-03 20:23:59 +03:00
Jinseong Jeon f1fa290d49 FIR checker: report val reassignment 2021-03-03 12:27:11 +03:00
Dmitriy Novozhilov 4299794de2 Move SmartPrinter to :core:compiler.common 2021-03-02 19:11:10 +03:00
Tianyu Geng 17617ffd3f IDE FIR: fix resolving vararg parameter type
For a vararg parameter type, there corresponding FIR element has a fake
source of kind ArrayTypeFromVarargParameter. As a result,
`getOrBuildFir` returns the whole `FirValueParameter` for the parameter
type reference. Therefore, we need some special handling for this case
in order to resolve the proper `KtSymbol`.
2021-03-02 12:46:55 +01:00
Yaroslav Chernyshev 634c8522a1 Fix jvmTarget default divergence between KGP & IDE after change to 1.8 2021-03-02 11:51:11 +03:00
Ilya Kirillov f2db93a9d2 FIR IDE: add test cases for file structure tests 2021-03-02 09:16:06 +01:00
Ilya Kirillov ded24c708d FIR IDE: run incremental analysis in file structure tests multiple times 2021-03-02 09:16:06 +01:00
Ilya Kirillov 70c98d34d2 FIR IDE: add test which check that every declaration is visited single time during diagnostic collection 2021-03-02 09:16:05 +01:00
Ilya Kirillov 0b921ed9d8 FIR IDE: fix collecting diagnostics multiple times for the same declaration
^KT-45199 fixed
2021-03-02 09:16:05 +01:00
Ilya Kirillov 4acca2fa16 FIR IDE: refactor DiagnosticsCollector.getDiagnosticsFor for easier debugging 2021-03-02 09:16:05 +01:00
Ilya Kirillov 9cca19d503 FIR IDE: do not consider OOBM in non-physical file as OOBM 2021-03-02 09:16:05 +01:00
Ilya Kirillov e2fc20e9a1 FIR IDE: do not store psi inside HLQuickFix
Otherwise we can operate on invalidate psi

relates to ^KT-45199
2021-03-02 09:16:03 +01:00
Tianyu Geng bca393bd5c FIR IDE: Add quickfix for PRIVATE_SETTER_FOR_(OPEN|ABSTRACT)_PROPERTY 2021-03-01 19:30:31 +01:00
Tianyu Geng 724ca1d3ee FIR: introduce diagnostic NESTED_CLASS_NOT_ALLOWED 2021-03-01 16:57:54 +03:00
Andrei Klunnyi f45af5ea0e KT-44821 [Sealed Interfaces]: when-exhaustiveness failure in IDE
Compiler check for 'when' exhaustiveness requires that module
descriptors of a sealed class and its inheritors are the same (reference
identity matters). Prior to this commit and under some conditions they
were not. Details follow below.

Resolution related data structures (resolution facades) are organized
into trees (sdks, libs, and modules have their own nodes/facades,
module/class descriptors are stored inside). And the trees themselves
are put into a map associating so called PlatformAnalysisSettings and
GlobalFacades (plays a role of a root). PlatformAnalysisSettings is an
abstraction describing target platform and sdk of a module. The more
combinations exist for a project the more facades are used. Please, see
KotlinCacheService for more details.

So why a module can have multiple ModuleDescriptor-s?
Every tree mentioned above is an isolated resolution environment
containing its own instances of the outer world descriptors. Say, if a
project has modules X, Y, Z and we consider X then all three might have
their own vision of X, i.e. 3 descriptors exist at a time.

What descriptor instance does compiler get?
The path starts when the user opens a file in the editor and
highlighting pass starts (see usages of
ResolutionUtils#analyzeWithAllCompilerChecks). Module descriptor stored
in the resolution tree of the file's module gets injected into the
compiler's context. Starting from this moment compiler sees other
modules through the prism of a single resolution facade (tree).
Descriptors residing outside are alien.

This commit allows IdeSealedClassInheritorsProvider to figure out what
PlatformAnalysisSettings are associated with the resolution facade (read
ModuleDescriptor) seen by the compiler. Later on the same facade is used
to provide correct instances of sealed inheritors back to the compiler.
2021-03-01 12:12:00 +01:00
Roman Golyshev 6ebd4b954c Add new reference resolve tests
The main purpose is to show that old frontend and FIR work differently
in the case of the conflicts of local and top level classes/objects

See the tests that marked with // IGNORE_FIR

Corresponding ticket is ^KT-45192
2021-03-01 10:23:57 +00:00
Dmitry Savvinov 168c692a27 Use overriding util with proper typechecker for overriding in LazyClassMemberScope
Note that LazyClassMemberScope actually has a separate field for
KotlinTypeRefiner, and it might be actually different from the one in
c.kotlinTypeChecker.

The one in c.kotlinTypeChecker is the refiner of *owner* module, i.e. a
module in which the class has been declared. If we have a class Foo :
Expect in common, then the refiner will be from common, and thus it
won't be able to refine supertypes to their platform-dependent values.

The one passed in constructor is actual refiner of dependant-module.
Say, if we're looking at Foo from the point of view of jvmMain, then
we'll create a (view-dependent) LCMS for that, and it will contain
refiner for jvmMain.

It is important to use proper refiner, otherwise the idea of having
"module-dependent view" breaks, and we might suddenly mismatch some
overrides with expect-classes in their signatures.

^KT-44898 Fixed
2021-02-26 12:37:01 +03:00
Dmitry Savvinov 9616eb94fd Add test on KT-44898 (MPP + type refinement + complex inheritance)
The current behaviour is undesired (ABSTRACT_MEMEBER_NOT_IMPLEMENTED
reported on class Concrete), will be fixed in the next commit
2021-02-26 12:37:01 +03:00
Tianyu Geng 2484729bd7 FIR IDE: fix redundant
Apparently there is a race condition when collecting the `fromPhase`.
This causes the same resolver to run multiple times on FIR.

^KT-45121 Fixed
2021-02-25 23:31:37 +01:00
Ilmir Usmanov 2523ea1ef4 Do not add @JvmInline annotation on JS and Native 2021-02-25 16:07:00 +01:00
Ilmir Usmanov 2df049fc03 Minor. Remove outdated test and update maven test 2021-02-25 16:06:58 +01:00
Ilmir Usmanov 8c31fcb615 Add inline class -> @JvmInline value class intention 2021-02-25 16:06:54 +01:00
Mark Punzalan 1c94372b6c FIR checker/IDE: Add checker and quickfix for VAL_WITH_SETTER. 2021-02-25 13:06:53 +01:00
Dmitriy Novozhilov 4222bb9af2 [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 14:56:08 +03:00
Andrei Klunnyi 618de5fa32 KT-45074 [Sealed Interfaces]: when exhaustiveness after gradle reimport
Module descriptor names in the form of 'stableName' depend on a build
system. See JvmCodegenUtil#getModuleName(). For JPS we get
<module-name.main> or <module-name.test> whereas for Gradle we get top
level <module-name>.
This commit changes approach: ModuleDescriptor-to-Module conversion is
no longer made by name. ModuleInfo is utilized instead.

^KT-45074 fixed
2021-02-25 10:34:45 +00:00
Alexander Udalov a6d8bf8127 Fix compilation of idea-fir-low-level-api 2021-02-24 21:31:19 +01:00
Ilya Kirillov 9ce4decb73 FIR IDE: use WhenMissingCase in NoElseInWhen diagnostic 2021-02-24 20:13:45 +01:00