Commit Graph

1272 Commits

Author SHA1 Message Date
Dmitry Gridin 7102be7720 [lc] KotlinAsJavaSupportBase: introduce LightClassCachedValue
to extract common logic with cached values

^KT-50241
2022-09-08 13:47:41 +00:00
Dmitry Gridin 2611be0436 [lc] KotlinAsJavaSupportBase: make ifValid inline
^KT-50241
2022-09-08 13:47:40 +00:00
Dmitry Gridin aa31ca67e2 [lc] KotlinAsJavaSupportBase: make librariesTracker abstract
^KT-50241
2022-09-08 13:47:40 +00:00
Dmitry Gridin e6bb97d490 [lc] KotlinAsJavaSupportBase: suppress visibility warnings
methods can be used from the plugin for tests

^KT-50241
2022-09-08 13:47:40 +00:00
Dmitry Gridin b618855e2c [lc] KotlinAsJavaSupportBase: add more lightweight checks for facades
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin ec1b6f4f3e [lc] KotlinAsJavaSupportBase: reduce number of findModule calls
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin acc880fe25 [slc] SymbolKotlinAsJavaSupport: drop redundant checks
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin e58b98bb5c [lc] KotlinAsJavaSupportBase: implement getLightClassForScript
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin 46548e5443 [lc] KotlinAsJavaSupportBase: implement getLightClass
add more caching

^KT-50241
2022-09-08 13:47:38 +00:00
Pavel Mikhailovskii 85ab8b4ce1 KT-53783 Prohibit "expect data object" syntax 2022-09-07 12:53:24 +00:00
Nikolay Lunyak 45619ab390 [FIR] KT-53435: Fix false positive ANNOTATION_ARGUMENT_MUST_BE_CONST
Otherwise, `FirNamedArgumentExpression` are not considered
const expr despite the value.

Merge-request: KT-MR-7052
Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
2022-09-07 12:34:26 +00:00
Dmitriy Novozhilov 194741b96b [FIR] Remove incorrect FirClassSymbol<*>.superConeTypes utility
Replace all usages with member `FirClassSymbol.resolvedSuperTypes`
2022-09-07 07:57:37 +00:00
Mikhail Glukhikh d8522a8967 FE: Add test for KT-53656 2022-09-06 17:57:02 +00:00
Simon Ogorodnik 05d486d55a Fix receiver inconsistency when builder inference restriction disabled
In 154e53c701 update of
extensionReceiverArgument in resolvedCall was accidentally moved into
language feature dependant block
2022-09-05 10:07:41 +00:00
Nikolay Lunyak 3d9c77efa8 [FIR] Add DNN checks
Merge-request: KT-MR-7000
Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
2022-09-01 14:25:07 +00:00
Roman Golyshev bb2bee74cf [HL API] Fix FE10 implementation of KtExpressionTypeProvider 2022-09-01 13:57:03 +00:00
Denis.Zharkov 490382b77f Add test for KT-52782
It just demonstrates/fixate the current "broken" behavior in K1
that we unfortunately have and that is fixed in K2
2022-08-31 09:45:54 +00:00
Denis.Zharkov db1bd4f232 Add test for KT-53124
The issue itself is supposed to be fixed after eb19d39cbf reverted

^KT-53124 Fixed
2022-08-30 15:56:31 +00:00
Denis.Zharkov 42c41a1916 Revert "[FE 1.0] Build captured type's supertypes in an alternative way: use own projection type as a first supertype, then supertypes from the corresponding type parameter's upper bounds"
This reverts commit eb19d39cbf.
2022-08-30 15:56:30 +00:00
Roman Golyshev 16cb3064c8 [FIR] Resolve value class constructor to TYPES before using its params
Right now it is the easiest way to ensure that all the parameters are
resolved. After KT-53573 is fixed, we might use `resolvedReturnTypeRef`
on each parameter individually instead

Also, add `toString` implementation to `ValueClassRepresentation`
classes, so they are properly rendered in testdata

^KTIJ-22630 Fixed
2022-08-30 13:49:40 +00:00
Denis.Zharkov f4a3ab877f Add test for parsing issue KT-53719
^KT-53719 Related
2022-08-30 11:21:51 +00:00
Denis.Zharkov 3d7969ec8f Revert "KT-35811: Type parameter angle brackets followed by equal sign are parsed incorrectly if whitespace is missing"
This reverts commit 2053363def.

^KT-35811 Open
2022-08-30 11:21:50 +00:00
Denis.Zharkov 211d662708 Revert "KT-8263: Conditional operators are not parsed correctly"
This reverts commit ec8da2033c.

For the reason for the revert see KT-53719

^KT-8263 Open
^KT-53719 Fixed
2022-08-30 11:21:50 +00:00
Simon Ogorodnik 154e53c701 K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type,
as such calls can shadow members of finalized stub types causing
change of resolve when corresponding type argument specified explicitly

It works by checking extension receiver during call resolution parts run
That way we can easily detect if we found an extension applicable to
stub receiver and report call diagnostic for it

KT-53739
2022-08-30 10:19:26 +00:00
Simon Ogorodnik 105358dcf6 K1: add diagnostic BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION
Let's call builder lambdas (BL) a lambda that has non-fixed input type
projection at the moment of lambda arguments analysis, such lambdas
is a subject to be analyzed with builder inference
Due to bug in constraint system joining algorithm, currently system
of two or more such lambdas may lead to unsound type inference

Diagnostic added here should be reported in case when there are two
BL that shares a common constraint system, while not annotated with
@BuilderInference, as a protection against aforementioned bug

It's reported by ConstraintSystemCompleter when such situation has
occurred during builder inference phase, it is the same place that
decides wherever lambdas is subject to builder inference or not

KT-53740
2022-08-30 10:19:25 +00:00
Mikhail Glukhikh f6ad6fb816 Add test for stub type receiver and for KT-53639 2022-08-30 10:19:24 +00:00
Mikhail Glukhikh 5cbecd276c FE: add test reproducing builder inference problem from KT-53422 2022-08-30 10:19:23 +00:00
Dmitry Gridin 4a6609e491 [lc] LightClassUtil: simplify facade class search
^KT-53543
2022-08-29 11:51:43 +00:00
Dmitry Gridin feb31b79de [lc] support decompiled facade only for .class
we have support only for KtClsFile (see decompiled light classes) so kotlin_builtins and kotlin_metadata should be ignored

^KT-53543
2022-08-29 11:51:43 +00:00
Dmitry Gridin 031edb7344 [lc] do not search files for compiled jvm multifile
^KT-53543
2022-08-29 11:51:42 +00:00
Dmitry Gridin 924dd38144 [lc] introduce KotlinAsJavaSupportBase with new common facade logic
^KT-53543
2022-08-29 11:51:42 +00:00
Dmitry Gridin 0ea041a1eb [lc] move SymbolLightClassForDecompiledFacade to common decompiled part
^KT-53543
2022-08-29 11:51:42 +00:00
Dmitry Gridin d2ddf88cdc [lc] KtLightClassBase: cleanup code
^KT-53543
2022-08-29 11:51:41 +00:00
Dmitry Gridin 0bbe981ff0 [lc] KtLightClassForFacadeBase: simplify equals
^KT-53543
2022-08-29 11:51:41 +00:00
Dmitry Gridin 5be31e575c [lc] extract common code to KtLightClassForFacadeBase
^KT-53543
2022-08-29 11:51:41 +00:00
Dmitry Gridin acfbe30f7c [lc] drop redundant PsiManager argument from KtLightClassForFacadeBase
^KT-53543
2022-08-29 11:51:40 +00:00
Simon Ogorodnik 8f51c51eee FIR. Fix smart-cast expression unwrapping in plus with assign resolve 2022-08-26 14:57:06 +00:00
Ilya Gorbunov 6aff3c6d07 Update misc test data after introducing rangeUntil member #KT-52933 2022-08-24 22:22:54 +00:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Nikita Bobko 0874fb71c6 Replace all kotlin-reflect-api dependencies with kotlin-reflect
Review: https://jetbrains.team/p/kt/reviews/6753

Why: I'm going to replace source dependency on kotlin-reflect with
binary dependency. Normalize reflect dependency before global
processing.
2022-08-22 15:43:11 +02:00
Nikita Bobko 8f79e833a8 Drop all redundant kotlin-reflect, kotlin-reflect-api dependencies
Review: https://jetbrains.team/p/kt/reviews/6753

All redundant I managed to find, of course.

Why: I'm going to process all reflect dependencies in the next commits.
Cleanup reflect dependency before processing.

They are redundant because:
1. if `compileOnly` then compilation didn't break after dropping the
   dependency
2. if `test*` then tests didn't break after dropping the dependency.
3. `analysis/analysis-api-fir/analysis-api-fir-generator/build.gradle.kts`
   `compiler/fir/checkers/checkers-component-generator/build.gradle.kts`
   Drop `implementation(project(":kotlin-reflect-api"))` because the
   module already depends on
   `implementation(project(":kotlin-reflect"))`
4. `compiler/daemon/daemon-client/build.gradle.kts`. Drop `runtimeOnly`
   because after dropping `compileOnly` compilation didn't break (so
   `runtimeOnly` looks suspicious). Less safe than 1-3
2022-08-22 15:42:57 +02:00
Nikita Bobko 70ed76e0bd Drop unused ':dist' dependency in some tests
Review: https://jetbrains.team/p/kt/reviews/6753

This commit doesn't fix any issue except for "cleanup". If you find a
mistake in this commit feel free to revert part of it/the whole commit

I checked every module where I drop ':dist' dependency. Tests still pass
in those modules
2022-08-22 15:42:34 +02:00
Jinseong Jeon 79686ba242 AA FE1.0: don't return psi for fake overrides 2022-08-20 00:50:10 +02:00
Jinseong Jeon 25f7554a31 AA FIR: constant evaluation for Java field 2022-08-20 00:50:09 +02:00
Mikhail Glukhikh a6b90fcb8e Add a test with false positive "inferred into empty intersection"
Related to KT-50232
2022-08-19 14:01:37 +00:00
Mikhail Glukhikh 730de8fd7c K1/K2: add test for enum class with 'entries' entry 2022-08-19 10:08:09 +00:00
Dmitriy Novozhilov bb38690273 [FIR] Introduce FirAssignExpressionAltererExtension
This extension can be used to override resolution of assign statements
  with custom statement
2022-08-19 07:44:09 +00:00
Arseniy Terekhov 25fc948d95 [FIR] DeprecationsProvider: make evaluation of deprecations on demand 2022-08-19 07:37:54 +00:00
Ilya Kirillov 7441388f9d [Decompiled LC] restore missed ^IDEA-286315 fix during Decompiled LC migration to the kotlin repo
^IDEA-297478 fixed
2022-08-18 16:10:51 +00:00
Jinseong Jeon 9e35815ae3 AA: fail-safe path retrieval of source files
Also, apply file extension-based filtering since javaSourceRoots is
supposed to refer to either KotlinSourceRoot or JavaSourceRoot.
2022-08-17 21:32:29 +02:00