Commit Graph

59 Commits

Author SHA1 Message Date
Ilya Chernikov 4fafa4b6e9 K2 IC: add lookups of candidates on tower level processing
Allow recording lookup to symbols from supertypes, required at least
for CRI.

partially fixes #KTIJ-29026
2024-03-12 11:38:07 +00:00
Ilya Chernikov 39b05a0a1c K2 IC: fix classifiers lookups
in particular nested classifiers and companions.

#KTIJ-24833 fixed
#KTIJ-24830 fixed
#KT-55195 fixed
2024-03-12 11:38:07 +00:00
Ilya Chernikov a823bfd600 K2 IC: refactor and optimize lookup tracking
- encapsulate semantic more into helpers
- allow lazy scopes iteration
- simplify reporting code in tower resolver
- fix some inconsistencies and wrong lookups
- remove redundant lookup recordings
- remove lookup scopes for non-star imports

The commit is a refactoring and doesn't change the behaviour of
neither IC nor CRI. Changes in the lookups are mostly due to the
previous obviously wrong lookups (see changed test data).
2024-03-12 11:38:07 +00:00
Ilya Chernikov fe4e0e9c2e K2 IC: fix class members lookups recording
in particular - statics

 #KTIJ-24830 fixed
2024-03-12 11:38:06 +00:00
Ilya Chernikov 1989e8f094 IC tests: add infrastructure for K1/K2 lookups comparison
Adapt lookup tests to allow running K1 and K2 on the same testdata
and compare the lookups recorded.
2024-03-12 11:38:06 +00:00
Ilya Chernikov 684d0b8690 K2 IC: filter out builtins lookups
Do not record lookups to kotlin builtins, since it is considered
useless.

Related to #KT-66417
2024-03-12 11:38:06 +00:00
Ilya Chernikov 5b62558798 K2 IC: fix member lookup recording
The previous code recorded only class name, instead of fqname,
as a scope of lookup.

#KT-65943 fixed
#KTIJ-24828 fixed
related to #KT-56197
2024-03-12 11:38:06 +00:00
Kirill Rakhman f231338cd6 [FIR] Render list of symbols with linebreaks as separators
#KT-61823 Fixed
2024-02-21 12:25:22 +00:00
Alexander Udalov 3f034e8b67 Enable lightweight lambdas (aka invokedynamic) since 2.0
#KT-45375 Fixed
 #KT-58173 Open
2024-02-08 19:46:18 +00:00
Aleksei.Cherepanov 5150812838 [IC] Add test for potential sam change in kotlin-java interop
JPS tests were fixed on IJ side during implementation of JPS on graph

Relates to KT-21534
2023-12-21 16:09:14 +00:00
Ilya Chernikov ed820d6b57 K2 IC: fix lookup recording for a "red" companion object
#KT-63665 fixed
2023-12-13 13:40:44 +00:00
Ilya Chernikov 6dfcc927f4 IC tests: make exceptions from compiler more visible in tests
otherwise they are easily swallowed by the reporting logic.
This commit was needed to ensure that the problem described in
KT-63665 is reproducible in IC test
But some JS IC logic relies on handling compiler exceptions as a signal
for scope expansions, and the newly introduced exception logging
broke a few tests. To mitigate it, the directive was introduced
to disable exception logging for particular test.
2023-12-13 13:40:44 +00:00
Ilya Goncharov 08e3cb300a [JS] Migrate tests onto IR compiler with outputDir API instead of outputFile
^KT-61117 fixed
2023-11-29 11:21:56 +00:00
Evgenii Mazhukin 20af98c776 [Tests] Re-enable K1 IC tests for expect-actual
^KT-60831 fixed
^KT-60831 next step KT-63183


Merge-request: KT-MR-12855
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-06 19:46:43 +00:00
Kirill Rakhman ef78d4b95a [FIR] Fix deserialization of generic context receivers
We need to pass the local deserialization context so that generic
type parameters can be referenced.

#KT-62607 Fixed
2023-10-27 11:35:22 +00:00
Alexander Udalov 6219f7fc0d JVM IR: fix detection of enum entries in the same module
Use the new `IrClass.hasEnumEntries` flag added in the previous commit.

 #KT-61208 Fixed
2023-10-16 20:22:20 +00:00
Mikhail Glukhikh 4133988d62 LV 2.0: temporarily mute 4 incremental MPP tests (KT-60831) 2023-09-19 15:46:29 +00:00
Ilya Chernikov 129c1b4f92 IC: temporarily mute lookup tracker test on K2
Test most likely fails due to the missing precise java tracker
See #KT-57147 and #KT-60736 for details
2023-09-19 15:46:28 +00:00
Ilya Chernikov 60603de042 LV20: fix JPS testdata where the error reporting slightly changed 2023-09-19 15:46:27 +00:00
Mikhail Glukhikh ab2053df4b Use K2/PSI in lookup tracker tests, fix test data in accordance with 2.0
#KT-60736 Submitted
2023-09-19 15:46:27 +00:00
Aleksei.Cherepanov b27aef2c61 Add test
#KT-44835 In Progress
2023-08-30 12:42:39 +00:00
Mikhail Glukhikh c4fbbe7338 Fix old JS BE tests in MultiplatformJpsTestWithGenerated by using K1 2023-08-25 08:57:53 +00:00
Kirill Rakhman 43180597fe [FIR] Fix generic sam conversion in call completion
#KT-60903 Fixed
2023-08-21 10:35:42 +00:00
Ilya Goncharov 8c014baa28 [JS] Fix JPS tests with js part 2023-06-29 14:25:45 +00:00
Ilya Goncharov a0f86d8dd6 [JS] Remove JS legacy lookup tracker tests 2023-06-29 14:25:45 +00:00
Kirill Rakhman a50ae9db9d [FIR] Revert workaround for IC issue surfaced by KT-58335
#KT-28233
2023-05-16 09:20:57 +00:00
Aleksei.Cherepanov 6471624d0c [Gradle] Disable usePreciseJavaTracking flag for K2
Historically flag was enabled for Gradle projects, but we don't have fir-based JavaTracker for the K2 compiler for now, so we need to use a fallback strategy.
Note: it was disabled for tests with K2
Note2: after adding a fir-based java classes tracker this value should be set to true (KT-57147)

#KT-56886 Fixed

Merge-request: KT-MR-9053
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-03-09 13:41:25 +00:00
Aleksei.Cherepanov 090a58ccc4 Change allConstants test
Currently, FIR compilation of `const val b: Byte = 50 + 50` shows an error, but old compiler doesn't (it shows only warning). Since this is an incremental test, it should not be affected by compiler errors, but should only test for .kt usage without recompilation.

#KT-54991 In Progress
2023-01-30 13:45:39 +00:00
Aleksei.Cherepanov a0fa438735 Revert "FIR IC: fix test with behavior different from non-tight cycle variants"
This reverts commit c4a29651 as it is no longer needed after IC fix: `5ba3053e` "[IC] Do not report recompilation of non-existing files", because now fix-ic-build.log duplicates the main build.log

#KT-54991 In Progress
2023-01-30 13:45:38 +00:00
Aleksei.Cherepanov 67f308dbdb Add dummy test data
Gradle IC with enabled FIR compilation adds some extra files to the compilation scope compared to the previous compiler(KT-55576). Adding dummy files to such tests with expanded compilation scope will prevent green Aggregate build if some changes in IC will lead to full module compilation as there were such precedents with JS IC because otherwise, all files in the module are present in the build log.

#KT-54991 In Progress
2023-01-30 13:45:38 +00:00
Aleksei.Cherepanov 848e1001f8 Add test for IC issue with typealias
If typealias is defined in a separate file, then after changing some base types, an incremental compilation of Kotlin could not find all affected files, because of lack of information, which it can not get on the class file analyzing phase. FIR provides a new approach to IC compilation: now we can run the frontend several times, which allows us to obtain all necessary information and use it to mark all affected files for recompilation.
Relates to KT-54991

#KT-28233 Fixed
2023-01-30 13:45:37 +00:00
Aleksei.Cherepanov 671aa68ad6 Add K2 tests for JPS with different configuration (K2, LightTree and Fir-IC)
*Enable JPS tests for K2
*Exclude compiler messages from the comparison of output logs, as they can vary depending on the compiler
*Mute failing tests:
  1) Sam conversions - Unmute after updating IntelliJ core up to 212, as they should pass after updating IntelliJ JPS dependency
  2) Failing IC tests with Java-interop, that are needed to be fixed during KT-55696
  3) Failing IC tests with recording different sets of lookups by the compiler, that are needed to be fixed during KT-55195
  4) Failing AllConstants, will be changed in KT-54991
*Fix test data:
  1) Add cleaned outputs for JPS, because Gradle skips error messages at all
  2) Rename gradle-fir-build.log to fir-build.log, because JPS also can use it and there is no need to duplicate files
  3) Add some k2-specific logs, that changed the set of files in different rounds in comparison with the old compiler, but the scope stays the same
  4) Remove useless logs and obsolete directives.txt files as they have no impact on test results
  5) Replace fir-build.log files with gradle-fir-build.log because Gradle build with FIR is correct, but not optimal. JPS with K2 is now tested with fir-build.log files
  6) Remove useless fir-log, as it duplicates the main build log, and Remove empty directives file

#KT-54991 In Progress

Merge-request: KT-MR-8174
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-01-10 14:31:55 +00:00
Alexander Udalov 7a9c59aeb5 JVM IR: do not serialize metadata for actualized optional expectations
Optional-expectation annotations which have an actual counterpart should
have never been serialized to the kotlin_module's proto. See for example
the original (correct) implementation in the old JVM backend in
`PackageCodegenImpl.addDescriptorToOptionalAnnotationsIfNeeded`.

 #KT-55611 Fixed
2023-01-02 15:30:27 +00:00
Hung Nguyen cdbbead157 Handle changes to inline functions/property accessors with @JvmNames
If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Extract KotlinClassInfo to a separate class

to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Update unit tests for handling `@JvmName`s

In a previous commit, we made a behavior change for inline property
accessors: The existing behavior is that if the implementation of an
inline getter has changed, only usages of the getter will be impacted
but not usages of the setter (and vice versa).

After that previous commit, usages of *both* the getter and setter will
now be impacted (i.e., we might compile slightly more files). This is
because a change to either the getter or the setter will now be
considered a change to the property, which will help simplify our change
analysis.

This commit updates the relevant unit tests to reflect the new behavior.

Test: Updated Incremental*TestGenerated.PureKotlin#testInlinePropertyInClass
      and Incremental*TestGenerated.PureKotlin#testInlinePropertyOnTopLevel

^KT-54144 Fixed
2022-11-10 10:03:55 +01:00
Aleksei.Cherepanov b6612c2dcb Replace the Cyrillic character "C" with the Latin version in the test data 2022-10-20 12:49:56 +02:00
Oleg Bask 3302aa5017 Rename C.kt containing cyrillic characters (#4984) 2022-10-20 12:42:28 +02:00
Aleksei.Cherepanov 0950205a47 [IC] Add test for lookups flushing
#KT-53168
2022-07-14 12:55:29 +00:00
Andrey Uskov 5ba3053e00 [IC] Do not report recompilation of non-existing files 2022-07-12 05:53:10 +00:00
Andrey Uskov deb2ef9a51 Add details about compilation rounds in IC tests 2022-07-12 05:53:09 +00:00
Andrey Uskov 318d955d64 [IC] Add tests for sealed classes (KT-45474) 2022-07-12 05:53:09 +00:00
Aleksei.Cherepanov 3d8f140d6b [JPS] Fix incremental build after changing Java enum used in Kotlin when
EnumWhenTracker implemented for tracking changed java enum class items, that used in kotlin when expression.

#KT-47824 Fixed
2022-04-19 18:39:41 +00:00
Ilya Chernikov c4a29651b0 FIR IC: fix test with behavior different from non-tight cycle variants 2022-03-30 08:34:51 +00:00
Ilya Chernikov 5abdf93d3b IC: Add IC test with fix on rename file with only class inside
"fails" on JS and JPS tests - the IC logic there is less precise.
2022-03-30 08:32:17 +00:00
Ilya Chernikov aa0386276d Fix FIR incremental compilation failure with inlines and lambdas
#KT-51546 fixed
2022-03-14 13:37:50 +03:00
Aleksei.Cherepanov 76637a8844 Fix JPS test after 9e1a771d 2022-01-31 12:55:37 +03:00
Hung Nguyen 9e1a771d57 KT-44741: Update test data to use companion object with custom name
Test: Existing IncrementalJvmCompilerRunnerTestGenerated.PureKotlin#testCompanionConstantChanged
    and similar *.PureKotlin#testCompanionConstantChanged tests
2022-01-27 02:34:42 +03:00
Aleksei.Cherepanov 44d796e850 Fix JPS tests after JPS module moved to Kotlin repo
Fix testdata of new compiler tests for JPS, as it is build-log-sensitive:
ClassHierarchyAffected.testWithIntermediateBodiesChanged
PureKotlin.testSerializedSubClassAndChangedInterfaces
WithJava.JavaUsedInKotlin.testRawErrorTypeDuringSerialization

Mute JavaUsedInKotlin.SamConversions tests, as it was fixed in 212 idea

Add missed part of commit 5f4be072 [JPS] Fix JS incremental compilation
Part of commit, located in JPS module, was missed during JPS relocation

Fix test MixedInheritance for non-JPS builds
Depends on commit [CHERRY PICKED FROM IJ] [testdata] Replace test IncrementalJvmJpsTest...
2022-01-26 10:03:05 +00:00
Aleksei.Cherepanov 411a0ecc38 [CHERRY PICKED FROM IJ] [testdata] Replace test IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.testMixedInheritance with new one
Replace test because JPS recompile inherited classes only in case of existence of direct use (like override or direct call of parent methods).
Tested cases:
*Add new abstract method when derived class does not abstract
*Add and remove method, when such method is present in derived class
*Change return type/access modifier

GitOrigin-RevId: 767e58ba3d3e4069838c717666329b43f1b8e936
Original commit: https://github.com/JetBrains/intellij-community/commit/d738c61aaefe95acd8130066f53f8d8bcadfa977
2022-01-26 10:03:04 +00:00
Aleksei.Cherepanov 7181244129 [CHERRY PICKED FROM IJ] Fix test IncrementalJvmJpsTestGenerated$WithJava$Other.testMultifileClassFileAdded
Fix test data and also remove useless marking of multifiles in KotlinBuilder after 2ee7f2b "incremental annotation processing environment" as it makes the same thing and all results are ignored

GitOrigin-RevId: 379eb3f350539cb1ee27098eecb28931df73b626
Original commit: https://github.com/JetBrains/intellij-community/commit/ee2865c35c2dadc3651518b2760b5176835b251c
2022-01-12 15:25:22 +01:00
Aleksei.Cherepanov dc9abef6e5 [CHERRY PICKED FROM IJ] [testdata] Fix Jps tests testdata
Fix test IncrementalJvmJpsTestGenerated$PureKotlin.testPackageFileAdded
Fix test IncrementalJvmJpsTestGenerated$Custom.testCommonSourcesCompilerArg
Fix test IncrementalJvmJpsTestGenerated$WithJava$JavaUsedInKotlin$SamConversions.testMethodAddDefault

GitOrigin-RevId: 63b7a47898ca42b4d7f11a01ceb0e019933f528b
Original commit: https://github.com/JetBrains/intellij-community/commit/e91bfb29e65b9eb5452c4d5f544f0bbfa3eafde3
2022-01-12 15:25:21 +01:00